changeset 31895:6d04db7a9256

(tool-bar-help): New function.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 26 Sep 2000 09:34:55 +0000
parents 26af159ff0df
children 67d48bdd7bfd
files lisp/toolbar/tool-bar.el
diffstat 1 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/toolbar/tool-bar.el	Mon Sep 25 21:11:52 2000 +0000
+++ b/lisp/toolbar/tool-bar.el	Tue Sep 26 09:34:55 2000 +0000
@@ -151,12 +151,22 @@
 (tool-bar-add-item-from-menu 'print-buffer "print")
 (tool-bar-add-item "preferences" 'customize 'customize nil
 		   :help "Edit preferences (customize)")
-(tool-bar-add-item "help"
-		   (lambda ()
-		     (interactive)
-		     (let ((p (mouse-position)))
-		       (x-popup-menu (list (list (cadr p) (cddr p)) (car p))
-				     menu-bar-help-menu)))
+
+(defun tool-bar-help ()
+  "Pop up the help menu from the tool-bar."
+  (interactive)
+  (let* ((p (mouse-position))
+	 (menu menu-bar-help-menu)
+	 (selection (x-popup-menu (list (list (cadr p) (cddr p)) (car p))
+				  menu))
+	 binding)
+    (while selection
+      (setq binding (lookup-key (or binding menu) (vector (car selection)))
+	    selection (cdr selection)))
+    (when binding
+      (call-interactively binding))))
+
+(tool-bar-add-item "help" 'tool-bar-help
 		   'help nil :help "Pop up the Help menu")
 
 (provide 'tool-bar)