diff options
| author | Stefan Monnier | 2011-01-10 21:28:48 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2011-01-10 21:28:48 -0500 |
| commit | 9ca3fe48ff046163b11b98f95c4459bae351cf66 (patch) | |
| tree | 70ca8fd0c745389809d6fcc848896739cf7e7e16 | |
| parent | cfab9f9bd7e5ab73427cb2afc11d0defeb3b8588 (diff) | |
| download | emacs-9ca3fe48ff046163b11b98f95c4459bae351cf66.tar.gz emacs-9ca3fe48ff046163b11b98f95c4459bae351cf66.zip | |
* tmm.el (tmm-get-keymap): Skip bindings without labels.
(tmm-prompt): Simplify.
(tmm-add-prompt): Remove unused var `win'.
Fixes: debbugs:7721
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/tmm.el | 66 |
2 files changed, 36 insertions, 34 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4553b6ed28c..22c92d3691f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2011-01-11 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2011-01-11 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * tmm.el (tmm-get-keymap): Skip bindings without labels (bug#7721). | ||
| 4 | (tmm-prompt): Simplify. | ||
| 5 | (tmm-add-prompt): Remove unused var `win'. | ||
| 6 | |||
| 3 | * whitespace.el (global-whitespace-newline-mode): Fix call (bug#7810) | 7 | * whitespace.el (global-whitespace-newline-mode): Fix call (bug#7810) |
| 4 | to minor mode which used nil accidentally to mean "turn off". | 8 | to minor mode which used nil accidentally to mean "turn off". |
| 5 | 9 | ||
diff --git a/lisp/tmm.el b/lisp/tmm.el index 3d8433e281f..0341b5384f0 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el | |||
| @@ -168,14 +168,13 @@ Its value should be an event that has a binding in MENU." | |||
| 168 | ;; It has no other elements. | 168 | ;; It has no other elements. |
| 169 | ;; The order of elements in tmm-km-list is the order of the menu bar. | 169 | ;; The order of elements in tmm-km-list is the order of the menu bar. |
| 170 | (mapc (lambda (elt) | 170 | (mapc (lambda (elt) |
| 171 | (if (stringp elt) | 171 | (cond |
| 172 | (setq gl-str elt) | 172 | ((stringp elt) (setq gl-str elt)) |
| 173 | (cond | 173 | ((listp elt) (tmm-get-keymap elt not-menu)) |
| 174 | ((listp elt) (tmm-get-keymap elt not-menu)) | 174 | ((vectorp elt) |
| 175 | ((vectorp elt) | 175 | (dotimes (i (length elt)) |
| 176 | (dotimes (i (length elt)) | 176 | (tmm-get-keymap (cons i (aref elt i)) not-menu))))) |
| 177 | (tmm-get-keymap (cons i (aref elt i)) not-menu)))))) | 177 | menu) |
| 178 | menu) | ||
| 179 | ;; Choose an element of tmm-km-list; put it in choice. | 178 | ;; Choose an element of tmm-km-list; put it in choice. |
| 180 | (if (and not-menu (= 1 (length tmm-km-list))) | 179 | (if (and not-menu (= 1 (length tmm-km-list))) |
| 181 | ;; If this is the top-level of an x-popup-menu menu, | 180 | ;; If this is the top-level of an x-popup-menu menu, |
| @@ -368,32 +367,31 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'." | |||
| 368 | (add-hook 'minibuffer-exit-hook 'tmm-delete-map nil t) | 367 | (add-hook 'minibuffer-exit-hook 'tmm-delete-map nil t) |
| 369 | (unless tmm-c-prompt | 368 | (unless tmm-c-prompt |
| 370 | (error "No active menu entries")) | 369 | (error "No active menu entries")) |
| 371 | (let ((win (selected-window))) | 370 | (setq tmm-old-mb-map (tmm-define-keys t)) |
| 372 | (setq tmm-old-mb-map (tmm-define-keys t)) | 371 | ;; Get window and hide it for electric mode to get correct size |
| 373 | ;; Get window and hide it for electric mode to get correct size | 372 | (save-window-excursion |
| 374 | (save-window-excursion | 373 | (let ((completions |
| 375 | (let ((completions | 374 | (mapcar 'car minibuffer-completion-table))) |
| 376 | (mapcar 'car minibuffer-completion-table))) | 375 | (or tmm-completion-prompt |
| 377 | (or tmm-completion-prompt | 376 | (add-hook 'completion-setup-hook |
| 378 | (add-hook 'completion-setup-hook | 377 | 'tmm-completion-delete-prompt 'append)) |
| 379 | 'tmm-completion-delete-prompt 'append)) | 378 | (unwind-protect |
| 380 | (unwind-protect | 379 | (with-output-to-temp-buffer "*Completions*" |
| 381 | (with-output-to-temp-buffer "*Completions*" | 380 | (display-completion-list completions)) |
| 382 | (display-completion-list completions)) | 381 | (remove-hook 'completion-setup-hook 'tmm-completion-delete-prompt))) |
| 383 | (remove-hook 'completion-setup-hook 'tmm-completion-delete-prompt))) | 382 | (set-buffer "*Completions*") |
| 384 | (set-buffer "*Completions*") | 383 | (tmm-remove-inactive-mouse-face) |
| 385 | (tmm-remove-inactive-mouse-face) | 384 | (when tmm-completion-prompt |
| 386 | (when tmm-completion-prompt | 385 | (let ((buffer-read-only nil)) |
| 387 | (let ((buffer-read-only nil)) | 386 | (goto-char (point-min)) |
| 388 | (goto-char (point-min)) | 387 | (insert tmm-completion-prompt)))) |
| 389 | (insert tmm-completion-prompt)))) | 388 | (save-selected-window |
| 390 | (save-selected-window | 389 | (other-window 1) ; Electric-pop-up-window does |
| 391 | (other-window 1) ; Electric-pop-up-window does | ||
| 392 | ; not work in minibuffer | 390 | ; not work in minibuffer |
| 393 | (Electric-pop-up-window "*Completions*") | 391 | (Electric-pop-up-window "*Completions*") |
| 394 | (with-current-buffer "*Completions*" | 392 | (with-current-buffer "*Completions*" |
| 395 | (setq tmm-old-comp-map (tmm-define-keys nil)))) | 393 | (setq tmm-old-comp-map (tmm-define-keys nil)))) |
| 396 | (insert tmm-c-prompt))) | 394 | (insert tmm-c-prompt)) |
| 397 | 395 | ||
| 398 | (defun tmm-delete-map () | 396 | (defun tmm-delete-map () |
| 399 | (remove-hook 'minibuffer-exit-hook 'tmm-delete-map t) | 397 | (remove-hook 'minibuffer-exit-hook 'tmm-delete-map t) |
| @@ -497,7 +495,7 @@ It uses the free variable `tmm-table-undef' to keep undefined keys." | |||
| 497 | (if (or in-x-menu (stringp (car-safe elt))) | 495 | (if (or in-x-menu (stringp (car-safe elt))) |
| 498 | (setq str event event nil km elt) | 496 | (setq str event event nil km elt) |
| 499 | (setq str event event nil km (cons 'keymap elt))))) | 497 | (setq str event event nil km (cons 'keymap elt))))) |
| 500 | (unless (eq km 'ignore) | 498 | (unless (or (eq km 'ignore) (null str)) |
| 501 | (let ((binding (where-is-internal km nil t))) | 499 | (let ((binding (where-is-internal km nil t))) |
| 502 | (when binding | 500 | (when binding |
| 503 | (setq binding (key-description binding)) | 501 | (setq binding (key-description binding)) |