From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: expand/collapse{} in c++ Date: Fri, 26 Aug 2005 16:39:38 -0600 Message-ID: References: <87y86s2zl5.fsf@wash.edu> <87fyswfniv.fsf@wash.edu> <7quhddcicjz.fsf@1078-ARIBA-004.central.purdue.lcl> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1125097941 5072 80.91.229.2 (26 Aug 2005 23:12:21 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 26 Aug 2005 23:12:21 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 27 01:12:13 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E8nM6-0000fj-Su for geh-help-gnu-emacs@m.gmane.org; Sat, 27 Aug 2005 01:11:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E8nQ3-0004LJ-2X for geh-help-gnu-emacs@m.gmane.org; Fri, 26 Aug 2005 19:15:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E8nOn-0003hv-Uz for help-gnu-emacs@gnu.org; Fri, 26 Aug 2005 19:14:14 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E8nOk-0003gJ-MV for help-gnu-emacs@gnu.org; Fri, 26 Aug 2005 19:14:11 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E8nMY-0002G8-Qq for help-gnu-emacs@gnu.org; Fri, 26 Aug 2005 19:11:55 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1E8muw-00068S-FA for help-gnu-emacs@gnu.org; Fri, 26 Aug 2005 18:43:22 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1E8mrg-00014q-SL for help-gnu-emacs@gnu.org; Sat, 27 Aug 2005 00:40:00 +0200 Original-Received: from 207.167.42.60 ([207.167.42.60]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 27 Aug 2005 00:40:00 +0200 Original-Received: from ihs_4664 by 207.167.42.60 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 27 Aug 2005 00:40:00 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 37 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207.167.42.60 User-Agent: Mozilla Thunderbird 0.9 (X11/20041105) X-Accept-Language: en-us, en In-Reply-To: <7quhddcicjz.fsf@1078-ARIBA-004.central.purdue.lcl> 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:29023 Archived-At: Jason Dufair wrote: > Baloff writes: >>in a .emacs-c++ file to be loaded from inside .emacs, I have >>(local-set-key [f4] "\C-c @ \C-c") ;toggles block hide/show >> >>restart emacs, when I open .cpp file, f4 does nothing. > > First, the 2nd argument to 'local-set-key should be a function > definition, not another set of key bindings. Use C-h k to see what > function "C-c@C-c" calls and use that function name as your second > argument. The 2nd argument must be a command, which can be an interactive function or a keyboard macro, or a symbol with such a function binding -- see the "What is a Function?" and "Command [Loop] Overview" sections of the Emacs Lisp manual. The proper representation of the key sequence `C-c a C-c' as a keyboard macro is any of: "\C-c@\C-a" ; no spaces! [?\C-c ?@ ?\C-a] [(control ?c) ?@ (control ?a)] (kbd "C-c @ C-a") (see the "Init Rebinding" node of the Emacs manual and the "Changing Key Bindings" node of the Emacs Lisp manual) > Also, local-set-key only works on the current local keymap. If you only > want that binding available in c++-mode, you probably have set the > binding in the mode hook That's what I recommend, but some people prefer to use define-key and specify the keymap by name: (define-key c++-mode-map [f4] (kbd "C-c @ C-a")) -- Kevin Rodgers