changeset 68793:71c7af923901

(describe-key-briefly): Now a wrapper for describe-key-briefly-internal. Bind enable-disabled-menus-and-buttons to t. (describe-key-briefly-internal): Renamed from describe-key-briefly. (describe-key): Now a wrapper for describe-key-internal. Bind enable-disabled-menus-and-buttons to t. (describe-key-internal): Renamed from describe-key.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 11 Feb 2006 13:55:42 +0000
parents 041aa462ad58
children eb282d2484e6
files lisp/help.el
diffstat 1 files changed, 40 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/help.el	Sat Feb 11 13:50:29 2006 +0000
+++ b/lisp/help.el	Sat Feb 11 13:55:42 2006 +0000
@@ -556,7 +556,23 @@
 	    string
 	  (format "%s (translated from %s)" string otherstring))))))
 
-(defun describe-key-briefly (key &optional insert untranslated)
+(defun describe-key-briefly (&optional key insert untranslated)
+  "Print the name of the function KEY invokes.  KEY is a string.
+If INSERT (the prefix arg) is non-nil, insert the message in the buffer.
+If non-nil, UNTRANSLATED is a vector of the untranslated events.
+It can also be a number in which case the untranslated events from
+the last key hit are used.
+
+If KEY is a menu item or a tool-bar button that is disabled, this command
+temporarily enables it to allow clicking on disabled items and buttons."
+  (interactive)
+  (let ((enable-disabled-menus-and-buttons t))
+    (if key
+	;; Non-interactive invocation
+	(describe-key-briefly-internal key insert untranslated)
+      (call-interactively 'describe-key-briefly-internal))))
+
+(defun describe-key-briefly-internal (key &optional insert untranslated)
   "Print the name of the function KEY invokes.  KEY is a string.
 If INSERT (the prefix arg) is non-nil, insert the message in the buffer.
 If non-nil UNTRANSLATED is a vector of the untranslated events.
@@ -601,7 +617,7 @@
 			 key-desc
 			 (if (symbolp defn) defn (prin1-to-string defn)))))))))
 
-(defun describe-key (key &optional untranslated up-event)
+(defun describe-key (&optional key untranslated up-event)
   "Display documentation of the function invoked by KEY.
 KEY can be any kind of a key sequence; it can include keyboard events,
 mouse events, and/or menu events.  When calling from a program,
@@ -609,8 +625,28 @@
 
 If non-nil, UNTRANSLATED is a vector of the corresponding untranslated events.
 It can also be a number, in which case the untranslated events from
-the last key sequence entered are used."
-  ;; UP-EVENT is the up-event that was discarded by reading KEY, or nil.
+the last key sequence entered are used.
+UP-EVENT is the up-event that was discarded by reading KEY, or nil.
+
+If KEY is a menu item or a tool-bar button that is disabled, this command
+temporarily enables it to allow clicking on disabled items and buttons."
+  (interactive)
+  (let ((enable-disabled-menus-and-buttons t))
+    (if key
+	;; Non-interactive invocation
+	(describe-key-internal key untranslated up-event)
+      (call-interactively 'describe-key-internal))))
+
+(defun describe-key-internal (key &optional untranslated up-event)
+  "Display documentation of the function invoked by KEY.
+KEY can be any kind of a key sequence; it can include keyboard events,
+mouse events, and/or menu events.  When calling from a program,
+pass KEY as a string or a vector.
+
+If non-nil, UNTRANSLATED is a vector of the corresponding untranslated events.
+It can also be a number, in which case the untranslated events from
+the last key sequence entered are used.
+UP-EVENT is the up-event that was discarded by reading KEY, or nil."
   (interactive "kDescribe key (or click or menu item): \np\nU")
   (if (numberp untranslated)
       (setq untranslated (this-single-command-raw-keys)))