diff options
author | Richard M. Stallman <rms@gnu.org> | 1994-03-23 04:54:20 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1994-03-23 04:54:20 +0000 |
commit | faa408b1d3b2215fdb4b23ceb1764e1800e4c334 (patch) | |
tree | e50ff2d6e9ccb8aadec60b699a500a8c56abd86a /lisp/help.el | |
parent | c5b749553649b7311948f459fe4bad73acc0b835 (diff) | |
download | emacs-faa408b1d3b2215fdb4b23ceb1764e1800e4c334.tar.gz |
(where-is): New function.
Diffstat (limited to 'lisp/help.el')
-rw-r--r-- | lisp/help.el | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lisp/help.el b/lisp/help.el index 325ac7b4787..acecb29bc07 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -421,6 +421,26 @@ Returns the documentation as a string, also." ;; Return the text we displayed. (save-excursion (set-buffer standard-output) (buffer-string)))) +(defun where-is (definition) + "Print message listing key sequences that invoke specified command. +Argument is a command definition, usually a symbol with a function definition." + (interactive + (let ((fn (function-called-at-point)) + (enable-recursive-minibuffers t) + val) + (setq val (completing-read (if fn + (format "Where is command (default %s): " fn) + "Where is command: ") + obarray 'fboundp t)) + (list (if (equal val "") + fn (intern val))))) + (let* ((keys (where-is-internal definition overriding-local-map nil nil)) + (keys1 (mapconcat 'key-description keys ", "))) + (if (> (length keys1) 0) + (message "%s is on %s" definition keys1) + (message "%s is not on any key" definition))) + nil) + (defun command-apropos (string) "Like apropos but lists only symbols that are names of commands \(interactively callable functions). Argument REGEXP is a regular expression |