unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Temporarily changing number of spaces in indentation
@ 2012-04-04  7:45 Vineet Naik
  0 siblings, 0 replies; 3+ messages in thread
From: Vineet Naik @ 2012-04-04  7:45 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I usually use 4 spaces (indent-tabs-mode set to nil) to indent php code.

I have the following line in .emacs file which I guess sets this behaviour

(setq c-basic-offset 4)

I am now temporarily working on some code which uses 8 spaces instead of 4.

So I tried evaluating (setq c-basic-offset 8) in scratch buffer. I see
8 in the mini buffer but it still indents 4 spaces.

If I change this line in .emacs file, save it and restart emacs, then
it uses 8 spaces correctly.

What is the correct way to achieve this ?

Also is there a mode in emacs to smartly adapt to the indentation
style used in a buffer ?

Regards,
Vineet



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Temporarily changing number of spaces in indentation
       [not found] <mailman.480.1333525533.20052.help-gnu-emacs@gnu.org>
@ 2012-04-04 12:44 ` Xah Lee
  2012-04-05  7:37   ` Vineet Naik
  0 siblings, 1 reply; 3+ messages in thread
From: Xah Lee @ 2012-04-04 12:44 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 4, 12:45 am, Vineet Naik <naik...@gmail.com> wrote:
> Hello,
>
> I usually use 4 spaces (indent-tabs-mode set to nil) to indent php code.
>
> I have the following line in .emacs file which I guess sets this behaviour
>
> (setq c-basic-offset 4)
>
> I am now temporarily working on some code which uses 8 spaces instead of 4.
>
> So I tried evaluating (setq c-basic-offset 8) in scratch buffer. I see
> 8 in the mini buffer but it still indents 4 spaces.

you probably want to eval that in your current buffer. Not scratch.
Because, am guessing it's a buffer-local var.

> Also is there a mode in emacs to smartly adapt to the indentation
> style used in a buffer ?

Try call c-guess-buffer.

 Xah


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Temporarily changing number of spaces in indentation
  2012-04-04 12:44 ` Temporarily changing number of spaces in indentation Xah Lee
@ 2012-04-05  7:37   ` Vineet Naik
  0 siblings, 0 replies; 3+ messages in thread
From: Vineet Naik @ 2012-04-05  7:37 UTC (permalink / raw)
  To: Xah Lee; +Cc: help-gnu-emacs

On Wed, Apr 4, 2012 at 6:14 PM, Xah Lee <xahlee@gmail.com> wrote:
> On Apr 4, 12:45 am, Vineet Naik <naik...@gmail.com> wrote:
>> Hello,
>>
>> I usually use 4 spaces (indent-tabs-mode set to nil) to indent php code.
>>
>> I have the following line in .emacs file which I guess sets this behaviour
>>
>> (setq c-basic-offset 4)
>>
>> I am now temporarily working on some code which uses 8 spaces instead of 4.
>>
>> So I tried evaluating (setq c-basic-offset 8) in scratch buffer. I see
>> 8 in the mini buffer but it still indents 4 spaces.
>
> you probably want to eval that in your current buffer. Not scratch.
> Because, am guessing it's a buffer-local var.

It worked. Thanks.

Vineet



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-05  7:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.480.1333525533.20052.help-gnu-emacs@gnu.org>
2012-04-04 12:44 ` Temporarily changing number of spaces in indentation Xah Lee
2012-04-05  7:37   ` Vineet Naik
2012-04-04  7:45 Vineet Naik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).