"Drew Adams" <[EMAIL PROTECTED]> writes: > I haven't looked into this in detail - forgive my incomplete understanding. > I'm looking for help on where-is-internal - as regards command remapping (I > guess). > > 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))
What's wrong with (if (boundp 'this-original-command) (define-key my-map [remap self-insert-command] 'my-command) (dolist (key (where-is-internal 'self-insert-command global-map)) (define-key my-map key 'my-command))) Since you are (probably) going to use my-map as a local map, it will be searched before other maps which may also have remapped self-insert-command so your mapping will take precedence. > > Now, however, it looks like I need to do something like the following. Let > me know if I'm missing something, and there is a simpler way. > > (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))) ; use > old version > (define-key my-map key 'my-command)) > > IIUC (probably not), the 5th arg to where-is-internal is needed here, > because of some remapping done to self-insert-command (?). The NEWS file > says this, for Emacs 22.1: > > `where-is-internal' now returns nil for a remapped command (e.g. > `kill-line', when `my-mode' is enabled), and the actual key binding for > the command it is remapped to (e.g. C-k for my-kill-line). Since kill-line is remapped to some other command, kill-line is not on any keys, and so where-is-internal (in its default form) should return nil (IMO). > In ignorance, I'm thinking that the new 5th arg should be defined the other > way 'round: nil should do what t does now, to give better backward > compatibility. That way (I think), I would be able to do just > (where-is-internal 'self-insert-command global-map) in all Emacs versions. I don't mind such a change (where-is-internal is a low-level function after all), but I strongly doubt you should be using it like you do in the first place -- although I cannot tell you what to use instead :-). -- Kim F. Storm <[EMAIL PROTECTED]> http://www.cua.dk _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel