help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Autoindentation in all modes


From: Ted Zlatanov
Subject: Re: Autoindentation in all modes
Date: Wed, 28 Mar 2012 19:29:58 -0000
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux)

On Sun, 25 Dec 2011 03:54:35 -0800 (PST) Alexander Stepanov 
<darkdrip@gmail.com> wrote: 

AS> Is it possible to rewrite this ugly code in my ~/.emacs? What is the
AS> good way to do the %subject%?

AS> (add-hook 'c-mode-common-hook '(lambda ()
AS>   (local-set-key (kbd "RET") 'newline-and-indent)))
AS> (add-hook 'ruby-mode-hook '(lambda ()
AS>   (local-set-key (kbd "RET") 'newline-and-indent)))
AS> (add-hook 'python-mode-hook '(lambda ()
AS>   (local-set-key (kbd "RET") 'newline-and-indent)))
AS> (add-hook 'java-mode-hook '(lambda ()
AS>   (local-set-key (kbd "RET") 'newline-and-indent)))
AS> (add-hook 'css-mode-hook '(lambda ()
AS>   (local-set-key (kbd "RET") 'newline-and-indent)))
AS> (add-hook 'xml-mode-hook '(lambda ()
AS>   (local-set-key (kbd "RET") 'newline-and-indent)))
AS> (add-hook 'html-mode-hook '(lambda ()
AS>   (local-set-key (kbd "RET") 'newline-and-indent)))

You probably want `prog-mode-hook' (new in the upcoming Emacs 24 I
think; you can use the pretest until 24.1 is out).  It covers all the
"programming" modes where auto-indent makes the most sense.

Ted


reply via email to

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