help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: setting non-user variables


From: Drew Adams
Subject: RE: setting non-user variables
Date: Thu, 1 Jun 2017 07:20:03 -0700 (PDT)

> > (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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]