Mercurial > emacs
comparison lisp/help-fns.el @ 73391:d636f1f6f544
(describe-function-1): Special case optimization for self-insert-command.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 16 Oct 2006 14:57:01 +0000 |
parents | 2227a7e3b7eb |
children | 6deaec97f21b 58cf725f5330 7eeafaaa9eab |
comparison
equal
deleted
inserted
replaced
73390:3289ed0d2f0c | 73391:d636f1f6f544 |
---|---|
381 (re-search-backward "`\\([^`']+\\)'" nil t) | 381 (re-search-backward "`\\([^`']+\\)'" nil t) |
382 (help-xref-button 1 'help-function-def function file-name)))) | 382 (help-xref-button 1 'help-function-def function file-name)))) |
383 (princ ".") | 383 (princ ".") |
384 (terpri) | 384 (terpri) |
385 (when (commandp function) | 385 (when (commandp function) |
386 (let* ((remapped (command-remapping function)) | 386 (if (and (eq function 'self-insert-command) |
387 (keys (where-is-internal | 387 (eq (key-binding "a") 'self-insert-command) |
388 (or remapped function) overriding-local-map nil nil)) | 388 (eq (key-binding "b") 'self-insert-command) |
389 non-modified-keys) | 389 (eq (key-binding "c") 'self-insert-command)) |
390 ;; Which non-control non-meta keys run this command? | 390 (princ "It is bound to many ordinary text characters.\n") |
391 (dolist (key keys) | 391 (let* ((remapped (command-remapping function)) |
392 (if (member (event-modifiers (aref key 0)) '(nil (shift))) | 392 (keys (where-is-internal |
393 (push key non-modified-keys))) | 393 (or remapped function) overriding-local-map nil nil)) |
394 (when remapped | 394 non-modified-keys) |
395 (princ "It is remapped to `") | 395 ;; Which non-control non-meta keys run this command? |
396 (princ (symbol-name remapped)) | 396 (dolist (key keys) |
397 (princ "'")) | 397 (if (member (event-modifiers (aref key 0)) '(nil (shift))) |
398 | 398 (push key non-modified-keys))) |
399 (when keys | 399 (when remapped |
400 (princ (if remapped " which is bound to " "It is bound to ")) | 400 (princ "It is remapped to `") |
401 ;; FIXME: This list can be very long (f.ex. for self-insert-command). | 401 (princ (symbol-name remapped)) |
402 ;; If there are many, remove them from KEYS. | 402 (princ "'")) |
403 (if (< (length non-modified-keys) 10) | 403 |
404 (princ (mapconcat 'key-description keys ", ")) | 404 (when keys |
405 (dolist (key non-modified-keys) | 405 (princ (if remapped " which is bound to " "It is bound to ")) |
406 (setq keys (delq key keys))) | 406 ;; If lots of ordinary text characters run this command, |
407 (if keys | 407 ;; don't mention them one by one. |
408 (progn | 408 (if (< (length non-modified-keys) 10) |
409 (princ (mapconcat 'key-description keys ", ")) | 409 (princ (mapconcat 'key-description keys ", ")) |
410 (princ ", and many ordinary text characters")) | 410 (dolist (key non-modified-keys) |
411 (princ "many ordinary text characters")))) | 411 (setq keys (delq key keys))) |
412 (when (or remapped keys non-modified-keys) | 412 (if keys |
413 (princ ".") | 413 (progn |
414 (terpri)))) | 414 (princ (mapconcat 'key-description keys ", ")) |
415 (princ ", and many ordinary text characters")) | |
416 (princ "many ordinary text characters")))) | |
417 (when (or remapped keys non-modified-keys) | |
418 (princ ".") | |
419 (terpri))))) | |
415 (let* ((arglist (help-function-arglist def)) | 420 (let* ((arglist (help-function-arglist def)) |
416 (doc (documentation function)) | 421 (doc (documentation function)) |
417 (usage (help-split-fundoc doc function))) | 422 (usage (help-split-fundoc doc function))) |
418 (with-current-buffer standard-output | 423 (with-current-buffer standard-output |
419 ;; If definition is a keymap, skip arglist note. | 424 ;; If definition is a keymap, skip arglist note. |