all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Vim like auto indent mode
@ 2004-05-19  7:55 Ding Lei
  0 siblings, 0 replies; 3+ messages in thread
From: Ding Lei @ 2004-05-19  7:55 UTC (permalink / raw)


Hello folks,
	Under JDE/C++/C mode, Emacs will auto indent upon some symbols like an ending parenthess("{") or a semi-colon, but I really hope that it will auto indent immediately I press the return key.
	For example, When I type:
	for (;;;) {
	Emacs should indent by one tab, but actually it now will indent only after I type the semicolon.
	
	Any Ideas ? Thanks in advance.	

-- 
Regards,

<((         D i n g    L e i         ))))))>>
 ||                                      ||
 || Ext: 8102                            ||
 || Email: <dinglei [A] ipanel [O] cn>   ||
 || Dept. Of Technology/Engineering      ||
 || Embedded Information Services Inc.   ||
 ||                                      ||
<((((((    =====================     )))))>>>
	
If time heals all wounds, how come the belly button stays the same?

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

* Re: Vim like auto indent mode
       [not found] <mailman.6202.1084952911.1061.help-gnu-emacs@gnu.org>
@ 2004-05-19 12:24 ` David Hansen
  2004-05-20  8:20 ` Alan Mackenzie
  1 sibling, 0 replies; 3+ messages in thread
From: David Hansen @ 2004-05-19 12:24 UTC (permalink / raw)


On Wed, 19 May 2004 15:55:00 +0800 Ding Lei wrote:

> Under JDE/C++/C mode, Emacs will auto indent upon some symbols like an
> ending parenthess("{") or a semi-colon, but I really hope that it will
> auto indent immediately I press the return key.  

Is this doing what you want?

(add-hook 'c-mode-common-hook
          (lambda ()
            (define-key c-mode-map 
             "\C-m" 'reindent-then-newline-and-indent)))

I wonder why this isn't it the default in modes for programming
languages.

-- David

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

* Re: Vim like auto indent mode
       [not found] <mailman.6202.1084952911.1061.help-gnu-emacs@gnu.org>
  2004-05-19 12:24 ` Vim like auto indent mode David Hansen
@ 2004-05-20  8:20 ` Alan Mackenzie
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Mackenzie @ 2004-05-20  8:20 UTC (permalink / raw)


Ding Lei <dinglei@ipanel.cn> wrote on Wed, 19 May 2004 15:55:00 +0800:
> Hello folks,

> 	Under JDE/C++/C mode, Emacs will auto indent upon some symbols
> 	like an ending parenthess("{") or a semi-colon, but I really hope
> 	that it will auto indent immediately I press the return key.  For
> 	example, When I type:

> 	for (;;;) {

> 	Emacs should indent by one tab, but actually it now will indent
> 	only after I type the semicolon.
 	
> 	Any Ideas ? Thanks in advance.	

I take it you mean you want Emacs to indent the _new_ line after pressing
<return>, not the line with the "for (;;;) {".  Do one of the following:

(i) On the new line, you can use <tab> at any time to indent the line;

(ii) If you use C-j instead of <return> it should do what you want, but
you probably won't like typing C-j all the time )-;

(iii) Bind <return> to what you want, by putting this into your .emacs:
(eval-after-load "cc-mode"
  '(define-key c-mode-base-map "\C-m" 'c-context-line-break))

> D i n g    L e i

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

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

end of thread, other threads:[~2004-05-20  8:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.6202.1084952911.1061.help-gnu-emacs@gnu.org>
2004-05-19 12:24 ` Vim like auto indent mode David Hansen
2004-05-20  8:20 ` Alan Mackenzie
2004-05-19  7:55 Ding Lei

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.