unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eric Lilja <mindcooler@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Why isn't C-m listed here?
Date: 16 Apr 2007 20:43:16 +0200	[thread overview]
Message-ID: <20070416200316.GA2655@muc.de> (raw)
In-Reply-To: <f0020e$6rc$1@sea.gmane.org>

'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	other threads:[~2007-04-16 18:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-16 14:15 Why isn't C-m listed here? Eric Lilja
2007-04-16 14:24 ` Miles Bader
2007-04-16 14:43   ` Eric Lilja
2007-04-16 18:43     ` Alan Mackenzie [this message]
2007-04-16 19:38       ` Eric Lilja
2007-04-16 14:54   ` Drew Adams

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20070416200316.GA2655@muc.de \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=mindcooler@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).