unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Why isn't C-m listed here?
@ 2007-04-16 14:15 Eric Lilja
  2007-04-16 14:24 ` Miles Bader
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Lilja @ 2007-04-16 14:15 UTC (permalink / raw)
  To: emacs-devel

As the topic says: Why isn't C-m listed here:
http://www.gnu.org/software/emacs/manual/emacs.html#Key-Index
?

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

- Eric

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why isn't C-m listed here?
  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 14:54   ` Drew Adams
  0 siblings, 2 replies; 6+ messages in thread
From: Miles Bader @ 2007-04-16 14:24 UTC (permalink / raw)
  To: Eric Lilja; +Cc: emacs-devel

Eric Lilja <mindcooler@gmail.com> 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

-Miles

-- 
The key to happiness
 is having dreams.	[from a fortune cookie]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why isn't C-m listed here?
  2007-04-16 14:24 ` Miles Bader
@ 2007-04-16 14:43   ` Eric Lilja
  2007-04-16 18:43     ` Alan Mackenzie
  2007-04-16 14:54   ` Drew Adams
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Lilja @ 2007-04-16 14:43 UTC (permalink / raw)
  To: emacs-devel

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?

- Eric

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Why isn't C-m listed here?
  2007-04-16 14:24 ` Miles Bader
  2007-04-16 14:43   ` Eric Lilja
@ 2007-04-16 14:54   ` Drew Adams
  1 sibling, 0 replies; 6+ messages in thread
From: Drew Adams @ 2007-04-16 14:54 UTC (permalink / raw)
  To: emacs-devel

> > 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

It is good, but not enough, to teach others here (emacs-devel). Pointing
something out here cannot be an alternative to the manual teaching the same
thing or (in this case) facilitating access to the same information.

Precisely because this user was missing that knowledge, C-m (and C-i, C-j,
and so on) should appear explicitly in the index. And the index link should
target a manual section where the equivalence is pointed out.

In general (please don't follow up with "Where do you draw the line?"), when
there are multiple names for the same thing, an index should provide
corresponding multiple entries. That applies even for incorrect names and
faux amis. Users look things up under different names, and they don't always
think in terms of the standard terminology.

That is why "paste" belongs in the index, pointing to a section about
yanking, even though "paste" and "yank" are not exactly synonymous. It is
why "window, window-manager" and "window-manager window" could also be index
entries, pointing to a section that described Emacs frames and the term
"frame".

I'm sure (i.e. I hope) that I'm preaching to the choir on this, but it's
unfortunately too easy to just answer a question here and not follow up by
improving the manual.

I must say that Eli is very diligent in thinking about what needs to be done
to improve the manual. Practically every time a user mentions in
help-gnu-emacs that s?he couldn't find something in the manual, Eli inquires
about how to make manual lookup easier for that case. Kudos for that, Eli.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why isn't C-m listed here?
  2007-04-16 14:43   ` Eric Lilja
@ 2007-04-16 18:43     ` Alan Mackenzie
  2007-04-16 19:38       ` Eric Lilja
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Mackenzie @ 2007-04-16 18:43 UTC (permalink / raw)
  To: Eric Lilja; +Cc: emacs-devel

'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)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why isn't C-m listed here?
  2007-04-16 18:43     ` Alan Mackenzie
@ 2007-04-16 19:38       ` Eric Lilja
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Lilja @ 2007-04-16 19:38 UTC (permalink / raw)
  To: emacs-devel

Alan Mackenzie wrote:
> '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.
> 

Thanks for your reply, Alan! Actually, this is my c-mode-common-hook 
right now (edited today but before I saw this reply):

(defun my-c-mode-common-hook ()
   ;; my customizations for all of c-mode and related modes
   (message "Running my-c-mode-common-hook")
   (setq c-basic-offset 3)
   ; Use spaces, not tabs, for indentation.
   (setq-default indent-tabs-mode nil)
   ; Replace C-m (C-m == <RET> == newline) with C-j (newline-and-indent).
   (define-key c-mode-base-map "\C-m" 'newline-and-indent)
   ; Maybe on by default on windows and off by default on solaris?
   (delete-selection-mode 1)
   ; Since this is run for php-mode we want to be able to toggle to html
   ; mode while editing a .php-file with both php and html blocks.
   ; html-mode contains a key binding to toggle to php mode.
   (define-key c-mode-base-map "\C-c\C-h" 'html-mode)
   )
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

I will try c-context-line-break and also think about which of these I 
can move into the initialization hook.

- Eric

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-04-16 19:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-04-16 19:38       ` Eric Lilja
2007-04-16 14:54   ` Drew Adams

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).