[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: where-is-internal question
From: |
Kim F. Storm |
Subject: |
Re: where-is-internal question |
Date: |
Wed, 07 Sep 2005 10:37:10 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
"Drew Adams" <address@hidden> writes:
> In previous Emacs versions, I could do this, to bind stuff that
> is bound to self-insert-command in the global map:
>
> (dolist (key (where-is-internal 'self-insert-command global-map))
> (define-key my-map key 'my-command))
>
> Now, however, it looks like I need to do something like the
> following.
> (dolist (key (or (condition-case nil
> (where-is-internal 'self-insert-command
> global-map nil nil t)
> (wrong-number-of-arguments nil))
> (where-is-internal 'self-insert-command
> global-map)))
> (define-key my-map key 'my-command))
>
> I forgot to mention that, whereas the above code is lightning-quick in Emacs
> 20 (without the 5th arg), in Emacs 22 it takes about 5 _seconds_ (on a
> pretty fast machine). Why so slow?
IIRC, the problem probably is that with command remapping,
where-is-internal in 22.x has to lookup the key binding for each
command to see if it remapped -- in the normal case (where a command
only has a few bindings), the penalty is neglible, but for
self-insert-command specifically, that will be time consuming.
The problem is that where-is-internal must return proper bindings for
commands that are remapped to, so there really don't see to be an easy
way to speed things up.
--
Kim F. Storm <address@hidden> http://www.cua.dk