Article View: gnu.emacs.help
Article #188835Re: Spaces rather than tabs in C-mode
From: Mikael Adolfsson
Date: Sat, 15 Jun 1991 13:24
Date: Sat, 15 Jun 1991 13:24
30 lines
1808 bytes
1808 bytes
mleisher@nmsu.edu (Mark Leisher) writes:
>In article <1991Jun12.091208@igc.ethz.ch> torda@igc.ethz.ch (Andrew
>Torda ) writes:
> > I prefer spaces to tabs in my C source.
> > On a per-buffer basis, I can do it through edit-options, but how do I
> > do it forever in every buffer ?
> > I tried
> > (setq indent-tabs-mode nil)
> > and
> > (setq c-mode-hook (setq indent-tabs-mode nil))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
This evaluates to nil! So, c-mode-hook will be set to 'nil. The call
to setq must be quoted as in: '(setq indent-tabs-mode nil)
Although this should suffice Emacs complains about setq not being a
function (but a subroutine) when this expression is evaluated
(probably due to use of funcall rather than eval) so you must make it
a function:
(setq c-mode-hook (function (lambda () (setq indent-tabs-mode nil))))
>Try putting (setq-default indent-tabs-mode nil) in your .emacs file.
This is probably the simplest solution. But if you just want spaces in
your C source and not in *all* buffers, using c-mode-hook is the only
way to do it.
--
Mikael Adolfsson # d87-man@sm.luth.se
University of Lulea, Sweden # ...{uunet,mcsun,sunic}!sm.luth.se!d87-man
Technical Details
Message-ID:
<1679@tau.sm.luth.se>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!news.funet.fi!sunic!hagbard!lunic!my!luth!d87-manReferences:
<1991Jun12.091208@igc.ethz.ch> <MLEISHER.91Jun12233818@ithaka.nmsu.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103b8b,8186fa06f7bea60f X-Google-Attributes: gid103b8b,public X-Google-ArrivalTime: 1991-06-15 09:10:03 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!news.funet.fi!sunic!hagbard!lunic!my!luth!d87-man From: d87-man@sm.luth.se (Mikael Adolfsson) Newsgroups: gnu.emacs.help Subject: Re: Spaces rather than tabs in C-mode Message-ID: <1679@tau.sm.luth.se> Date: 15 Jun 91 13:24:09 GMT References: <1991Jun12.091208@igc.ethz.ch> <MLEISHER.91Jun12233818@ithaka.nmsu.edu> Organization: University of Lulea, Sweden Lines: 30