all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How do I "duplicate" a keybinding?
@ 2007-08-17  9:35 Alan Mackenzie
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Mackenzie @ 2007-08-17  9:35 UTC (permalink / raw)
  To: help-gnu-emacs

I would like to "duplicate" a key-binding.  By this I mean I want to make
a new binding do the same thing as an existing one.

In particular, I find the commands in hideshow minor mode, such as

    C-c @ C-c (hs-toggle-hiding)

too cumbersome to type; each keystroke requires a modifier different
from the previous one - <ctrl>, <shift>, <ctrl>.

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.

I could write a command starting like this:

    (defun C-c@ ()
      (interactive)
      (let ((kmap (key-binding "\C-c@")))
        (if key-binding
	    ....

where I then proceed to read further keystrokes until I get a complete
key sequence.  But do I really have to go through all this?

I've tried to find something useful in the chapter "Keymaps" in the Elisp
manual, but didn't find anything.  Am I missing something obvious here?

-- 
Alan Mackenzie (Ittersbach, Germany).

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-18 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.4899.1187343204.32220.help-gnu-emacs@gnu.org>
2007-08-17 10:37 ` How do I "duplicate" a keybinding? Johan Bockgård
2007-08-18 13:59   ` Alan Mackenzie
2007-08-17  9:35 Alan Mackenzie

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.