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

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

Re: command remapping problem


From: Kim F. Storm
Subject: Re: command remapping problem
Date: Wed, 01 Feb 2006 12:02:28 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Drew Adams" <address@hidden> writes:

>     If remapping works for self-insert-command, why can't you use it for
>     other commands?
>
> ... because I cannot pass an OLDMAP arg for command
> remapping. I want to pick up all of the global-map bindings for the
> remapping, but some are shadowed (so, missing) locally, so they are not
> taken into account by remapping. 

That is correct.  There is no way command remapping can handle the OLDMAP
functionality of substitute-key-definition.

In your case with substitute-key-definition and self-insert-command,
did you create the NEWMAP using make-keymap or make-sparse-keymap ?

Does it make a difference to use either of these?

Does any of the following expressions run significantly slower
than others?  What value does the first expression return?

(let ((n 0))
  (map-keymap
    (lambda (char defn)
      (if (eq defn 'self-insert-command)
          (setq n (1+ n))))
    global-map)
  n)

(let ((map (make-keymap)))
  (map-keymap
    (lambda (char defn)
      (when (eq defn 'self-insert-command)
        (define-key map (vector char) defn)))
    global-map)
  map)

(let ((map (make-sparse-keymap)))
  (map-keymap
    (lambda (char defn)
      (when (eq defn 'self-insert-command)
        (define-key map (vector char) defn)))
    global-map)
  map)


-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

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