changeset 112253:b0afc08be821

* tmm.el (tmm-get-keymap): Skip bindings without labels. (tmm-prompt): Simplify. (tmm-add-prompt): Remove unused var `win'.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 10 Jan 2011 21:28:48 -0500
parents 6409a00a5462
children 937206a3f7f7
files lisp/ChangeLog lisp/tmm.el
diffstat 2 files changed, 36 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Jan 10 19:14:25 2011 -0500
+++ b/lisp/ChangeLog	Mon Jan 10 21:28:48 2011 -0500
@@ -1,5 +1,9 @@
 2011-01-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* tmm.el (tmm-get-keymap): Skip bindings without labels (bug#7721).
+	(tmm-prompt): Simplify.
+	(tmm-add-prompt): Remove unused var `win'.
+
 	* whitespace.el (global-whitespace-newline-mode): Fix call (bug#7810)
 	to minor mode which used nil accidentally to mean "turn off".
 
--- a/lisp/tmm.el	Mon Jan 10 19:14:25 2011 -0500
+++ b/lisp/tmm.el	Mon Jan 10 21:28:48 2011 -0500
@@ -168,14 +168,13 @@
     ;; It has no other elements.
     ;; The order of elements in tmm-km-list is the order of the menu bar.
     (mapc (lambda (elt)
-	    (if (stringp elt)
-		(setq gl-str elt)
-	      (cond
-	       ((listp elt) (tmm-get-keymap elt not-menu))
-	       ((vectorp elt)
-		(dotimes (i (length elt))
-		  (tmm-get-keymap (cons i (aref elt i)) not-menu))))))
-	    menu)
+            (cond
+             ((stringp elt) (setq gl-str elt))
+             ((listp elt) (tmm-get-keymap elt not-menu))
+             ((vectorp elt)
+              (dotimes (i (length elt))
+                (tmm-get-keymap (cons i (aref elt i)) not-menu)))))
+          menu)
     ;; Choose an element of tmm-km-list; put it in choice.
     (if (and not-menu (= 1 (length tmm-km-list)))
 	;; If this is the top-level of an x-popup-menu menu,
@@ -368,32 +367,31 @@
   (add-hook 'minibuffer-exit-hook 'tmm-delete-map nil t)
   (unless tmm-c-prompt
     (error "No active menu entries"))
-  (let ((win (selected-window)))
-    (setq tmm-old-mb-map (tmm-define-keys t))
-    ;; Get window and hide it for electric mode to get correct size
-    (save-window-excursion
-      (let ((completions
-	     (mapcar 'car minibuffer-completion-table)))
-        (or tmm-completion-prompt
-            (add-hook 'completion-setup-hook
-                      'tmm-completion-delete-prompt 'append))
-        (unwind-protect
-            (with-output-to-temp-buffer "*Completions*"
-              (display-completion-list completions))
-          (remove-hook 'completion-setup-hook 'tmm-completion-delete-prompt)))
-      (set-buffer "*Completions*")
-      (tmm-remove-inactive-mouse-face)
-      (when tmm-completion-prompt
-	(let ((buffer-read-only nil))
-	  (goto-char (point-min))
-	  (insert tmm-completion-prompt))))
-    (save-selected-window
-      (other-window 1)			; Electric-pop-up-window does
+  (setq tmm-old-mb-map (tmm-define-keys t))
+  ;; Get window and hide it for electric mode to get correct size
+  (save-window-excursion
+    (let ((completions
+           (mapcar 'car minibuffer-completion-table)))
+      (or tmm-completion-prompt
+          (add-hook 'completion-setup-hook
+                    'tmm-completion-delete-prompt 'append))
+      (unwind-protect
+          (with-output-to-temp-buffer "*Completions*"
+            (display-completion-list completions))
+        (remove-hook 'completion-setup-hook 'tmm-completion-delete-prompt)))
+    (set-buffer "*Completions*")
+    (tmm-remove-inactive-mouse-face)
+    (when tmm-completion-prompt
+      (let ((buffer-read-only nil))
+        (goto-char (point-min))
+        (insert tmm-completion-prompt))))
+  (save-selected-window
+    (other-window 1)			; Electric-pop-up-window does
 					; not work in minibuffer
-      (Electric-pop-up-window "*Completions*")
-      (with-current-buffer "*Completions*"
-	(setq tmm-old-comp-map (tmm-define-keys nil))))
-    (insert tmm-c-prompt)))
+    (Electric-pop-up-window "*Completions*")
+    (with-current-buffer "*Completions*"
+      (setq tmm-old-comp-map (tmm-define-keys nil))))
+  (insert tmm-c-prompt))
 
 (defun tmm-delete-map ()
   (remove-hook 'minibuffer-exit-hook 'tmm-delete-map t)
@@ -497,7 +495,7 @@
 	       (if (or in-x-menu (stringp (car-safe elt)))
 		   (setq str event event nil km elt)
 		 (setq str event event nil km (cons 'keymap elt)))))
-        (unless (eq km 'ignore)
+        (unless (or (eq km 'ignore) (null str))
           (let ((binding (where-is-internal km nil t)))
             (when binding
               (setq binding (key-description binding))