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

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

Re: RE: Auto Fill Comments


From: Christopher Dimech
Subject: Re: RE: Auto Fill Comments
Date: Tue, 1 Dec 2020 00:22:11 +0100

That's a great example.  We can have a function that sets fill-column
as buffer-local and hook it to programming mode, c-mode say.  That would
be a useful example.  And users can try it out and see things work.

Yes, it is repeating and RTFM, but with a serious code example to excite
people to write actual code after the prose.

Thank you so very much.
Christopher


> Sent: Monday, November 30, 2020 at 11:45 PM
> From: "Drew Adams" <drew.adams@oracle.com>
> To: "Christopher Dimech" <dimech@gmx.com>, "Michael Heerdegen" 
> <michael_heerdegen@web.de>
> Cc: help-gnu-emacs@gnu.org
> Subject: RE: Auto Fill Comments
>
> > 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]