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

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

RE: Difference between (setq fill-column 79) and (setq-default fill-colu


From: Drew Adams
Subject: RE: Difference between (setq fill-column 79) and (setq-default fill-column 79) ??
Date: Sat, 29 Nov 2008 09:50:57 -0800

> What is the difference between (setq fill-column 79) and (setq-default
> fill-column 79)? I'd like this value to be used everywhere.
> How come many other variables work fine if I just use setq???
> It seems this variable needs setq-default.
> Is it because most variables are global whereas fill-column is always
> local? (I read that but not sure what it means.)

Yes, it's because `fill-column' is buffer-local everywhere. You can see that if
you do `C-h v fill-column':

 "Automatically becomes buffer-local when set in any fashion."

This means that each buffer has its own value of variable `fill-column'. When
you do (setq-default fill-column 79), you ensure that the value will be 79 in
all buffers, by default. If you then do (setq fill-column 50) in buffer foo,
then 50 is the value of `fill-column' in buffer foo.

See the Elisp manual, node `Intro to Buffer-Local'. Use `i' in a manual to find
index entries. In the Elisp manual, `i buffer-local TAB' shows the relevant
index entries and lets you pick one to visit its node.





reply via email to

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