comparison lisp/tmm.el @ 76911:0d761d6b0064

(tmm-menubar, tmm-prompt): Handle visibility of top level menu-items.
author Nick Roberts <nickrob@snap.net.nz>
date Tue, 03 Apr 2007 10:09:45 +0000
parents 624ef730616c
children 3c1a4db3e853 4ef881a120fe
comparison
equal deleted inserted replaced
76910:e7efa8bb36c1 76911:0d761d6b0064
70 (setq menu-bar (append (delq this-one menu-bar) 70 (setq menu-bar (append (delq this-one menu-bar)
71 (list this-one))))) 71 (list this-one)))))
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))))
88 (tmm-prompt menu-bar nil menu-bar-item))) 92 (tmm-prompt menu-bar nil menu-bar-item)))
89 93
187 t) 191 t)
188 ;; Find the default item's index within the menu bar. 192 ;; Find the default item's index within the menu bar.
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))))
203 (setq history 213 (setq history
204 (reverse (delq nil 214 (reverse (delq nil