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

Re: text editors



Hi,

at last a contribution I can make, being unable to program c (yet) :)

You can have a look at the current indention settings by hitting

C-h v c-offsets-alist
(describe-variable c-offsets-alist)

single values can be set via the elist statement in your .emacs file:
(c-set-offset 'name value)
eg: (c-set-offset 'substatement-open 0)

To find out witch values to set, move the point to the line you want to 
have indented and hit C-c C-o

You might also want to have a look at the value of the variable 
c-basic-offset and indent-tabs-mod (switches between using tabs or spaces 
for indention).

Here is a portion of my .emacs file, where I define a couple of functions 
to get called when I switch to php mode:

(defun vinai-indent-setup ()             ;; just a name
  (setq c-basic-offset 4)                ;; basic offset 4 spaces
  (setq indent-tabs-mode nil)            ;; use spaces for indention
  (c-set-offset 'substatement-open 0)    ;; I like hanging braces like this
  (c-set-offset 'statement-cont 0))      ;; the same for braces after else

;; add to php-mode hook
(add-hook 'php-mode-user-hook 'vinai-indent-setup)

Also, you might want to try out M-x customize, where you can set a lot lot 
of values.

Greetings,

Vinai


--On Mittwoch, Oktober 24, 2001 23:55:41 -0400 Mike Ciul 
<mike@eyeballsun.org> wrote:

> What text editors do y'all use?
>
> Not that I mean to start a flame war, or anything, but I have a question
> about emacs.
>
> When I use emacs, it indents everything for me. I like that, but it
> doesn't indent things the same way that they were before- this makes cvs
> diffs really ugly because every line that got re-indented is different.
>
> Can anyone tell me how to set indenting so that my changes will match
> other people's files? Maybe someone already has some emacs settings for
> Xarchon they can just post here...
>
> Thanks!
>
> - Mike
>
>
> --
>
> UNSOUND PRODUCTIONS
> http://www.eyeballsun.org/
>
>
>
>