unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Difference between (setq fill-column 79) and (setq-default  fill-column 79) ??
@ 2008-11-29 17:30 seberino
  2008-11-29 17:50 ` Drew Adams
  0 siblings, 1 reply; 2+ messages in thread
From: seberino @ 2008-11-29 17:30 UTC (permalink / raw
  To: help-gnu-emacs

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.)

Chris


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

* RE: Difference between (setq fill-column 79) and (setq-default fill-column 79) ??
  2008-11-29 17:30 Difference between (setq fill-column 79) and (setq-default fill-column 79) ?? seberino
@ 2008-11-29 17:50 ` Drew Adams
  0 siblings, 0 replies; 2+ messages in thread
From: Drew Adams @ 2008-11-29 17:50 UTC (permalink / raw
  To: seberino, help-gnu-emacs

> 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.





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

end of thread, other threads:[~2008-11-29 17:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-29 17:30 Difference between (setq fill-column 79) and (setq-default fill-column 79) ?? seberino
2008-11-29 17:50 ` Drew Adams

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).