Mercurial > emacs
changeset 21807:c62197b13ece
(easy-menu-define-key): Fixed bug with BEFORE
argument. Now it works also if you repeat an identical call to
easy-menu-define-key.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 28 Apr 1998 20:03:07 +0000 |
parents | d17bf0e8a170 |
children | d7fe6eeb4b62 |
files | lisp/emacs-lisp/easymenu.el |
diffstat | 1 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/emacs-lisp/easymenu.el Tue Apr 28 18:13:00 1998 +0000 +++ b/lisp/emacs-lisp/easymenu.el Tue Apr 28 20:03:07 1998 +0000 @@ -274,7 +274,7 @@ ;; put binding before BEFORE in MENU, otherwise if binding is already ;; present in MENU, just change it, otherwise put it last in MENU. (let ((inserted (null item)) ; Fake already inserted. - done) + tail done) (while (not done) (cond ((or (setq done (or (null (cdr menu)) (keymapp (cdr menu)))) @@ -286,20 +286,20 @@ (unless inserted ; Don't insert more than once. (setcdr menu (cons (cons key item) (cdr menu))) (setq inserted t) - (setq menu (cdr menu)))) + (setq menu (cdr menu))) + (setq menu (cdr menu))) ((and key (equal (car-safe (cadr menu)) key)) - (if (and (or inserted ; Already inserted or - before) ; wanted elsewhere and - (or (not (setq done ; not the last in this keymap. - (or (null (cddr menu)) - (keymapp (cddr menu))))) - inserted)) - ;; The contorted logic above, guarantees `done' has been computed. + (if (or inserted ; Already inserted or + (and before ; wanted elsewhere and + (setq tail (cddr menu)) ; not last item and not + (not (keymapp tail)) + (not (equal (car-safe (car tail)) before)))) ; in position (setcdr menu (cddr menu)) ; Remove item. (setcdr (cadr menu) item) ; Change item. - (setq inserted t)))) - (setq menu (cdr menu))))) - + (setq inserted t) + (setq menu (cdr menu)))) + (t (setq menu (cdr menu))))))) + (defun easy-menu-always-true (x) ;; Return true if X never evaluates to nil. (if (consp x) (and (eq (car x) 'quote) (cadr x))