emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (describe-function 'self-insert-command) takes too long


From: Richard Stallman
Subject: Re: (describe-function 'self-insert-command) takes too long
Date: Sun, 15 Oct 2006 14:19:55 -0400

There is no clean way to find out that a command has a lot of bindings
other than to find them all.  We could add one, but it would be more
trouble than it is worth.

It is easy to add a special-case check for self-insert-command.
How about this?

*** help-fns.el 11 Jul 2006 12:29:57 -0400      1.90
--- help-fns.el 15 Oct 2006 14:13:08 -0400      
***************
*** 383,417 ****
      (princ ".")
      (terpri)
      (when (commandp function)
!       (let* ((remapped (command-remapping function))
!            (keys (where-is-internal
!                   (or remapped function) overriding-local-map nil nil))
!            non-modified-keys)
!       ;; Which non-control non-meta keys run this command?
!       (dolist (key keys)
!         (if (member (event-modifiers (aref key 0)) '(nil (shift)))
!             (push key non-modified-keys)))
!       (when remapped
!         (princ "It is remapped to `")
!         (princ (symbol-name remapped))
!         (princ "'"))
! 
!       (when keys
!         (princ (if remapped " which is bound to " "It is bound to "))
!         ;; FIXME: This list can be very long (f.ex. for self-insert-command).
!         ;; If there are many, remove them from KEYS.
!         (if (< (length non-modified-keys) 10)
!             (princ (mapconcat 'key-description keys ", "))
!           (dolist (key non-modified-keys)
!             (setq keys (delq key keys)))
!           (if keys
!               (progn
!                 (princ (mapconcat 'key-description keys ", "))
!                 (princ ", and many ordinary text characters"))
!             (princ "many ordinary text characters"))))
!       (when (or remapped keys non-modified-keys)
!         (princ ".")
!         (terpri))))
      (let* ((arglist (help-function-arglist def))
           (doc (documentation function))
           (usage (help-split-fundoc doc function)))
--- 383,419 ----
      (princ ".")
      (terpri)
      (when (commandp function)
!       (if (eq function 'self-insert-command)
!         (princ "It is bound to many ordinary text characters.\n")
!       (let* ((remapped (command-remapping function))
!              (keys (where-is-internal
!                     (or remapped function) overriding-local-map nil nil))
!              non-modified-keys)
!         ;; Which non-control non-meta keys run this command?
!         (dolist (key keys)
!           (if (member (event-modifiers (aref key 0)) '(nil (shift)))
!               (push key non-modified-keys)))
!         (when remapped
!           (princ "It is remapped to `")
!           (princ (symbol-name remapped))
!           (princ "'"))
! 
!         (when keys
!           (princ (if remapped " which is bound to " "It is bound to "))
!           ;; If lots of ordinary text characters run this command,
!           ;; don't mention them one by one.
!           (if (< (length non-modified-keys) 10)
!               (princ (mapconcat 'key-description keys ", "))
!             (dolist (key non-modified-keys)
!               (setq keys (delq key keys)))
!             (if keys
!                 (progn
!                   (princ (mapconcat 'key-description keys ", "))
!                   (princ ", and many ordinary text characters"))
!               (princ "many ordinary text characters"))))
!         (when (or remapped keys non-modified-keys)
!           (princ ".")
!           (terpri)))))
      (let* ((arglist (help-function-arglist def))
           (doc (documentation function))
           (usage (help-split-fundoc doc function)))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]