all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Glenn Morris <rgm@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	Michael Heerdegen <michael_heerdegen@web.de>
Cc: 14926@debbugs.gnu.org
Subject: bug#14926: 24.3.50; Warning "`make-variable-buffer-local' should be called at toplevel"
Date: Fri, 16 Aug 2013 00:34:51 -0700 (PDT)	[thread overview]
Message-ID: <94fb172e-f41b-470c-93a4-33376ab367b6@default> (raw)
In-Reply-To: <a81u5unn13.fsf@fencepost.gnu.org>

> > > "Warning: `make-variable-buffer-local' not called at toplevel"

> > > would have the same learning experience, without saying
> > > "should be...", which is wrong and confusing to people who
> > > know what they're doing.
> >
> > Sounds right.  Can someone make that change, plase?
> 
> Done. Of course, it won't remotely satisfy the OP.

Right.  It warns people not to use `make-variable-buffer-local'
except at top level.  Which is wrong.  Top level is irrelevant
to the proper use of `make-variable-buffer-local'.

By Stefan's admission, the problem this warning aims to solve is
a user who might be confusing `make-variable-buffer-local' with
`make-local-variable'.

His heuristic is presumably that IF `make-variable-buffer-local'
is used somewhere other than at top level THEN it is likely that
the user has confused the two functions, and `make-local-variable'
might be more appropriate.

It is the THEN part of that sentence, not the IF part, that is
the proper message for the user.

Assuming that the heuristic is good, the "warning" should really
draw the user's attention, not to "top level", but to
`make-local-variable' (which it does not mention).

Non top-levelness is only the **means by which the compiler**
detects a situation where the user might need help.  The warning
as proposed does not provide the help.  At all.

Think of what the user needs, not what the heuristic does.

You think you've found a good way to detect a case where the user
needs to be informed about `make-variable-buffer-local' vs
`make-local-variable'.  Great.  So tell the user about that, not
about how you figured out that s?he might be confused (= not at
top level).

If you want to issue a warning based on this heuristic, the 
message to the user should be to suggest that s?he might want
to use `make-local-variable' instead.  Don't even mention "top
level".  Just tell the user to consider using `make-local-variable'.

A useful message would even point to a doc section clarifying
the difference between the two functions.





  reply	other threads:[~2013-08-16  7:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-21 21:11 bug#14926: 24.3.50; Warning "`make-variable-buffer-local' should be called at toplevel" Drew Adams
2013-07-22  2:59 ` Stefan Monnier
2013-07-22  4:31   ` Drew Adams
2013-08-15 14:43   ` Michael Heerdegen
2013-08-15 16:33     ` Stefan Monnier
2013-08-15 18:19       ` Michael Heerdegen
2013-08-16  6:54       ` Glenn Morris
2013-08-16  7:34         ` Drew Adams [this message]
2013-08-16  7:45         ` Juanma Barranquero
2013-08-16 11:09           ` Michael Heerdegen
2013-08-16 14:07             ` Drew Adams
2013-08-16 21:23               ` Michael Heerdegen
2013-08-16 22:14                 ` Drew Adams
2013-08-16 16:25           ` Stefan Monnier
2013-08-16 16:31             ` Juanma Barranquero
2013-08-16 17:58             ` Drew Adams
2013-08-16 18:01             ` Glenn Morris
2013-08-16 21:26               ` Michael Heerdegen
2013-08-16 21:40                 ` Glenn Morris
2013-08-16 23:02                   ` Michael Heerdegen
2014-02-08  5:28           ` Lars Ingebrigtsen

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=94fb172e-f41b-470c-93a4-33376ab367b6@default \
    --to=drew.adams@oracle.com \
    --cc=14926@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=rgm@gnu.org \
    /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.