From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Hansen Newsgroups: gmane.emacs.help Subject: Re: Can emacs open a new line below or above the current line? Date: Thu, 21 Dec 2006 10:15:40 +0100 Organization: disorganized Message-ID: <87zm9hhao3.fsf@localhorst.mine.nu> References: NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1166693053 14469 80.91.229.10 (21 Dec 2006 09:24:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 21 Dec 2006 09:24:13 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 21 10:24:11 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1GxK9i-0004vA-VB for geh-help-gnu-emacs@m.gmane.org; Thu, 21 Dec 2006 10:24:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GxK9i-0002xO-9A for geh-help-gnu-emacs@m.gmane.org; Thu, 21 Dec 2006 04:24:02 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GxK9Q-0002xJ-GI for help-gnu-emacs@gnu.org; Thu, 21 Dec 2006 04:23:44 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GxK9O-0002vL-VN for help-gnu-emacs@gnu.org; Thu, 21 Dec 2006 04:23:44 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GxK9O-0002uz-Ln for help-gnu-emacs@gnu.org; Thu, 21 Dec 2006 04:23:42 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GxK9O-0000Ry-66 for help-gnu-emacs@gnu.org; Thu, 21 Dec 2006 04:23:42 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GxK9L-0008Un-IK for help-gnu-emacs@gnu.org; Thu, 21 Dec 2006 10:23:39 +0100 Original-Received: from e178022198.adsl.alicedsl.de ([85.178.22.198]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 21 Dec 2006 10:23:39 +0100 Original-Received: from david.hansen by e178022198.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 21 Dec 2006 10:23:39 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-To: help-gnu-emacs@gnu.org Original-Lines: 28 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: e178022198.adsl.alicedsl.de Mail-Copies-To: nobody User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux) Cancel-Lock: sha1:/YF6WPNj9XjS9OzxYl08xcPHbG0= X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:39798 Archived-At: On Thu, 21 Dec 2006 15:45:30 +0800 Ronald wrote: > Better if it can be indented automatically (for example in cc mode). > > I get a habit that code the main ones first, and then add on > the trivialities. For example: > > if((n=write(fd,line,n))!=n){ > perror("write error\n"); //second > exit(-1); //first > } > > This may also applies when I type: > > a. > if(){} > b. > if(){ > |} //`|' as the cursor > c. > Then I'd like to open a line above indented automatically. > It normally would be C-j C-p tab. Just too many key strokes. Not sure though if i understand you right but the electric features of cc-mode may be interesting for you. In Emacs 22 you can toggle that behavior with C-c C-a. David