summaryrefslogtreecommitdiff
path: root/lisp/textmodes/enriched.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-02-10 11:56:00 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2011-02-10 11:56:00 -0500
commitb016851cb127f91a7ffa5d8295e5f3d4fdd3222a (patch)
treee1ccff1ff1bf49670b0cea40ebd566e1449290ee /lisp/textmodes/enriched.el
parent1be1d1e98e5465659b9633a3f1961e6dcc0b022a (diff)
downloademacs-b016851cb127f91a7ffa5d8295e5f3d4fdd3222a.tar.gz
Move keymap initialization into declaration.
* lisp/textmodes/enriched.el (enriched-mode-map): * lisp/textmodes/bib-mode.el (bib-mode-map): * lisp/term/lk201.el (lk201-function-map): * lisp/tar-mode.el (tar-mode-map): * lisp/replace.el (occur-mode-map): * lisp/progmodes/idlwave.el (idlwave-rinfo-mouse-map, idlwave-rinfo-map): * lisp/progmodes/idlw-help.el (idlwave-help-mode-map): * lisp/progmodes/gdb-mi.el (gdb-memory-format-menu, gdb-memory-unit-menu): * lisp/play/solitaire.el (solitaire-mode-map): * lisp/play/snake.el (snake-mode-map, snake-null-map): * lisp/play/pong.el (pong-mode-map): * lisp/play/handwrite.el (menu-bar-handwrite-map): * lisp/play/gametree.el (gametree-mode-map): * lisp/net/rcirc.el (rcirc-mode-map, rcirc-browse-url-map (rcirc-multiline-minor-mode-map, rcirc-track-minor-mode-map): * lisp/net/newst-plainview.el (newsticker-menu, newsticker-mode-map) (newsticker--url-keymap): * lisp/net/net-utils.el (nslookup-mode-map, ftp-mode-map): * lisp/menu-bar.el (menu-bar-file-menu, menu-bar-i-search-menu) (menu-bar-search-menu, menu-bar-replace-menu, menu-bar-goto-menu) (menu-bar-edit-menu, menu-bar-custom-menu) (menu-bar-showhide-fringe-ind-menu, menu-bar-showhide-fringe-menu) (menu-bar-showhide-scroll-bar-menu, menu-bar-showhide-menu) (menu-bar-line-wrapping-menu, menu-bar-options-menu) (menu-bar-games-menu, menu-bar-encryption-decryption-menu) (menu-bar-tools-menu, menu-bar-describe-menu) (menu-bar-search-documentation-menu, menu-bar-manuals-menu) (menu-bar-help-menu): * lisp/mail/rmailsum.el (rmail-summary-mode-map): * lisp/kmacro.el (kmacro-step-edit-map): * lisp/ibuffer.el (ibuffer-mode-groups-popup, ibuffer-mode-map) (ibuffer-mode-operate-map): * lisp/hi-lock.el (hi-lock-menu, hi-lock-map): * lisp/emulation/vip.el (vip-mode-map): * lisp/emacs-lisp/re-builder.el (reb-lisp-mode-map): * lisp/bookmark.el (bookmark-bmenu-mode-map): * lisp/help-mode.el (help-mode-map): * lisp/erc/erc-list.el (erc-list-menu-mode-map): * lisp/org/org-remember.el (org-remember-mode-map): * lisp/org/org-src.el (org-src-mode-map): Move initialization into declaration.
Diffstat (limited to 'lisp/textmodes/enriched.el')
-rw-r--r--lisp/textmodes/enriched.el48
1 files changed, 23 insertions, 25 deletions
diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el
index f6677bf458e..357b9d6c94e 100644
--- a/lisp/textmodes/enriched.el
+++ b/lisp/textmodes/enriched.el
@@ -164,6 +164,24 @@ The value is a list of \(VAR VALUE VAR VALUE...).")
(defvar enriched-rerun-flag nil)
;;;
+;;; Keybindings
+;;;
+
+(defvar enriched-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map [remap move-beginning-of-line] 'beginning-of-line-text)
+ (define-key map "\C-m" 'reindent-then-newline-and-indent)
+ (define-key map
+ [remap newline-and-indent] 'reindent-then-newline-and-indent)
+ (define-key map "\M-j" 'facemenu-justification-menu)
+ (define-key map "\M-S" 'set-justification-center)
+ (define-key map "\C-x\t" 'increase-left-margin)
+ (define-key map "\C-c[" 'set-left-margin)
+ (define-key map "\C-c]" 'set-right-margin)
+ map)
+ "Keymap for Enriched mode.")
+
+;;;
;;; Define the mode
;;;
@@ -184,6 +202,8 @@ Commands:
:group 'enriched :lighter " Enriched"
(cond ((null enriched-mode)
;; Turn mode off
+ (remove-hook 'change-major-mode-hook
+ 'enriched-before-change-major-mode 'local)
(setq buffer-file-format (delq 'text/enriched buffer-file-format))
;; restore old variable values
(while enriched-old-bindings
@@ -199,6 +219,8 @@ Commands:
nil)
(t ; Turn mode on
+ (add-hook 'change-major-mode-hook
+ 'enriched-before-change-major-mode nil 'local)
(add-to-list 'buffer-file-format 'text/enriched)
;; Save old variable values before we change them.
;; These will be restored if we exit Enriched mode.
@@ -226,8 +248,6 @@ Commands:
(while enriched-old-bindings
(set (pop enriched-old-bindings) (pop enriched-old-bindings)))))
-(add-hook 'change-major-mode-hook 'enriched-before-change-major-mode)
-
(defun enriched-after-change-major-mode ()
(when enriched-mode
(let ((enriched-rerun-flag t))
@@ -235,30 +255,8 @@ Commands:
(add-hook 'after-change-major-mode-hook 'enriched-after-change-major-mode)
-;;;
-;;; Keybindings
-;;;
-
-(defvar enriched-mode-map nil
- "Keymap for Enriched mode.")
-(if (null enriched-mode-map)
- (fset 'enriched-mode-map (setq enriched-mode-map (make-sparse-keymap))))
-
-(if (not (assq 'enriched-mode minor-mode-map-alist))
- (setq minor-mode-map-alist
- (cons (cons 'enriched-mode enriched-mode-map)
- minor-mode-map-alist)))
-
-(define-key enriched-mode-map [remap move-beginning-of-line] 'beginning-of-line-text)
-(define-key enriched-mode-map "\C-m" 'reindent-then-newline-and-indent)
-(define-key enriched-mode-map
- [remap newline-and-indent] 'reindent-then-newline-and-indent)
-(define-key enriched-mode-map "\M-j" 'facemenu-justification-menu)
-(define-key enriched-mode-map "\M-S" 'set-justification-center)
-(define-key enriched-mode-map "\C-x\t" 'increase-left-margin)
-(define-key enriched-mode-map "\C-c[" 'set-left-margin)
-(define-key enriched-mode-map "\C-c]" 'set-right-margin)
+(fset 'enriched-mode-map enriched-mode-map)
;;;
;;; Some functions dealing with text-properties, especially indentation