diff options
| author | Richard M. Stallman | 1998-04-21 04:54:46 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-04-21 04:54:46 +0000 |
| commit | d016f81992ab4dfc5c7a50e1dafa9a031341097f (patch) | |
| tree | 12561cbadaa1a9d6eecf5b95adaf22d47932fa8b | |
| parent | ae3f2f3c6b2b85dcf1132ef6263e8b3321aefb48 (diff) | |
| download | emacs-d016f81992ab4dfc5c7a50e1dafa9a031341097f.tar.gz emacs-d016f81992ab4dfc5c7a50e1dafa9a031341097f.zip | |
(easy-menu-do-add-item):
Do the right thing when nil is specified as criterion for activeness.
Fix string used to report an invalid item.
| -rw-r--r-- | lisp/emacs-lisp/easymenu.el | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index e92f31568c6..974e21591be 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el | |||
| @@ -187,18 +187,19 @@ shadow\\(Double\\)?Etched\\(In\\|Out\\)\\(Dash\\)?\\)\\)$" | |||
| 187 | (setq name (setq item-string (aref item 0))) | 187 | (setq name (setq item-string (aref item 0))) |
| 188 | (setq command (easy-menu-make-symbol (aref item 1) t)) | 188 | (setq command (easy-menu-make-symbol (aref item 1) t)) |
| 189 | (let ((active (if (> (length item) 2) (aref item 2) t)) | 189 | (let ((active (if (> (length item) 2) (aref item 2) t)) |
| 190 | (active-specified (> (length item) 2)) | ||
| 190 | (count 2) | 191 | (count 2) |
| 191 | style selected) | 192 | style selected) |
| 192 | (if (and (symbolp active) (= ?: (aref (symbol-name active) 0))) | 193 | (if (and (symbolp active) (= ?: (aref (symbol-name active) 0))) |
| 193 | (let ((count 2) keyword arg suffix keys) | 194 | (let ((count 2) keyword arg suffix keys) |
| 194 | (setq active nil) | 195 | (setq active-specified nil) |
| 195 | (while (> (length item) count) | 196 | (while (> (length item) count) |
| 196 | (setq keyword (aref item count)) | 197 | (setq keyword (aref item count)) |
| 197 | (setq arg (aref item (1+ count))) | 198 | (setq arg (aref item (1+ count))) |
| 198 | (setq count (+ 2 count)) | 199 | (setq count (+ 2 count)) |
| 199 | (cond | 200 | (cond |
| 200 | ((eq keyword ':keys) (setq keys arg)) | 201 | ((eq keyword ':keys) (setq keys arg)) |
| 201 | ((eq keyword ':active) (setq active arg)) | 202 | ((eq keyword ':active) (setq active arg active-specified t)) |
| 202 | ((eq keyword ':suffix) (setq suffix (concat " " arg))) | 203 | ((eq keyword ':suffix) (setq suffix (concat " " arg))) |
| 203 | ((eq keyword ':style) (setq style arg)) | 204 | ((eq keyword ':style) (setq style arg)) |
| 204 | ((eq keyword ':selected) (setq selected arg)))) | 205 | ((eq keyword ':selected) (setq selected arg)))) |
| @@ -214,13 +215,15 @@ shadow\\(Double\\)?Etched\\(In\\|Out\\)\\(Dash\\)?\\)\\)$" | |||
| 214 | ,selected | 215 | ,selected |
| 215 | ,(or active t))) | 216 | ,(or active t))) |
| 216 | (setq is-button t) | 217 | (setq is-button t) |
| 217 | (setq active nil) ; Already taken care of active. | 218 | (setq active-specified nil) ; Already taken care of active. |
| 218 | (when (not (or have-buttons top)) | 219 | (when (not (or have-buttons top)) |
| 219 | (setq have-buttons " ") | 220 | (setq have-buttons " ") |
| 220 | ;; Add prefix to menu items defined so far. | 221 | ;; Add prefix to menu items defined so far. |
| 221 | (easy-menu-change-prefix menu t))))) | 222 | (easy-menu-change-prefix menu t)))) |
| 222 | (if active (put command 'menu-enable active)))) | 223 | (and (null active) active-specified |
| 223 | (t "Illegal menu item in easy menu.")) | 224 | (setq active ''nil))) |
| 225 | (if active-specified (put command 'menu-enable active)))) | ||
| 226 | (t "Invalid menu item in easymenu")) | ||
| 224 | (when name | 227 | (when name |
| 225 | (and (not is-button) have-buttons | 228 | (and (not is-button) have-buttons |
| 226 | (setq item-string (concat have-buttons item-string))) | 229 | (setq item-string (concat have-buttons item-string))) |