diff options
| author | Richard M. Stallman | 1994-03-23 04:54:20 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-03-23 04:54:20 +0000 |
| commit | 54c0b967c32301ded44820b25dede7ead4cd462f (patch) | |
| tree | 946b2a6034b3ff154c8ee8ca83a04dbbd8f0afa0 | |
| parent | c25f25a2186c10ca1e2162faf02d1419bc7c0dc2 (diff) | |
| download | emacs-54c0b967c32301ded44820b25dede7ead4cd462f.tar.gz emacs-54c0b967c32301ded44820b25dede7ead4cd462f.zip | |
(where-is): New function.
| -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." | |||
| 421 | ;; Return the text we displayed. | 421 | ;; Return the text we displayed. |
| 422 | (save-excursion (set-buffer standard-output) (buffer-string)))) | 422 | (save-excursion (set-buffer standard-output) (buffer-string)))) |
| 423 | 423 | ||
| 424 | (defun where-is (definition) | ||
| 425 | "Print message listing key sequences that invoke specified command. | ||
| 426 | Argument is a command definition, usually a symbol with a function definition." | ||
| 427 | (interactive | ||
| 428 | (let ((fn (function-called-at-point)) | ||
| 429 | (enable-recursive-minibuffers t) | ||
| 430 | val) | ||
| 431 | (setq val (completing-read (if fn | ||
| 432 | (format "Where is command (default %s): " fn) | ||
| 433 | "Where is command: ") | ||
| 434 | obarray 'fboundp t)) | ||
| 435 | (list (if (equal val "") | ||
| 436 | fn (intern val))))) | ||
| 437 | (let* ((keys (where-is-internal definition overriding-local-map nil nil)) | ||
| 438 | (keys1 (mapconcat 'key-description keys ", "))) | ||
| 439 | (if (> (length keys1) 0) | ||
| 440 | (message "%s is on %s" definition keys1) | ||
| 441 | (message "%s is not on any key" definition))) | ||
| 442 | nil) | ||
| 443 | |||
| 424 | (defun command-apropos (string) | 444 | (defun command-apropos (string) |
| 425 | "Like apropos but lists only symbols that are names of commands | 445 | "Like apropos but lists only symbols that are names of commands |
| 426 | \(interactively callable functions). Argument REGEXP is a regular expression | 446 | \(interactively callable functions). Argument REGEXP is a regular expression |