help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How do I "duplicate" a keybinding?


From: Alan Mackenzie
Subject: Re: How do I "duplicate" a keybinding?
Date: Sat, 18 Aug 2007 13:59:52 +0000
User-agent: Mutt/1.5.9i

Hi, Johan!

On Fri, Aug 17, 2007 at 12:37:18PM +0200, Johan Bockgård wrote:
> Alan Mackenzie <acm@muc.de> writes:

> > So I want to use an unused binding C-S-' in place of C-c @, so that I
> > could do the above command with the more convenient

> >     C-S-' C-c

> > .  I know that I could bind C-S-' to hs-minor-mode-map, but this wouldn't
> > be right, since C-S-' would continue to point to this keymap even when
> > hideshow mode was disabled.
> [...]
> > Am I missing something obvious here?

> Yes. The way to make a binding not have an effect when a mode is
> disabled is to bind it in the mode's map! (And you don't want to bind
> C-S-' to hs-minor-mode-map but to the submap that C-c @ is bound to.)

>     ;; C-S-' is C-" (on my keyboard).
>     (define-key hs-minor-mode-map
>       [?\C-\"]
>       (lookup-key hs-minor-mode-map [?\C-c ?@]))

Thank you indeed!  I put this define-key in the mode's hook, and now
everything works as wanted.

What got me confused is that I (subconsciously) thought that typing C-c
@ brought you to hs-minor-mode-map. 

> -- 
> Johan Bockgård

-- 
Alan Mackenzie (Ittersbach, Germany).




reply via email to

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