all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: <tomas@tuxteam.de>
To: help-gnu-emacs@gnu.org
Subject: Re: setting non-user variables
Date: Thu, 1 Jun 2017 12:02:09 +0200	[thread overview]
Message-ID: <20170601100209.GA4141@tuxteam.de> (raw)
In-Reply-To: <20170601092403.GB3432@workstation>

-----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" <hectorlahoz@gmail.com>
> > > 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-----



  reply	other threads:[~2017-06-01 10:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 14:26 setting non-user variables Héctor Lahoz
2017-05-31 14:45 ` Emanuel Berg
2017-05-31 14:58   ` Héctor Lahoz
2017-05-31 15:20     ` Emanuel Berg
2017-06-01  9:12       ` Héctor Lahoz
2017-06-01 13:45         ` Emanuel Berg
2017-05-31 15:21     ` John Ankarström
2017-05-31 15:23       ` John Ankarström
2017-05-31 15:40 ` Eli Zaretskii
2017-06-01  9:24   ` Héctor Lahoz
2017-06-01 10:02     ` tomas [this message]
2017-06-01 14:20       ` Drew Adams
2017-06-01 15:10         ` tomas
2017-06-01 15:22         ` Héctor Lahoz

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=20170601100209.GA4141@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=help-gnu-emacs@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.