aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2007-04-03 10:09:45 +0000
committerNick Roberts2007-04-03 10:09:45 +0000
commita4e03d18f8239dcee619c8fb8cb334d1db641783 (patch)
tree4b06877ba5ea2294b5a01b120ac5be5298f4faed
parenta1f02fa1e4e2be0bd29107b9cae614af0c735383 (diff)
downloademacs-a4e03d18f8239dcee619c8fb8cb334d1db641783.tar.gz
emacs-a4e03d18f8239dcee619c8fb8cb334d1db641783.zip
(tmm-menubar, tmm-prompt): Handle visibility of top level menu-items.
-rw-r--r--lisp/tmm.el22
1 files changed, 16 insertions, 6 deletions
diff --git a/lisp/tmm.el b/lisp/tmm.el
index 617af0079d3..d441db76235 100644
--- a/lisp/tmm.el
+++ b/lisp/tmm.el
@@ -72,16 +72,20 @@ we make that menu bar item (the one at that position) the default choice."
72 (setq list (cdr list)))) 72 (setq list (cdr list))))
73 (if x-position 73 (if x-position
74 (let ((tail menu-bar) (column 0) 74 (let ((tail menu-bar) (column 0)
75 this-one name) 75 this-one name visible)
76 (while (and tail (<= column x-position)) 76 (while (and tail (<= column x-position))
77 (setq this-one (car tail)) 77 (setq this-one (car tail))
78 (if (and (consp this-one) 78 (if (and (consp this-one)
79 (consp (cdr this-one)) 79 (consp (cdr this-one))
80 (setq name ; nil if menu-item 80 (setq name ;simple menu
81 (cond ((stringp (nth 1 this-one)) 81 (cond ((stringp (nth 1 this-one))
82 (nth 1 this-one)) 82 (nth 1 this-one))
83 ((stringp (nth 2 this-one)) 83 ;extended menu
84 (nth 2 this-one))))) 84 ((stringp (nth 2 this-one))
85 (setq visible (plist-get
86 (nthcdr 4 this-one) :visible))
87 (unless (and visible (not (eval visible)))
88 (nth 2 this-one))))))
85 (setq column (+ column (length name) 1))) 89 (setq column (+ column (length name) 1)))
86 (setq tail (cdr tail))) 90 (setq tail (cdr tail)))
87 (setq menu-bar-item (car this-one)))) 91 (setq menu-bar-item (car this-one))))
@@ -189,14 +193,20 @@ Its value should be an event that has a binding in MENU."
189 ;; We use this to decide the initial minibuffer contents 193 ;; We use this to decide the initial minibuffer contents
190 ;; and initial history position. 194 ;; and initial history position.
191 (if default-item 195 (if default-item
192 (let ((tail menu)) 196 (let ((tail menu) visible)
193 (while (and tail 197 (while (and tail
194 (not (eq (car-safe (car tail)) default-item))) 198 (not (eq (car-safe (car tail)) default-item)))
195 ;; Be careful to count only the elements of MENU 199 ;; Be careful to count only the elements of MENU
196 ;; that actually constitute menu bar items. 200 ;; that actually constitute menu bar items.
197 (if (and (consp (car tail)) 201 (if (and (consp (car tail))
198 (or (stringp (car-safe (cdr (car tail)))) 202 (or (stringp (car-safe (cdr (car tail))))
199 (eq (car-safe (cdr (car tail))) 'menu-item))) 203 (and
204 (eq (car-safe (cdr (car tail))) 'menu-item)
205 (progn
206 (setq visible
207 (plist-get
208 (nthcdr 4 (car tail)) :visible))
209 (or (not visible) (eval visible))))))
200 (setq index-of-default (1+ index-of-default))) 210 (setq index-of-default (1+ index-of-default)))
201 (setq tail (cdr tail))))) 211 (setq tail (cdr tail)))))
202 (let ((prompt (concat "^." (regexp-quote tmm-mid-prompt)))) 212 (let ((prompt (concat "^." (regexp-quote tmm-mid-prompt))))