From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: setting non-user variables Date: Thu, 1 Jun 2017 12:02:09 +0200 Message-ID: <20170601100209.GA4141@tuxteam.de> References: <20170531142644.GA6848@workstation> <83tw41c9vr.fsf@gnu.org> <20170601092403.GB3432@workstation> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; x-action=pgp-signed Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1496311411 5526 195.159.176.226 (1 Jun 2017 10:03:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 1 Jun 2017 10:03:31 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 01 12:03:17 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dGMwn-0000lu-9m for geh-help-gnu-emacs@m.gmane.org; Thu, 01 Jun 2017 12:03:17 +0200 Original-Received: from localhost ([::1]:42521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGMws-00069Y-LN for geh-help-gnu-emacs@m.gmane.org; Thu, 01 Jun 2017 06:03:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37137) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGMvw-0005wd-AY for help-gnu-emacs@gnu.org; Thu, 01 Jun 2017 06:02:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGMvt-0005wz-8A for help-gnu-emacs@gnu.org; Thu, 01 Jun 2017 06:02:24 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:56683 helo=tomasium.tuxteam.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGMvt-0005wG-1v for help-gnu-emacs@gnu.org; Thu, 01 Jun 2017 06:02:21 -0400 Original-Received: from tomas by tomasium.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1dGMvh-0001Cp-H9 for help-gnu-emacs@gnu.org; Thu, 01 Jun 2017 12:02:09 +0200 In-Reply-To: <20170601092403.GB3432@workstation> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 5.199.139.25 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:113302 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, Jun 01, 2017 at 11:24:03AM +0200, Héctor Lahoz wrote: > Eli Zaretskii wrote: > > > From: "Héctor Lahoz" > > > Date: Wed, 31 May 2017 16:26:44 +0200 > > > > > > Recently I upgraded my Emacs to version 24 (I don't like to live on > > > the edge :-) and noticed that I can't use set-variable to set > > > this buffer-local variable anymore. What should I do? > > > Why was this changed? > > > > > > ;; before I did: > > > ;; set-variable RET mpkg-master-file RET "file.txt" RET > > > (make-variable-buffer-local > > > (defvar mpkg-master-file)) > > > > What package defines mpkg-master-file? I couldn't find it in packages > > bundled with Emacs. > > It is my own. Not published yet. > > > Also, what version of Emacs did you have before the upgrade? > > 23.4.1 > > So, to be clear. The variable is defined like this: > > (make-variable-buffer-local > (defvar mpkg-master-file nil > "The path of the video associated to the current buffer")) > > With 23 I could set the variable interactively, with 24 I can't. I can confirm that (Emacs 26.0.50 here). Variables defined through defvar seem not to be indexed, whether buffer local or not. If you use `defcustom', though, this will work: (defcustom mpkg-master-file nil "...") No idea how that interacts with buffer-local though. To me, it looks intentional. I'm a bit pressed now (should be doing other things), but I'd expect it to be somewhere in the NEWS. The nice thing about defcustom is that you get lots of options, like for setting an edit widget for the value (and possibly some validation code). The ugly thing is that you now get to read some docs ;-) Cheers - -- tomás -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlkv5iEACgkQBcgs9XrR2kZxUwCfZC0QPCcH04zPQsXbftnymFEl i60AmwXmoIcFaVuMBi2SC1Djrd/wIpoS =gAg3 -----END PGP SIGNATURE-----