[Top][All Lists]

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

Re: Function for deleting a key binding in a sparse keymap

From: Lennart Borgman
Subject: Re: Function for deleting a key binding in a sparse keymap
Date: Thu, 08 Dec 2005 16:03:06 +0100
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

Kim F. Storm wrote:

LENNART BORGMAN <address@hidden> writes:

Why do you use emulation-mode-map-alist ?
Because in this case it is a temporary minor mode that exists just
during a few keystrokes. I actually put the keymap first in
emulation-mode-map-alists to avoid any problem. Nearly all keys
except those for using the mode are bound to a function that exits
the temporary mode.

That is NOT the purpose of emulation-mode-map-alists, and there must
be other ways to accomplish what you want to do.  E.g. (not tested):

 (let (done)
  (while (not done)
    (let* ((ev (read-event))
           (cmd (lookup-key your-keymap ev)))
      (if cmd
          (call-interactively cmd)  ; or just funcall
        (setq done t)
         (clear-this-command-keys t)
        (setq unread-command-events (cons ev unread-command-events)))))

It seems more complicated to me, but I might be wrong just because I did not think of doing it this way.

I am temporary using the emulation-mode-map-alists just for the purpose of putting my keymap first among the keymaps. This was not the reason for which emulation-mode-map-alist was invented, but it works for this purpose too I believe. I restore emulation-mode-map-alists when the temporary mode is exited.

The temporary mode is a mode for resizing windows interactively (see http://ourcomments.org/Emacs/DL/elisp/bw-interactive.el). The user will do a few keystroke in this mode and then exit it. No keyboard commands except those for the mode are allowed. In post-command-hook I also do some checks to see if I should exit the temporary mode. (Maybe I should do more.)

I am trying to understand what you are saying. Can you please explain what problems you see with what I am doing? I do not think that what I am doing here can possibly disturb the normal use of emulation-mode-map-alists, or can it? If it was not just before the release I might propose a new variable holding a temporary keymap like in my case, but this is not the time for it. Maybe what I am doing is unnecessary complicated?

reply via email to

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