unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Replacing key binding for C-m with C-j for all CC Mode modes
@ 2007-04-16 18:49 Eric Lilja
  2007-04-16 20:09 ` Eric Hanchrow
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Lilja @ 2007-04-16 18:49 UTC (permalink / raw)
  To: help-gnu-emacs

Is this the proper way to do that?

(defun my-c-mode-common-hook ()
  ; my customizations for all of c-mode and related modes
  (message "Running my-c-mode-common-hook")
  ; Replace C-m (C-m == <RET> == newline) with C-j (newline-and-
indent).
  (define-key c-mode-base-map "\C-m" 'newline-and-indent)
  )
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

I tried with c-mode-map first but that didn't work out and display got
corrupted...

- Eric

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

* Re: Replacing key binding for C-m with C-j for all CC Mode modes
  2007-04-16 18:49 Replacing key binding for C-m with C-j for all CC Mode modes Eric Lilja
@ 2007-04-16 20:09 ` Eric Hanchrow
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Hanchrow @ 2007-04-16 20:09 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> "Eric" == Eric Lilja <mindcooler@gmail.com> writes:

    Eric> Is this the proper way to do that?  (defun
    Eric> my-c-mode-common-hook () ; my customizations for all of
    Eric> c-mode and related modes (message "Running
    Eric> my-c-mode-common-hook") ; Replace C-m (C-m == <RET> ==
    Eric> newline) with C-j (newline-and- indent).  (define-key
    Eric> c-mode-base-map "\C-m" 'newline-and-indent) ) (add-hook
    Eric> 'c-mode-common-hook 'my-c-mode-common-hook)

    Eric> I tried with c-mode-map first but that didn't work out and
    Eric> display got corrupted...

Here's what I do --
(add-hook 'c-mode-common-hook
          (lambda ()
            (local-set-key [?\C-m] 'newline-and-indent)
))


-- 

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-16 18:49 Replacing key binding for C-m with C-j for all CC Mode modes Eric Lilja
2007-04-16 20:09 ` Eric Hanchrow

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