From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: How do I "duplicate" a keybinding? Date: Fri, 17 Aug 2007 09:35:13 +0000 Message-ID: <20070817093513.GA2247@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1187343420 7490 80.91.229.12 (17 Aug 2007 09:37:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 17 Aug 2007 09:37:00 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 17 11:36:59 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1ILyGI-00044n-TX for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Aug 2007 11:36:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ILyGH-0002o7-Dv for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Aug 2007 05:36:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ILyCp-0002EK-2v for help-gnu-emacs@gnu.org; Fri, 17 Aug 2007 05:33:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ILyCm-0002Dw-Nq for help-gnu-emacs@gnu.org; Fri, 17 Aug 2007 05:33:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ILyCm-0002Dr-1E for help-gnu-emacs@gnu.org; Fri, 17 Aug 2007 05:33:20 -0400 Original-Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ILyCl-0008DG-1M for help-gnu-emacs@gnu.org; Fri, 17 Aug 2007 05:33:19 -0400 Original-Received: (qmail 21252 invoked by uid 3782); 17 Aug 2007 09:33:13 -0000 Original-Received: from acm.muc.de (p57B1D387.dip.t-dialin.net [87.177.211.135]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Fri, 17 Aug 2007 11:33:10 +0200 Original-Received: (qmail 2791 invoked by uid 1000); 17 Aug 2007 09:35:13 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-Detected-Kernel: FreeBSD 4.6-4.9 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:46628 Archived-At: 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 - , , . 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).