[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: expand/collapse{} in c++

From: Baloff
Subject: Re: expand/collapse{} in c++
Date: 27 Aug 2005 18:31:31 +1000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Kevin Rodgers <address@hidden> 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] "address@hidden") ;toggles block hide/show

> Jason Dufair wrote:
>  > Baloff <address@hidden> 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 "address@hidden" 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:
> "address@hidden" ; 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]