diff options
author | Nick Roberts <nickrob@snap.net.nz> | 2007-04-03 10:09:45 +0000 |
---|---|---|
committer | Nick Roberts <nickrob@snap.net.nz> | 2007-04-03 10:09:45 +0000 |
commit | a4e03d18f8239dcee619c8fb8cb334d1db641783 (patch) | |
tree | 4b06877ba5ea2294b5a01b120ac5be5298f4faed /lisp/tmm.el | |
parent | a1f02fa1e4e2be0bd29107b9cae614af0c735383 (diff) | |
download | emacs-a4e03d18f8239dcee619c8fb8cb334d1db641783.tar.gz |
(tmm-menubar, tmm-prompt): Handle visibility of top level menu-items.
Diffstat (limited to 'lisp/tmm.el')
-rw-r--r-- | lisp/tmm.el | 22 |
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." (setq list (cdr list)))) (if x-position (let ((tail menu-bar) (column 0) - this-one name) + this-one name visible) (while (and tail (<= column x-position)) (setq this-one (car tail)) (if (and (consp this-one) (consp (cdr this-one)) - (setq name ; nil if menu-item + (setq name ;simple menu (cond ((stringp (nth 1 this-one)) (nth 1 this-one)) - ((stringp (nth 2 this-one)) - (nth 2 this-one))))) + ;extended menu + ((stringp (nth 2 this-one)) + (setq visible (plist-get + (nthcdr 4 this-one) :visible)) + (unless (and visible (not (eval visible))) + (nth 2 this-one)))))) (setq column (+ column (length name) 1))) (setq tail (cdr tail))) (setq menu-bar-item (car this-one)))) @@ -189,14 +193,20 @@ Its value should be an event that has a binding in MENU." ;; We use this to decide the initial minibuffer contents ;; and initial history position. (if default-item - (let ((tail menu)) + (let ((tail menu) visible) (while (and tail (not (eq (car-safe (car tail)) default-item))) ;; Be careful to count only the elements of MENU ;; that actually constitute menu bar items. (if (and (consp (car tail)) (or (stringp (car-safe (cdr (car tail)))) - (eq (car-safe (cdr (car tail))) 'menu-item))) + (and + (eq (car-safe (cdr (car tail))) 'menu-item) + (progn + (setq visible + (plist-get + (nthcdr 4 (car tail)) :visible)) + (or (not visible) (eval visible)))))) (setq index-of-default (1+ index-of-default))) (setq tail (cdr tail))))) (let ((prompt (concat "^." (regexp-quote tmm-mid-prompt)))) |