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

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

RE: Auto Fill Comments


From: Drew Adams
Subject: RE: Auto Fill Comments
Date: Mon, 30 Nov 2020 14:45:27 -0800 (PST)

> I understand that local variables are meant for buffer customization
> that
> one uses most often in mode hooks.  There has been some
> misunderstanding.
> 
> By not very good I meant: Can we have a typical example and how it
> would look like.
> I mean, rather than with foo, bar, a, g, temp, body.  For instance,
> making a command
> for some particular mode buffer, and a brief description of what is
> achieved.  Apologies
> should I not understand how hard that can be.  Hope my comment helps
> transmit what I mean
> better.

It doesn't get any more specific than this, IMO:

`C-x f' aka `M-x set-fill-column'.

Tada!  Variable `fill-column' just got its value
updated for the current buffer.

`C-h f' tells you that that command sets var
`fill-column'.

Clicking that var name in *Help* then tells you
that the var:

   Automatically becomes buffer-local when set.
   ^^^^^^^^^^^^^

That is, this particular variable is ALWAYS 
buffer-local - its value is separate for each
buffer.

What does "automatically" mean here?  It means
that to make it buffer-local you don't need to
do anything - you have no choice: it's
buffer-local in every buffer.

Why would that be the case for `fill-column'?
Because we figure it makes sense to always give
it a buffer-local value, that's all.

You can set the _default_ value for all buffers
using Customize (as the doc string tells you).

E.g., customize `fill-column' to 71, and if
nothing sets it to something different in a
given buffer then it'll be 71.

Most variables that might have buffer-local
values in some buffers do NOT automatically
become buffer-local in every buffer.  That is,
they are not "automatically" buffer-local.

They become buffer-local for a given buffer
only if something explicitly makes them
buffer-local there, e.g., using function
`make-local-variable'.

To make a variable ALWAYS (i.e.,
"automatically") be buffer-local (i.e., in
all buffers) you use the stronger function
`make-variable-buffer-local'.  The doc strings
(`C-h f') of those two functions tell you all
of this.

(`make-local-variable' might be more precisely
named `give-var-a-separate-value-in-THIS-buffer'.)

And yes (sigh), I'm just repeating what the
help and doc say better.  RTFM really is your
friend, you know. ;-)



reply via email to

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