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

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

RE: command remapping problem


From: Drew Adams
Subject: RE: command remapping problem
Date: Mon, 23 Jan 2006 10:11:43 -0800

BTW, in my particular application, I get around the problem (workaround) by
using `define-key' with remapping only for `self-insert-command' and
`substitute-key-definition' (with `global-map' as OLDMAP) for everything
else.

However, there should be some general solution to this, IMO. Also, if
`self-insert-command' happened to be defined in a minibuffer local map, then
I would not be able to use this workaround: `define-key' with remapping does
not let you specify any OLDMAP argument, so there would be no way (IIUC) to
pick up the global bindings.


    -----Original Message-----

    1. (substitute-key-definition from to map global-map) is too slow in
       Emacs 22, at least when `from' is `self-insert-command'. It takes
       several seconds on a fast machine. In previous versions of Emacs it
       is instantaneous.

    2. More importantly, (define-key map `[remap ,from] to) is an
       inadequate substitute for `substitute-key-definition'.  It
       apparently does not map all bindings of `from' to `to', or perhaps
       it is simply the case that it cannot accomodate the functionality
       of `substitute-key-definition's OLDMAP parameter.

    3. Example: emacs -q

    (define-key my-map [remap scroll-up] my-scroll-up)

    The `scroll-up' binding for `C-v' is remapped to `my-scroll-up', but
    the `scroll-up' binding for [next] is not remapped to `my-scroll-up'.

    Similarly, (define-key my-map [remap help-command] my-help-command)
    does not remap `C-h' to `my-help-command'.

    My tests were done with map = `minibuffer-local-completion-map', but
    probably the same problem exists for other maps. In
    `minibuffer-local-completion-map', I want to substitute (remap,
    whatever) all key sequences that are bound in `global-map' to certain
    commands, to other commands, for use in minibuffer completion. Using
    `global-map' as the OLDMAP parameter of `substitute-key-definition'
    works perfectly for this (modulo performance); command remapping does
    not.

    I'm guessing that the problem is that `define-key' works only with the
    bindings that are accessible from its MAP arg, not `global-map'
    bindings - for example, [next] is not bound to `scroll-up' in
    `minibuffer-local-map', so it is not remapped.

    If this is the explanation, and this is not simply a bug, then I guess
    that would mean that there is no way to get the behavior of
    `substitute-key-definition's OLDMAP argument.  In that case, we have
    lost functionality in going to Emacs 22, because
    `substitute-key-definition' is unusable (at least with
    `self-insert-command'), for performance reasons.

    See also emacs-devel thread "Question on remapping keys" from
    2006-01-19 to 20.



    In GNU Emacs 22.0.50.1 (i386-mingw-nt5.1.2600)
     of 2005-06-26 on NONIQPC
    X server distributor `Microsoft Corp.', version 5.1.2600
    configured using `configure --with-gcc (3.3) --cflags
    -I../../jpeg-6b-3/include -I../../libpng-1.2.8/include
    -I../../tiff-3.6.1-2/include -I../../xpm-nox-4.2.0/include
    -I../../zlib-1.2.2/include'





reply via email to

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