summaryrefslogtreecommitdiff
path: root/lisp/tmm.el
diff options
context:
space:
mode:
authorNick Roberts <nickrob@snap.net.nz>2007-03-30 06:11:38 +0000
committerNick Roberts <nickrob@snap.net.nz>2007-03-30 06:11:38 +0000
commit573e00ef11e3be64f8cce153bd528a2258503d73 (patch)
tree783ab50e1da6c45aa26c45e3f210c375ef8d52da /lisp/tmm.el
parent715ecc6c1c285c5b6bdef1171de756c13cf79bd5 (diff)
downloademacs-573e00ef11e3be64f8cce153bd528a2258503d73.tar.gz
(tmm-menubar): Select the right menu item with the mouse.
(tmm-prompt): Don't make the mouse user select the first menu item twice.
Diffstat (limited to 'lisp/tmm.el')
-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."
(let ((tail menu-bar)
this-one
(column 0))
- (while (and tail (< column x-position))
+ (while (and tail (<= column x-position))
(setq this-one (car tail))
- (if (and (consp (car tail))
- (consp (cdr (car tail)))
- (stringp (nth 1 (car tail))))
+ (if (and (consp this-one)
+ (consp (cdr this-one))
+ (stringp (nth 1 this-one)))
(setq column (+ column
- (length (nth 1 (car tail)))
+ (length (nth 1 this-one))
1)))
(setq tail (cdr tail)))
(setq menu-bar-item (car this-one))))
@@ -210,21 +210,24 @@ Its value should be an event that has a binding in MENU."
(setq history (append history history history history))
(setq tmm-c-prompt (nth (- history-len 1 index-of-default) history))
(add-hook 'minibuffer-setup-hook 'tmm-add-prompt)
- (save-excursion
- (unwind-protect
- (setq out
- (completing-read
- (concat gl-str " (up/down to change, PgUp to menu): ")
- tmm-km-list nil t nil
- (cons 'history (- (* 2 history-len) index-of-default))))
- (save-excursion
- (remove-hook 'minibuffer-setup-hook 'tmm-add-prompt)
- (if (get-buffer "*Completions*")
- (progn
- (set-buffer "*Completions*")
- (use-local-map tmm-old-comp-map)
- (bury-buffer (current-buffer)))))
- ))))
+ (if default-item
+ (setq out (car (nth index-of-default tmm-km-list)))
+ (save-excursion
+ (unwind-protect
+ (setq out
+ (completing-read
+ (concat gl-str
+ " (up/down to change, PgUp to menu): ")
+ tmm-km-list nil t nil
+ (cons 'history
+ (- (* 2 history-len) index-of-default))))
+ (save-excursion
+ (remove-hook 'minibuffer-setup-hook 'tmm-add-prompt)
+ (if (get-buffer "*Completions*")
+ (progn
+ (set-buffer "*Completions*")
+ (use-local-map tmm-old-comp-map)
+ (bury-buffer (current-buffer))))))))))
(setq choice (cdr (assoc out tmm-km-list)))
(and (null choice)
(> (length out) (length tmm-c-prompt))