[Top][All Lists]

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

Re: Looking up key myself

From: Stefan Monnier
Subject: Re: Looking up key myself
Date: Tue, 11 Apr 2006 10:18:40 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>> When writing my first minor mode, I was told that if I want commands
>> in this minor mode able to call commands bound to the same key while
>> this minor mode is not activated, I should lookup key myself.  Following
>> (info "(elisp)Searching Keymaps"), I write

> <snip>

> I suggest using minor-mode-overriding-map-alist:

> (let ((minor-mode-overriding-map-alist
>        `((my-mode . ,(make-sparse-keymap)))))
>   (key-binding "a"))

You'll probably want to keep other entries on
minor-mode-overriding-map-alist, just in case:

   (let ((minor-mode-overriding-map-alist
          (cons `(my-mode . ,(make-sparse-keymap))
     (key-binding "a"))

> It's much simpler than rewriting key-binding.

Another way to do it is

  (let ((my-mode nil))
    (key-binding "a"))

-- Stefan

reply via email to

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