[Top][All Lists]

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

Re: Auto Fill Comments

From: Christopher Dimech
Subject: Re: Auto Fill Comments
Date: Thu, 26 Nov 2020 19:44:10 +0100

> Sent: Thursday, November 26, 2020 at 7:27 PM
> From:
> To: "Christopher Dimech" <>
> Cc:
> Subject: Re: Auto Fill Comments
> 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.

Had thought that setq was actually a global thing, not local.
For local variables I was using "let" and "let*", but that seems
a wrong understanding.

> 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:
>     For the lisp programmer:
>     although you /should/ have those manuals with your Emacs installation.
>     This is preferrable, since they should correspond to your Emacs
>     version.
> [2] 

reply via email to

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