unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Héctor Lahoz" <hectorlahoz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: setting non-user variables
Date: Thu, 1 Jun 2017 17:22:10 +0200	[thread overview]
Message-ID: <20170601152209.GA8628@workstation> (raw)
In-Reply-To: <922a138a-d91d-41b1-a254-800e764fa4d3@default>

Drew Adams wrote:
> > > (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 "...")
> 
> Yes, `set-variable' is for "user variables", aka user options,
> only, aka symbols that satisfy predicate `user-variable-p'.
> 
> Today, that means a variable that is defined using defcustom,
> or an alias to such a variable.
> 
> It USED to also mean any variable whose doc string begins with `*'.
> Alas (IMHO), this feature was removed from Emacs 23 (i.e., long ago).
> 
> In Emacs 22 and prior you could do this:
> 
> (defvar foo  42 "*This is foo.")
> (put 'foo 'variable-interactive "nWidth: ")
> 
> M-x set-variable foo RET
> 
>  Width: 13 RET
> 
> And `foo' was available for completion (e.g. `f TAB') using
> `set-variable'.
> 
> Giving a variable a `variable-interactive' property tells
> `set-variable' how to read a value for it.
> 

You hit the nail on the head. In fact there is a "*" at the
beginning of the docstring and I was wondering why I put it
there some years ago.

Thanks a lot.



      parent reply	other threads:[~2017-06-01 15:22 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
2017-06-01 14:20       ` Drew Adams
2017-06-01 15:10         ` tomas
2017-06-01 15:22         ` Héctor Lahoz [this message]

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=20170601152209.GA8628@workstation \
    --to=hectorlahoz@gmail.com \
    --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.
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).