all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Baloff <washdc@wash.edu>
Subject: Re: expand/collapse{} in c++
Date: 27 Aug 2005 18:31:31 +1000	[thread overview]
Message-ID: <8764trg4rg.fsf@wash.edu> (raw)
In-Reply-To: mailman.5188.1125098056.20277.help-gnu-emacs@gnu.org

Kevin Rodgers <ihs_4664@yahoo.com> 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 <washdc@XXX> 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

  parent reply	other threads:[~2005-08-27  8:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-23 20:00 expand/collapse{} in c++ Baloff
2005-08-23 20:31 ` Gnus threading (was: expand/collapse{} in c++) Jason Dufair
2005-08-24 17:36   ` Baloff
2005-08-24 19:22     ` Gnus threading Johan Bockgård
2005-08-23 20:47 ` expand/collapse{} in c++ Sébastien Kirche
2005-08-23 21:59 ` Alan Mackenzie
2005-08-26 20:31   ` Baloff
2005-08-26 21:56     ` Peter Lee
2005-08-26 22:00     ` Jason Dufair
2005-08-26 22:39       ` Kevin Rodgers
     [not found]       ` <mailman.5188.1125098056.20277.help-gnu-emacs@gnu.org>
2005-08-27  8:31         ` Baloff [this message]
2005-08-24  3:32 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8764trg4rg.fsf@wash.edu \
    --to=washdc@wash.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.