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

[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 20:19:39 +0100

If I do  (setq comment-auto-fill-only-comments t) but then change my mind
and want to have auto fill for the whole buffer, what should I do?


> Sent: Thursday, November 26, 2020 at 7:44 PM
> From: "Christopher Dimech" <dimech@gmx.com>
> To: tomas@tuxteam.de
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Auto Fill Comments
>
> > Sent: Thursday, November 26, 2020 at 7:27 PM
> > From: tomas@tuxteam.de
> > To: "Christopher Dimech" <dimech@gmx.com>
> > Cc: help-gnu-emacs@gnu.org
> > 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:
> >     
> > 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
> >
>
>



reply via email to

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