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: Wed, 1 Feb 2006 07:52:46 -0800

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

I didn't create any NEWMAP. Here is the code:

  (if (boundp 'this-original-command)
      (define-key map [remap self-insert-command] 'my-self-insert)
    (substitute-key-definition 'self-insert-command 'my-self-insert
                               map global-map))

I do this for MAP = minibuffer-local-completion-map,
minibuffer-local-filename-completion-map, and
minibuffer-local-must-match-map.

    Does any of the following expressions run significantly slower
    than others?

I don't notice any difference in speed. Perhaps the third was a bit slower.
They all seem to return immediately (no delay), however.

I used elp on them, and got this (f1 is the first, f2, the second). This
confirms my impression that f3 was slower.

Function Name  Call Count  Elapsed Time  Average Time
=============  ==========  ============  ============
f3             1           0.16          0.16
f1             1           0.01          0.01
f2             1           0.01          0.01

    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)

4741

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

(keymap #^[t nil nil nil nil ...])

    (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)

(keymap (507648 . self-insert-command) (507520 . self-insert-command)...)







reply via email to

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