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: Re: How do I "duplicate" a keybinding? Date: Sat, 18 Aug 2007 13:59:52 +0000 Message-ID: <20070818135952.GA5868@muc.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1187445492 19992 80.91.229.12 (18 Aug 2007 13:58:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 18 Aug 2007 13:58:12 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Johan =?iso-8859-1?Q?Bockg=E5rd?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 18 15:58:10 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 1IMOoa-0002IN-Qh for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Aug 2007 15:58:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IMOoa-0005kl-NZ for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Aug 2007 09:58:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IMOoJ-0005iB-36 for help-gnu-emacs@gnu.org; Sat, 18 Aug 2007 09:57:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IMOoI-0005gp-2m for help-gnu-emacs@gnu.org; Sat, 18 Aug 2007 09:57:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IMOoH-0005ge-Sm for help-gnu-emacs@gnu.org; Sat, 18 Aug 2007 09:57:49 -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 1IMOoH-0001tL-1a for help-gnu-emacs@gnu.org; Sat, 18 Aug 2007 09:57:49 -0400 Original-Received: (qmail 22684 invoked by uid 3782); 18 Aug 2007 13:57:43 -0000 Original-Received: from acm.muc.de (p57B1FB6F.dip.t-dialin.net [87.177.251.111]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Sat, 18 Aug 2007 15:57:40 +0200 Original-Received: (qmail 7104 invoked by uid 1000); 18 Aug 2007 13:59:52 -0000 Content-Disposition: inline In-Reply-To: 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:46678 Archived-At: Hi, Johan! On Fri, Aug 17, 2007 at 12:37:18PM +0200, Johan Bockgård wrote: > Alan Mackenzie 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).