From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Baloff Newsgroups: gmane.emacs.help Subject: Re: expand/collapse{} in c++ Date: 27 Aug 2005 18:31:31 +1000 Organization: iPrimus Customer - reports relating to abuse should be sent to abuse@iprimus.com.au Message-ID: <8764trg4rg.fsf@wash.edu> 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=us-ascii X-Trace: sea.gmane.org 1125131158 725 80.91.229.2 (27 Aug 2005 08:25:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 27 Aug 2005 08:25:58 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 27 10:25:49 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E8w08-0004hS-IG for geh-help-gnu-emacs@m.gmane.org; Sat, 27 Aug 2005 10:25:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E8w3X-0006JO-HF for geh-help-gnu-emacs@m.gmane.org; Sat, 27 Aug 2005 04:28:51 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!uninett.no!newsfeed1.eu.ignite.net!newsfeed.pacific.net.au!token.pipenetworks.com!218.100.2.58.MISMATCH!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 X-Original-NNTP-Posting-Host: 203.134.35.45 X-Original-NNTP-Posting-Host: 127.0.0.1 Original-Lines: 55 Original-NNTP-Posting-Host: 203.134.67.67 Original-X-Trace: 1125130039 un-2park-reader-02.sydney.pipenetworks.com.au 15516 203.134.67.67:4039 Original-X-Complaints-To: Abuse, including message IDs to abuse@pipenetworks.com Original-Xref: shelby.stanford.edu gnu.emacs.help:133493 Original-To: help-gnu-emacs@gnu.org 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:29028 Archived-At: Kevin Rodgers writes: C-h k C-c@ is undefined (add-hook 'c++-mode-hook '(lambda () (turn-on-auto-fill) ;;Insert a newline if line gets to long. (c-toggle-auto-state 1) ;;Make ; and { and } and : all electric (hs-minor-mode 1) ;for block hide/show (c-set-style "mc394-style"))) in .emacs-mc394 I have (local-set-key [f4] "\C-c@\C-c") ;toggles block hide/show > 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