summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1999-08-28 15:13:37 +0000
committerKarl Heuer <kwzh@gnu.org>1999-08-28 15:13:37 +0000
commit5e21ef7a07eebedd9b499749f35817974c79f36d (patch)
tree78aabf4149bb454537a6b863a4ddc62622022801 /lisp/emacs-lisp
parent620fdfdf610c3f5b7f775d1ca30fbfaf25d37440 (diff)
downloademacs-5e21ef7a07eebedd9b499749f35817974c79f36d.tar.gz
emacs-5e21ef7a07eebedd9b499749f35817974c79f36d.tar.bz2
emacs-5e21ef7a07eebedd9b499749f35817974c79f36d.zip
(easy-mmode-define-minor-mode):
On repeated call, override previous values put into minor-mode-map-alist and minor-mode-alist.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/easy-mmode.el19
1 files changed, 11 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index a157028a6be..fe5b7a6ad07 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -137,11 +137,11 @@ in order to build a valid keymap.
(keymap-name (concat mode-name "-map"))
(keymap-doc (format "Keymap for %s mode." mode-name)))
`(progn
- ;; define the switch
+ ;; Define the variable to enable or disable the mode.
(defvar ,mode ,init-value ,mode-doc)
(make-variable-buffer-local ',mode)
- ;; define the minor-mode keymap
+ ;; Define the minor-mode keymap.
(defvar ,(intern keymap-name)
(cond ((and ,keymap (keymapp ,keymap))
,keymap)
@@ -150,18 +150,21 @@ in order to build a valid keymap.
(t (error "Invalid keymap %S" ,keymap)))
,keymap-doc)
- ;; define the toggle and the hooks
- ,(macroexpand `(easy-mmode-define-toggle ,mode ,doc)) ; toggle and hooks
+ ;; Define the toggle and the hooks.
+ ,(macroexpand `(easy-mmode-define-toggle ,mode ,doc))
- ;; update the mode-bar
+ ;; Update the mode line.
(or (assq ',mode minor-mode-alist)
(setq minor-mode-alist
- (cons (list ',mode ,lighter) minor-mode-alist)))
+ (cons (list ',mode nil) minor-mode-alist)))
+ (setcar (cdr (assq ',mode minor-mode-alist)) ,lighter)
- ;; update the minor-mode-map
+ ;; Update the minor mode map.
(or (assq ',mode minor-mode-map-alist)
(setq minor-mode-map-alist
- (cons (cons ',mode ,(intern keymap-name)) minor-mode-map-alist)))) ))
+ (cons (cons ',mode ,(intern keymap-name)) minor-mode-map-alist)))
+ (setcdr (assq ',mode minor-mode-map-alist)
+ ,(intern keymap-name))) ))
(provide 'easy-mmode)