diff options
| author | Richard M. Stallman | 2006-10-16 14:57:01 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2006-10-16 14:57:01 +0000 |
| commit | ddbb1956a7a5dc87fc4c66857bdb14f6eb929a43 (patch) | |
| tree | e54033aea3d1dae9f8ee6677c83090acb92dacc9 | |
| parent | 784f5416cf4065b78e263407f08aec509385fbca (diff) | |
| download | emacs-ddbb1956a7a5dc87fc4c66857bdb14f6eb929a43.tar.gz emacs-ddbb1956a7a5dc87fc4c66857bdb14f6eb929a43.zip | |
(describe-function-1): Special case optimization for self-insert-command.
| -rw-r--r-- | lisp/help-fns.el | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 53e280fd1a7..cddfa3611ed 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -383,35 +383,40 @@ face (according to `face-differs-from-default-p')." | |||
| 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))) |