[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Auto Fill Comments
From: |
tomas |
Subject: |
Re: Auto Fill Comments |
Date: |
Thu, 26 Nov 2020 19:27:34 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Thu, Nov 26, 2020 at 06:22:26PM +0100, Christopher Dimech wrote:
[...]
> Does that mean that setq-default also enables automatic filling?
>
> I need some explanation about setq, setq-default, and set-local.
You should skim the manual's "Variables" section [1]
In a nutshell, variables are a way to attach a value to a
name. In Emacs, there are different kinds of variables.
For our current purposes, we consider global variables
and buffer-local variables (there are more!).
A global variable is seen from everywhere. If you set its
value while in buffer A, this change will be seen in every
other buffer.
Buffer-local variables can have one value per-buffer. It
shadows the global variable (if there's any with the same
name). Most mode things are buffer local. The `fill-column'
is one example. You might want different values for it
in different buffers (say, you're editing two sources with
different styles in one session), that's why it is set up
as a buffer-local variable.
So if you do (setq fill-column 72) in the context of buffer
A, only buffer A gets to see that.
Setq-local (not set-local, as you wrote) is just a convenience,
which makes the named variables buffer-local and sets their
values (thus leaving possibly like-named global variables
alone).
The setq-default is for setting one or more buffer-local
variables's default values.
The gory details are in the Elisp manual [3]. There's also
an explanation for setq-default which is much better than
I could come up with here.
Cheers
[1] Online here:
For the user:
https://www.gnu.org/software/emacs/manual/html_node/emacs/Variables.html#Variables
For the lisp programmer:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Variables.html#Variables
although you /should/ have those manuals with your Emacs installation.
This is preferrable, since they should correspond to your Emacs
version.
[2]
https://www.gnu.org/software/emacs/manual/html_node/elisp/Buffer_002dLocal-Variables.html#Buffer_002dLocal-Variables
signature.asc
Description: Digital signature
- Re: Auto Fill Comments, (continued)
Re: Auto Fill Comments, Robert Thorpe, 2020/11/25
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/25
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/25
- Re: Auto Fill Comments, daniela-spit, 2020/11/26
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/26
- Re: Auto Fill Comments, tomas, 2020/11/26
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/26
- Re: Auto Fill Comments, daniela-spit, 2020/11/26
- Re: Auto Fill Comments,
tomas <=
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/26
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/26
- Re: Auto Fill Comments, tomas, 2020/11/26
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/26
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/26
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/26
- RE: Auto Fill Comments, Drew Adams, 2020/11/26
- Re: RE: Auto Fill Comments, Christopher Dimech, 2020/11/26
- RE: RE: Auto Fill Comments, arthur miller, 2020/11/26
- Re: RE: RE: Auto Fill Comments, Christopher Dimech, 2020/11/26