aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorGerd Moellmann <[email protected]>2000-05-03 12:33:16 +0000
committerGerd Moellmann <[email protected]>2000-05-03 12:33:16 +0000
commit49102500cc3d63da7dab692b129423c2494b8274 (patch)
tree7a3b76d767bc1e84fa0805c4f54f5a568ee82dcc /lisp/subr.el
parent329bed06e9c6412dd621827fc302ef2dc21929e7 (diff)
(add-minor-mode): Handle AFTER for keymaps. Don't
set TOGGLE's value.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el23
1 files changed, 16 insertions, 7 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 03e215a223..2256f33fac 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1502,10 +1502,9 @@ to `minor-mode-map-alist'.
Optional AFTER specifies that TOGGLE should be added after AFTER
in `minor-mode-alist'.
-Optional TOGGLE-FUN is there for compatiblity with other Emacssen.
+Optional TOGGLE-FUN is there for compatiblity with other Emacsen.
It is currently not used."
(make-local-variable toggle)
- (set toggle t)
(when name
(let ((existing (assq toggle minor-mode-alist))
@@ -1519,7 +1518,7 @@ It is currently not used."
(if found
(let ((rest (cdr found)))
(setcdr found nil)
- (nconc found (list toggle name) rest))
+ (nconc found (list (list toggle name)) rest))
(setq minor-mode-alist (cons (list toggle name)
minor-mode-alist)))))
(t
@@ -1527,10 +1526,20 @@ It is currently not used."
(when keymap
(let ((existing (assq toggle minor-mode-map-alist)))
- (if existing
- (setcdr existing keymap)
- (setq minor-mode-map-alist (cons (cons toggle keymap)
- minor-mode-map-alist))))))
+ (cond ((null existing)
+ (let ((tail minor-mode-map-alist) found)
+ (while (and tail (not found))
+ (if (eq after (caar tail))
+ (setq found tail)
+ (setq tail (cdr tail))))
+ (if found
+ (let ((rest (cdr found)))
+ (setcdr found nil)
+ (nconc found (list (cons toggle keymap)) rest))
+ (setq minor-mode-map-alist (cons (cons toggle keymap)
+ minor-mode-map-alist)))))
+ (t
+ (setcdr existing keymap))))))
;;; subr.el ends here