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: Johan Bockgård
Subject: Re: How do I "duplicate" a keybinding?
Date: Fri, 17 Aug 2007 12:37:18 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

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 ?@]))

-- 
Johan Bockgård


reply via email to

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