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

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

Re: How to change indent width one buffer at a time?


From: despen
Subject: Re: How to change indent width one buffer at a time?
Date: Sat, 19 Dec 2009 09:52:12 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Mat <nabble.mexon@spamgourmet.com> writes:

> despen wrote:
>> 
>> 
>> Google "emacs file local variables".
>> 
>> 
>
> OK, so the answer is "M-x set-variable", "c-basic-offset", then the value. 
> I was surprised that doing the setf in .emacs affects every buffer, but
> doing it interactively only changes the current buffer.
>
> Anyway, since that's a lot of trouble, I made myself a shortcut:
>
> (defun change-c-basic-offset (size)
>   (interactive "nNew indent size: ")
>   (setf c-basic-offset size))

No, that's not the answer...

Go to the first hit, then select the first item.

You'll see:

;; -*- mode: Lisp; fill-column: 75; comment-column: 50; -*

Which is good for Lisp, but I think you're looking for C.

So you want:

/* -*- mode: C; c-basic-offset: 1; -*- */

Put a line like that at the top of each file with the offset the file
uses.




reply via email to

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