From: "Drew Adams" <drew.adams@oracle.com>
To: "'Stefan Monnier'" <monnier@IRO.UMontreal.CA>,
"'Eli Zaretskii'" <eliz@gnu.org>
Cc: lekktu@gmail.com, dann@ics.uci.edu, lennart.borgman@gmail.com,
emacs-devel@gnu.org
Subject: RE: make-variable-buffer-local change
Date: Fri, 25 Sep 2009 15:10:20 -0700 [thread overview]
Message-ID: <9D911504D7AD429189A20B200265EC58@us.oracle.com> (raw)
In-Reply-To: <jwvd45ekanz.fsf-monnier+emacs@gnu.org>
> >> > I'd say "use" covers both kinds of use, but I'll defer
> >> > to natives.
> >>
> >> It's not a question of native speakers. "Use" here refers
> >> to what the string is _for_; what it is used for.
>
> There are often different ways to look at it. E.g. Let's say that
> a mode displays two columns of text and set tab-width to half-the
> window-width for that purpose; is it "using" tab-width? I'd say yes.
>
> Similarly, I tend to think that PCL-CVS "uses"
> list-buffers-directory in
> order to improve the behavior of uniquify.
>
> In general, variables are a means of communication, and each side of
> the communication thinks of itself as "using" the variable
> and the other side(s) as "providing" the variable.
You _cannot_ know what the variable is for, just by looking at Dired's setting
of it.
...without, that is, also reading the comment in Dired that says that it sets it
for the benefit of `list-buffers':
;; list-buffers uses this to display the dir being edited in this buffer.
The fact that there is such a comment is proof that the setting code does not,
by itself, indicate in any way what the variable does - what its effect/purpose
is.
Why doesn't the setting code help our understanding? Because the variable is set
for its consumer - the code that examines (uses) its value. As the comment says,
Dired sets it for `list-buffers'. The variable has use only for `list-buffers'
(and for similar buffer-listing code). Without that use, setting it has no
effect and no purpose.
You _can_ tell what the variable is for by looking at the consumer code. Why?
Because you can see how it, uh, uses it, concretely.
The point is not that consumers depend logically on producers as much as
producers depend on consumers, and that variables serve for communication
(coupling). That's certainly true, but it doesn't help us describe the
variable's purpose or use.
The point is what the variable is for. The purpose of the doc string is to tell
you what the variable is for, and perhaps a bit about how to use it.
This variable's purpose is to affect buffer listings. No foray into the code
that sets the value will help you understand that - unless there happens to be a
comment there to that effect.
It does help to explain that this is a buffer-local variable. That in itself
makes it clear that you want to set (and test) the value in the buffer that is
to be listed. That is useful info about the producer/consumer relation.
So yes, it doesn't hurt to give, in the doc string, the example of setting this
locally in a Dired buffer, in order to affect the `File' entry display for that
buffer in a buffer listing.
But Dired is actually not such a great example, since a directory is also
(typically) a file, or is file-like. Using the directory name as the buffer's
`File' description is not particularly noteworthy.
A better example would be Info, but Info doesn't actually use this variable -
instead, we hard-code the treatment of Info buffers in the `list-buffers' code.
That code should really be in info.el instead, and it should be used just to set
`list-buffers-directory'. IOW, Info should be treated the same way as Dired.
BTW, this variable's name is obviously not wonderful. Its value is text that
appears in place of a file name in a buffer listing. That has nothing per se to
do with directories - we don't list the directory of an Info node's file. It
should have been called something like `list-buffers-file-field-text' or
`list-buffers-pseudo-file-text'. Too late, perhaps.
next prev parent reply other threads:[~2009-09-25 22:10 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-25 16:09 make-variable-buffer-local change Dan Nicolaescu
2009-09-25 16:32 ` Juanma Barranquero
2009-09-25 16:50 ` Lennart Borgman
2009-09-25 16:57 ` Juanma Barranquero
2009-09-25 17:35 ` Drew Adams
2009-09-25 17:41 ` Juanma Barranquero
2009-09-25 18:06 ` Drew Adams
2009-09-25 19:09 ` Eli Zaretskii
2009-09-25 20:10 ` Drew Adams
2009-09-26 9:10 ` Eli Zaretskii
2009-09-25 21:04 ` Stefan Monnier
2009-09-25 22:10 ` Drew Adams [this message]
2009-09-26 1:30 ` Stefan Monnier
2009-09-26 1:42 ` Juanma Barranquero
2009-09-26 9:03 ` Eli Zaretskii
2009-09-25 17:07 ` Dan Nicolaescu
2009-09-25 17:31 ` Juanma Barranquero
2009-09-25 19:46 ` Dan Nicolaescu
2009-09-25 20:16 ` Juanma Barranquero
2009-09-25 20:51 ` Dan Nicolaescu
2009-09-25 21:21 ` Juanma Barranquero
2009-09-25 21:13 ` Tom Tromey
2009-09-25 19:49 ` Stefan Monnier
2009-09-25 21:07 ` Stefan Monnier
2009-09-25 21:25 ` Dan Nicolaescu
2009-09-25 21:44 ` Tom Tromey
2009-09-25 19:50 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9D911504D7AD429189A20B200265EC58@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=dann@ics.uci.edu \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=lekktu@gmail.com \
--cc=lennart.borgman@gmail.com \
--cc=monnier@IRO.UMontreal.CA \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.