]> git.eshelyaron.com Git - emacs.git/commitdiff
(describe-key-briefly, describe-key): Populate yank-menu if empty.
authorEli Zaretskii <eliz@gnu.org>
Sat, 11 Feb 2006 16:03:14 +0000 (16:03 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 11 Feb 2006 16:03:14 +0000 (16:03 +0000)
lisp/ChangeLog
lisp/help.el

index 0c176e43356e69c917be1492aaafe1c92f560fac..9faa1ab01d8a536c8d10391ece3bed1d79e018e5 100644 (file)
@@ -2,10 +2,10 @@
 
        * help.el (describe-key-briefly): Now a wrapper for
        describe-key-briefly-internal.  Bind enable-disabled-menus-and-buttons
-       to t.
+       to t.  Populate yank-menu if empty.
        (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.
+       enable-disabled-menus-and-buttons to t.  Populate yank-menu if empty.
        (describe-key-internal): Renamed from describe-key.
 
 2006-02-11  Milan Zamazal  <pdm@zamazal.org>
index b010722bec0cafc8c8c42e8c383fdefe0442eef0..bea404f51124ecdefc6e98ebdc25cf8d89c6666e 100644 (file)
@@ -564,13 +564,24 @@ 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."
+temporarily enables it to allow getting help on disabled items and buttons."
   (interactive)
-  (let ((enable-disabled-menus-and-buttons t))
+  (let ((enable-disabled-menus-and-buttons t)
+       (save-yank-menu))
     (if key
        ;; Non-interactive invocation
        (describe-key-briefly-internal key insert untranslated)
-      (call-interactively 'describe-key-briefly-internal))))
+      ;; If yank-menu is empty, populate it temporarily, so that
+      ;; "Select and Paste" menu can generate a complete event
+      (if (null (cdr yank-menu))
+         (unwind-protect
+             (progn
+               (setq save-yank-menu (copy-sequence yank-menu))
+               (menu-bar-update-yank-menu "(any string)" nil)
+               (call-interactively 'describe-key-briefly-internal))
+           (progn (setq yank-menu (copy-sequence save-yank-menu))
+                  (fset 'yank-menu (cons 'keymap yank-menu))))
+       (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.
@@ -629,13 +640,24 @@ 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."
+temporarily enables it to allow getting help on disabled items and buttons."
   (interactive)
-  (let ((enable-disabled-menus-and-buttons t))
+  (let ((enable-disabled-menus-and-buttons t)
+       (save-yank-menu))
     (if key
        ;; Non-interactive invocation
        (describe-key-internal key untranslated up-event)
-      (call-interactively 'describe-key-internal))))
+      ;; If yank-menu is empty, populate it temporarily, so that
+      ;; "Select and Paste" menu can generate a complete event
+      (if (null (cdr yank-menu))
+         (unwind-protect
+             (progn
+               (setq save-yank-menu (copy-sequence yank-menu))
+               (menu-bar-update-yank-menu "(any string)" nil)
+               (call-interactively 'describe-key-internal))
+           (progn (setq yank-menu (copy-sequence save-yank-menu))
+                  (fset 'yank-menu (cons 'keymap yank-menu))))
+       (call-interactively 'describe-key-internal)))))
 
 (defun describe-key-internal (key &optional untranslated up-event)
   "Display documentation of the function invoked by KEY.