all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Mode specific re-binding of the enter key
@ 2007-06-21 14:19 Blake McBride
  2007-06-21 15:37 ` Tassilo Horn
  0 siblings, 1 reply; 3+ messages in thread
From: Blake McBride @ 2007-06-21 14:19 UTC (permalink / raw)
  To: help-gnu-emacs


Greetings,

I am using GNU Emacs 21.3.  Normally the return key ("RET") is bound to
"newline".  I globally re-bound RET to newline-and-indent because I prefered
this behavior in C-Mode.  The problem is that I don't like
"newline-and-indent" in other modes such as text mode.  I'd like to go back
to the default behavior of RET to be "newline" and that only in C-Mode files
it would be bound to "newline-and-indent".  I've tried numerous approaches
to do this but was unable.  Any help would be appreciated.

Blake McBride

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

* Re: Mode specific re-binding of the enter key
  2007-06-21 14:19 Mode specific re-binding of the enter key Blake McBride
@ 2007-06-21 15:37 ` Tassilo Horn
  2007-06-22  6:50   ` Nikolaj Schumacher
  0 siblings, 1 reply; 3+ messages in thread
From: Tassilo Horn @ 2007-06-21 15:37 UTC (permalink / raw)
  To: help-gnu-emacs

"Blake McBride" <blake@mcbride.name> writes:

> Normally the return key ("RET") is bound to "newline".  I globally
> re-bound RET to newline-and-indent because I prefered this behavior in
> C-Mode.  The problem is that I don't like "newline-and-indent" in
> other modes such as text mode.  I'd like to go back to the default
> behavior of RET to be "newline" and that only in C-Mode files it would
> be bound to "newline-and-indent".

(add-hook 'c-mode-hook
          (lambda ()
            (local-set-key (kbd "RET") 'newline-and-indent)))


Bye,
Tassilo
-- 
If programmers deserve to  be rewarded for creating innovative programs,
by the same  token they deserve to be punished if  they restrict the use
of these programs. (Richard M. Stallman)

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

* Re: Mode specific re-binding of the enter key
  2007-06-21 15:37 ` Tassilo Horn
@ 2007-06-22  6:50   ` Nikolaj Schumacher
  0 siblings, 0 replies; 3+ messages in thread
From: Nikolaj Schumacher @ 2007-06-22  6:50 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tassilo@member.fsf.org> wrote:

> "Blake McBride" <blake@mcbride.name> writes:
>
> (add-hook 'c-mode-hook
>           (lambda ()
>             (local-set-key (kbd "RET") 'newline-and-indent)))

or:

(define-key c-mode-base-map (kbd "RET") 'newline-and-indent)


or, if cc-mode hasn't been loaded:

(eval-after-load 'cc-mode
  '(define-key c-mode-base-map (kbd "RET") 'newline-and-indent))



regards,
Nikolaj Schumacher

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

end of thread, other threads:[~2007-06-22  6:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-21 14:19 Mode specific re-binding of the enter key Blake McBride
2007-06-21 15:37 ` Tassilo Horn
2007-06-22  6:50   ` Nikolaj Schumacher

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.