aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2002-11-07 18:28:09 +0000
committerStefan Monnier2002-11-07 18:28:09 +0000
commit3829bcc589bf84c5b2f7327d8728c4f84840829b (patch)
treed96065fe694c0ca26c7b3958ef1dee29d59e4589
parentcd59ea72b2cfaa0b0610747e956cb7ff6bcb4b78 (diff)
downloademacs-3829bcc589bf84c5b2f7327d8728c4f84840829b.tar.gz
emacs-3829bcc589bf84c5b2f7327d8728c4f84840829b.zip
(where-is): Rename map to defs (a list of syms is not a map).
Test fboundp first, to speed things up. Use push.
-rw-r--r--lisp/help.el36
1 files changed, 16 insertions, 20 deletions
diff --git a/lisp/help.el b/lisp/help.el
index eb54aec958b..4002a0aee16 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -413,30 +413,26 @@ If INSERT (the prefix arg) is non-nil, insert the message in the buffer."
413 (let ((fn (function-called-at-point)) 413 (let ((fn (function-called-at-point))
414 (enable-recursive-minibuffers t) 414 (enable-recursive-minibuffers t)
415 val) 415 val)
416 (setq val (completing-read (if fn 416 (setq val (completing-read
417 (format "Where is command (default %s): " fn) 417 (if fn
418 "Where is command: ") 418 (format "Where is command (default %s): " fn)
419 obarray 'commandp t)) 419 "Where is command: ")
420 (list (if (equal val "") 420 obarray 'commandp t))
421 fn (intern val)) 421 (list (if (equal val "") fn (intern val)) current-prefix-arg)))
422 current-prefix-arg)))
423 (let ((func (indirect-function definition)) 422 (let ((func (indirect-function definition))
424 (map nil) 423 (defs nil)
425 (standard-output (if insert (current-buffer) t))) 424 (standard-output (if insert (current-buffer) t)))
426 (mapatoms #'(lambda (symbol) 425 (mapatoms (lambda (symbol)
427 (when (and (not (eq symbol definition)) 426 (and (fboundp symbol)
428 (fboundp symbol) 427 (not (eq symbol definition))
429 (eq func (indirect-function symbol))) 428 (eq func (indirect-function symbol))
430 (setq map (cons symbol map))))) 429 (push symbol defs))))
431 (princ (mapconcat 430 (princ (mapconcat
432 #'(lambda (symbol) 431 #'(lambda (symbol)
433 (let* ((remapped (remap-command symbol)) 432 (let* ((remapped (remap-command symbol))
434 (keys (mapconcat 'key-description 433 (keys (where-is-internal
435 (where-is-internal symbol 434 symbol overriding-local-map nil nil remapped))
436 overriding-local-map 435 (keys (mapconcat 'key-description keys ", ")))
437 nil nil
438 remapped)
439 ", ")))
440 (if insert 436 (if insert
441 (if (> (length keys) 0) 437 (if (> (length keys) 0)
442 (if remapped 438 (if remapped
@@ -450,7 +446,7 @@ If INSERT (the prefix arg) is non-nil, insert the message in the buffer."
450 definition symbol keys) 446 definition symbol keys)
451 (format "%s is on %s" symbol keys)) 447 (format "%s is on %s" symbol keys))
452 (format "%s is not on any key" symbol))))) 448 (format "%s is not on any key" symbol)))))
453 (cons definition map) 449 (cons definition defs)
454 ";\nand "))) 450 ";\nand ")))
455 nil) 451 nil)
456 452