Mercurial > emacs
comparison lisp/emacs-lisp/easymenu.el @ 19591:c24b4ef20525
(easy-menu-create-keymaps): If nil is
given as the enable condition, always disable the command.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 28 Aug 1997 03:04:18 +0000 |
parents | af96712b7f5d |
children | 17137a054eeb |
comparison
equal
deleted
inserted
replaced
19590:167f4700890a | 19591:c24b4ef20525 |
---|---|
140 (setq name (setq item-string (aref item 0))) | 140 (setq name (setq item-string (aref item 0))) |
141 (let ((keyword (aref item 2))) | 141 (let ((keyword (aref item 2))) |
142 (if (and (symbolp keyword) | 142 (if (and (symbolp keyword) |
143 (= ?: (aref (symbol-name keyword) 0))) | 143 (= ?: (aref (symbol-name keyword) 0))) |
144 (let ((count 2) | 144 (let ((count 2) |
145 style selected active keys | 145 style selected active keys active-specified |
146 arg) | 146 arg) |
147 (while (> (length item) count) | 147 (while (> (length item) count) |
148 (setq keyword (aref item count)) | 148 (setq keyword (aref item count)) |
149 (setq arg (aref item (1+ count))) | 149 (setq arg (aref item (1+ count))) |
150 (setq count (+ 2 count)) | 150 (setq count (+ 2 count)) |
151 (cond ((eq keyword ':keys) | 151 (cond ((eq keyword ':keys) |
152 (setq keys arg)) | 152 (setq keys arg)) |
153 ((eq keyword ':active) | 153 ((eq keyword ':active) |
154 (setq active arg)) | 154 (setq active (or arg ''nil) |
155 active-specified t)) | |
155 ((eq keyword ':suffix) | 156 ((eq keyword ':suffix) |
156 (setq item-string | 157 (setq item-string |
157 (concat item-string " " arg))) | 158 (concat item-string " " arg))) |
158 ((eq keyword ':style) | 159 ((eq keyword ':style) |
159 (setq style arg)) | 160 (setq style arg)) |
183 have-buttons t) | 184 have-buttons t) |
184 (while old-items ; Fix items aleady defined. | 185 (while old-items ; Fix items aleady defined. |
185 (setcar (car old-items) | 186 (setcar (car old-items) |
186 (concat " " (car (car old-items)))) | 187 (concat " " (car (car old-items)))) |
187 (setq old-items (cdr old-items))))) | 188 (setq old-items (cdr old-items))))) |
188 (if active (put command 'menu-enable active))) | 189 (if active-specified (put command 'menu-enable active))) |
189 (put command 'menu-enable keyword))) | 190 ;; If the third element is nil, |
191 ;; make this command always disabled. | |
192 (put command 'menu-enable (or keyword ''nil)))) | |
190 (if (symbolp callback) | 193 (if (symbolp callback) |
191 (fset command callback) | 194 (fset command callback) |
192 (fset command (list 'lambda () '(interactive) callback))) | 195 (fset command (list 'lambda () '(interactive) callback))) |
193 (put command 'menu-alias t))) | 196 (put command 'menu-alias t))) |
194 (if (null command) | 197 (if (null command) |