From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Steve Revilak Newsgroups: gmane.emacs.help Subject: Re: Emacs behavior Date: Sun, 2 May 2010 22:13:04 -0400 Message-ID: <20100503021304.GD11102@srevilak.net> References: <20100502051849.6B0CF70000090@urquell.c3sl.ufpr.br> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IU5/I01NYhRvwH70" X-Trace: dough.gmane.org 1272852818 20818 80.91.229.12 (3 May 2010 02:13:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 3 May 2010 02:13:38 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon May 03 04:13:36 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O8lA8-00054H-6T for geh-help-gnu-emacs@m.gmane.org; Mon, 03 May 2010 04:13:36 +0200 Original-Received: from localhost ([127.0.0.1]:54160 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O8lA7-0007UQ-8x for geh-help-gnu-emacs@m.gmane.org; Sun, 02 May 2010 22:13:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O8l9k-0007UL-Kh for help-gnu-emacs@gnu.org; Sun, 02 May 2010 22:13:12 -0400 Original-Received: from [140.186.70.92] (port=33057 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O8l9j-0007UD-AU for help-gnu-emacs@gnu.org; Sun, 02 May 2010 22:13:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O8l9i-0005RL-46 for help-gnu-emacs@gnu.org; Sun, 02 May 2010 22:13:11 -0400 Original-Received: from mail2.sea5.speakeasy.net ([69.17.117.41]:33284) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O8l9h-0005R7-PS for help-gnu-emacs@gnu.org; Sun, 02 May 2010 22:13:10 -0400 Original-Received: (qmail 10803 invoked from network); 3 May 2010 02:13:07 -0000 Original-Received: from pool-108-7-223-66.bstnma.fios.verizon.net (HELO srevilak.net) (srevilak@[108.7.223.66]) (envelope-sender ) by mail2.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 3 May 2010 02:13:07 -0000 Content-Disposition: inline In-Reply-To: <20100502051849.6B0CF70000090@urquell.c3sl.ufpr.br> User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:72884 Archived-At: --IU5/I01NYhRvwH70 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable >From: "VICTOR TARABOLA CORTIANO"=20 >I would like to change the default behavior of Emacs in C mode, I >use tabs instead of spaces for editing, so I changed my .emacs[1] >to behave the way I want. > >For instance, I want: > >function() >{ > commands; >} > >But Emacs automatically modify the text to: > >function() > { > commands; > } > >It works the way I want in text-mode, but I want syntax highligting. > >I would like Emacs to behave like mg or vi in C mode. I've been working on a C project where most of the source code was indented using tabs, and I wanted my edits to follow the same formatting. A solution that worked for me was /* * Local Variables: * c-basic-offset: 8 * indent-tabs-mode: t * End: */ I added this Local Variables block at the bottom of each .c file I needed to edit. (I didn't want to change the behavior of C mode globally; instead, I merely wanted to change it in a few specific files.) Putting something like (setq c-basic-offset 8 indent-tabs-mode t) into ~/.emacs may give some of the behavior you're looking for. You can also try (setq c-indentation-style "linux") For a description of cc-mode styles, these are good places to start: http://www.gnu.org/software/emacs/manual/html_node/ccmode/Choosing-a-Sty= le.html#Choosing-a-Style http://www.gnu.org/software/emacs/manual/html_node/ccmode/Built_002din-S= tyles.html#Built_002din-Styles Finally, c-insert-tab-function might also be useful to you. http://www.gnu.org/software/emacs/manual/html_node/ccmode/Indentation-C= ommands.html#index-TAB-17 Steve --IU5/I01NYhRvwH70 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (GNU/Linux) iEYEARECAAYFAkveMTAACgkQX7YJI4BuyDT9XwCgnUI/TTS+pxOAPD1Pq21/cqcX C50An1h0zmDyLNhm1V0wohEJAvHFKHDo =23Ku -----END PGP SIGNATURE----- --IU5/I01NYhRvwH70--