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

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

Re: Emacs behavior


From: Steve Revilak
Subject: Re: Emacs behavior
Date: Sun, 2 May 2010 22:13:04 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

From: "VICTOR TARABOLA CORTIANO"

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-Style.html#Choosing-a-Style
  
http://www.gnu.org/software/emacs/manual/html_node/ccmode/Built_002din-Styles.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-Commands.html#index-TAB-17

Steve

Attachment: pgpt7WGUMa9Mu.pgp
Description: PGP signature


reply via email to

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