comparison lisp/help.el @ 6476:2e28b96d5b64

(where-is): New function.
author Richard M. Stallman <rms@gnu.org>
date Wed, 23 Mar 1994 04:54:20 +0000
parents e50519261181
children 4c20c6b1d2c2
comparison
equal deleted inserted replaced
6475:e7db7f9c1fb4 6476:2e28b96d5b64
419 (princ "not documented as a variable."))) 419 (princ "not documented as a variable.")))
420 (print-help-return-message) 420 (print-help-return-message)
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
427 that is matched against command symbol names. Returns list of symbols and 447 that is matched against command symbol names. Returns list of symbols and
428 documentation found." 448 documentation found."