Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Emacs auto-indent??

Emacs auto-indent??
Thread Tools
Professional Poster
Join Date: Oct 2001
Status: Offline
Reply With Quote
Sep 5, 2005, 05:04 PM
 
How do I make it so that after I type RET Emacs automatically correctly indents? Like for example after typing a brace after an if statement I'd like it to indent correctly inside it:
[php]if (true) {
---->Indent
}[/php]
Essentially, I'd like the return key to do C-j
     
Professional Poster
Join Date: Oct 2001
Status: Offline
Reply With Quote
Sep 5, 2005, 05:11 PM
 
Neva mind! I got it use this trick:
Code:
(add-hook 'c-mode-common-hook '(lambda () (c-toggle-auto-hungry-state 1))) ;; Switch RET and LF. Makes <return> indent (defvar tmp (global-key-binding "\C-m")) (global-set-key "\C-m" (global-key-binding "\C-j")) (global-set-key "\C-j" tmp)
Put that into your .emacs file and voila!
     
Forum Regular
Join Date: Feb 2005
Status: Offline
Reply With Quote
Sep 5, 2005, 06:28 PM
 
Emacs, the first editor that requires a degree in LISP.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:51 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2