unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>,
	Juanma Barranquero <lekktu@gmail.com>
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 10:58:42 -0700 (PDT)	[thread overview]
Message-ID: <b5de164b-b354-48b9-b1ad-665a9bddc0da@default> (raw)
In-Reply-To: <jwvbo4xioz7.fsf-monnier+emacs@gnu.org>

> > The message still suggests that using make-variable-buffer-local
> > other than at toplevel is erroneous.
> 
> Notice that the message is only emitted when the argument to the"
> function is a constant.  I know of only one case where it is "not
> erroneous" to have such a call not at top-level (from message.el):
> 
>    ;; FIXME: On XEmacs this causes problems since let-binding like:
>    ;; (let ((message-options message-options)) ...)
>    ;; as in `message-send' and `mml-preview' loses to buffer-local
>    ;; variable initialization.
>    (unless (featurep 'xemacs)
>      (make-variable-buffer-local 'message-options))
> 
> So yes, I think in 99% of the cases, it's erroneous.

Hm.  A certain Stefan said this previously: ;-)

 >> > 2. What is wrong with code such as this at top level?
 >> 
 >> Nothing.  But most of the cases I bumped into... were cases
 >> where the author had confused make-local-variable and
 >> make-variable-buffer-local.

Putting the two statements together, I guess you're saying:

1. There is nothing *inherently* wrong with
`make-variable-buffer-local' at other than top level, at least in
cases like the example cited in the bug report:

(when (fboundp 'foo)
  (defvar toto 42 "...")
  (make-variable-buffer-local 'toto))

2. But though there is nothing inherently wrong with that, in 99%
of the cases it is erroneous to use `make-variable-buffer-local',
except at top level.

That would indeed be a good case for a warning.  (And perhaps a
note in the doc.)  But see my previous mail about the content of
the warning message: it should point to `make-local-variable' and
it should not mention "top level" at all.






  parent reply	other threads:[~2013-08-16 17:58 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
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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b5de164b-b354-48b9-b1ad-665a9bddc0da@default \
    --to=drew.adams@oracle.com \
    --cc=14926@debbugs.gnu.org \
    --cc=lekktu@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).