emacs-devel
[Top][All Lists]
Advanced

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

Re: Why isn't C-m listed here?


From: Alan Mackenzie
Subject: Re: Why isn't C-m listed here?
Date: 16 Apr 2007 20:43:16 +0200
Date: Mon, 16 Apr 2007 21:03:16 +0100
User-agent: Mutt/1.5.9i

'Evening, Eric!

On Mon, Apr 16, 2007 at 04:43:17PM +0200, Eric Lilja wrote:
> Miles Bader wrote:
> >Eric Lilja [snip quoted raw email address] writes:
> >>As the topic says: Why isn't C-m listed here:

> >>and if it was, what would its description be? Alias for <RET>?

> >It's not an alias for RET, it _is_ RET.

> >RET == C-m

> Ok, thanks for the quick reply. So, C-m is RET which means newline. C-j 
>  is newline-and-indent (C-m + <TAB>) so if I wanted a 
> newline-and-indent when I press <RET> in cc mode I could do:
> (global-set-key "\C-m" "\C-j")
> in my c mode common hook? Proper way to do it?

You could do this, but better might be this:

(defun my-c-initialization-hook ()
  (define-key c-mode-base-map "\C-m" 'c-context-line-break))
(add-hook 'c-initialization-hook 'my-c-initialization-hook)

, as suggested by the (current) CC Mode manual (page "Sample .emacs
File").  

This gives you proper continuation of comments and macros as well as
indentation of ordinary statements.  Note also that you don't need to use
c-mode-common-hook here - it wouldn't do any harm, but you only need to
bind the key once, not every time you open a fresh CC Mode buffer.

> - Eric

-- 
Alan Mackenzie (Ittersbach, Germany)




reply via email to

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