From cd3b81be39042964eca4f36f334ab28168f1588e Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Tue, 26 Sep 2000 09:35:27 +0000 Subject: [PATCH] (tool-bar-help): New function. --- lisp/ChangeLog | 4 ++++ lisp/toolbar/tool-bar.el | 22 ++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 024ec655a6b..296a36e45b3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2000-09-26 Gerd Moellmann + + * toolbar/tool-bar.el (tool-bar-help): New function. + 2000-09-25 Gerd Moellmann * bytecomp.el (byte-compile-defvar-or-defconst): Only cons onto diff --git a/lisp/toolbar/tool-bar.el b/lisp/toolbar/tool-bar.el index ff5028a164d..9bb60e20829 100644 --- a/lisp/toolbar/tool-bar.el +++ b/lisp/toolbar/tool-bar.el @@ -151,12 +151,22 @@ PROPS is a list of additional properties to add to the binding." (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) -- 2.39.2