aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2007-03-30 06:11:38 +0000
committerNick Roberts2007-03-30 06:11:38 +0000
commit573e00ef11e3be64f8cce153bd528a2258503d73 (patch)
tree783ab50e1da6c45aa26c45e3f210c375ef8d52da
parent715ecc6c1c285c5b6bdef1171de756c13cf79bd5 (diff)
downloademacs-573e00ef11e3be64f8cce153bd528a2258503d73.tar.gz
emacs-573e00ef11e3be64f8cce153bd528a2258503d73.zip
(tmm-menubar): Select the right menu item with the mouse.
(tmm-prompt): Don't make the mouse user select the first menu item twice.
-rw-r--r--lisp/tmm.el43
1 files changed, 23 insertions, 20 deletions
diff --git a/lisp/tmm.el b/lisp/tmm.el
index 1347ed81444..c2ffd5e62bf 100644
--- a/lisp/tmm.el
+++ b/lisp/tmm.el
@@ -74,13 +74,13 @@ we make that menu bar item (the one at that position) the default choice."
74 (let ((tail menu-bar) 74 (let ((tail menu-bar)
75 this-one 75 this-one
76 (column 0)) 76 (column 0))
77 (while (and tail (< column x-position)) 77 (while (and tail (<= column x-position))
78 (setq this-one (car tail)) 78 (setq this-one (car tail))
79 (if (and (consp (car tail)) 79 (if (and (consp this-one)
80 (consp (cdr (car tail))) 80 (consp (cdr this-one))
81 (stringp (nth 1 (car tail)))) 81 (stringp (nth 1 this-one)))
82 (setq column (+ column 82 (setq column (+ column
83 (length (nth 1 (car tail))) 83 (length (nth 1 this-one))
84 1))) 84 1)))
85 (setq tail (cdr tail))) 85 (setq tail (cdr tail)))
86 (setq menu-bar-item (car this-one)))) 86 (setq menu-bar-item (car this-one))))
@@ -210,21 +210,24 @@ Its value should be an event that has a binding in MENU."
210 (setq history (append history history history history)) 210 (setq history (append history history history history))
211 (setq tmm-c-prompt (nth (- history-len 1 index-of-default) history)) 211 (setq tmm-c-prompt (nth (- history-len 1 index-of-default) history))
212 (add-hook 'minibuffer-setup-hook 'tmm-add-prompt) 212 (add-hook 'minibuffer-setup-hook 'tmm-add-prompt)
213 (save-excursion 213 (if default-item
214 (unwind-protect 214 (setq out (car (nth index-of-default tmm-km-list)))
215 (setq out 215 (save-excursion
216 (completing-read 216 (unwind-protect
217 (concat gl-str " (up/down to change, PgUp to menu): ") 217 (setq out
218 tmm-km-list nil t nil 218 (completing-read
219 (cons 'history (- (* 2 history-len) index-of-default)))) 219 (concat gl-str
220 (save-excursion 220 " (up/down to change, PgUp to menu): ")
221 (remove-hook 'minibuffer-setup-hook 'tmm-add-prompt) 221 tmm-km-list nil t nil
222 (if (get-buffer "*Completions*") 222 (cons 'history
223 (progn 223 (- (* 2 history-len) index-of-default))))
224 (set-buffer "*Completions*") 224 (save-excursion
225 (use-local-map tmm-old-comp-map) 225 (remove-hook 'minibuffer-setup-hook 'tmm-add-prompt)
226 (bury-buffer (current-buffer))))) 226 (if (get-buffer "*Completions*")
227 )))) 227 (progn
228 (set-buffer "*Completions*")
229 (use-local-map tmm-old-comp-map)
230 (bury-buffer (current-buffer))))))))))
228 (setq choice (cdr (assoc out tmm-km-list))) 231 (setq choice (cdr (assoc out tmm-km-list)))
229 (and (null choice) 232 (and (null choice)
230 (> (length out) (length tmm-c-prompt)) 233 (> (length out) (length tmm-c-prompt))