all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* defvar interactively, user-variable-p
@ 2015-10-18  9:48 Uwe Brauer
  2015-10-18 10:39 ` David Kastrup
  2015-10-18 11:52 ` Michael Heerdegen
  0 siblings, 2 replies; 8+ messages in thread
From: Uwe Brauer @ 2015-10-18  9:48 UTC (permalink / raw)
  To: emacs-devel

Hello

I am no friend of defcustom, but would like to define variables in what
that I can change their value interactively via set-variable.

According to the manual



,----
| Function: user-variable-p variable
| 
|     This function returns t if variable is a user option--a variable
|     intended to be set by the user for customization--and nil otherwise.
|     (Variables other than user options exist for the internal purposes
|     of Lisp programs, and users need not know about them.)
| 
|     User option variables are distinguished from other variables either
|     though being declared using defcustom(4) or by the first character
|     of their variable-documentation property. If the property exists and
|     is a string, and its first character is `*', then the variable is a
|     user option.
`----

This is a feature I am familiar with from Xemacs.

Now look at that



(defvar latexdiff-perl nil
"*Whether to use latexdiff based on perl or not, default is NIL.")

(user-variable-p latexdiff-perl)

Returns NIL and not t. And in fact I cannot set the variable
interactively. What do I miss?

Thanks

Uwe Brauer 







^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: defvar interactively, user-variable-p
  2015-10-18  9:48 defvar interactively, user-variable-p Uwe Brauer
@ 2015-10-18 10:39 ` David Kastrup
  2015-10-18 12:13   ` Uwe Brauer
  2015-10-18 11:52 ` Michael Heerdegen
  1 sibling, 1 reply; 8+ messages in thread
From: David Kastrup @ 2015-10-18 10:39 UTC (permalink / raw)
  To: emacs-devel

Uwe Brauer <oub@mat.ucm.es> writes:

> Hello
>
> I am no friend of defcustom, but would like to define variables in what
> that I can change their value interactively via set-variable.
>
> According to the manual
>
>
>
> ,----
> | Function: user-variable-p variable
> | 
> |     This function returns t if variable is a user option--a variable
> |     intended to be set by the user for customization--and nil otherwise.
> |     (Variables other than user options exist for the internal purposes
> |     of Lisp programs, and users need not know about them.)
> | 
> |     User option variables are distinguished from other variables either
> |     though being declared using defcustom(4) or by the first character
> |     of their variable-documentation property. If the property exists and
> |     is a string, and its first character is `*', then the variable is a
> |     user option.
> `----
>
> This is a feature I am familiar with from Xemacs.

I read

    user-variable-p is an alias for ‘custom-variable-p’.

    (user-variable-p VARIABLE)

    This function is obsolete since 24.3;
    use ‘custom-variable-p’ instead.

    Return non-nil if VARIABLE is a customizable variable.
    A customizable variable is either (i) a variable whose property
    list contains a non-nil ‘standard-value’ or ‘custom-autoload’
    property, or (ii) an alias for another customizable variable.

    [back]

as the function DOC string, and in the manual

 -- Function: custom-variable-p arg
     This function returns non-‘nil’ if ARG is a customizable variable.
     A customizable variable is either a variable that has a
     ‘standard-value’ or ‘custom-autoload’ property (usually meaning it
     was declared with ‘defcustom’), or an alias for another
     customizable variable.

while user-variable-p (understandably) is no longer documented.

So just what manual is it that you are consulting?

-- 
David Kastrup



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: defvar interactively, user-variable-p
  2015-10-18  9:48 defvar interactively, user-variable-p Uwe Brauer
  2015-10-18 10:39 ` David Kastrup
@ 2015-10-18 11:52 ` Michael Heerdegen
  2015-10-18 13:11   ` Uwe Brauer
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2015-10-18 11:52 UTC (permalink / raw)
  To: emacs-devel

Hello Uwe,

from NEWS.24:

,----------------------------------------------------------------------
| * Incompatible Lisp Changes in Emacs 24.3
| 
| ** Docstrings starting with `*' no longer indicate user options.
| Only variables defined using `defcustom' are considered user options.
| The function `user-variable-p' is now an obsolete alias for
| `custom-variable-p'.
`----------------------------------------------------------------------

Could it be that your installed documentation is older than your Emacs
version?


Regards,

Michael.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: defvar interactively, user-variable-p
  2015-10-18 10:39 ` David Kastrup
@ 2015-10-18 12:13   ` Uwe Brauer
  2015-10-18 12:25     ` David Kastrup
  0 siblings, 1 reply; 8+ messages in thread
From: Uwe Brauer @ 2015-10-18 12:13 UTC (permalink / raw)
  To: emacs-devel


   > Uwe Brauer <oub@mat.ucm.es> writes:


   >     This function is obsolete since 24.3;
   >     use ‘custom-variable-p’ instead.

   >     Return non-nil if VARIABLE is a customizable variable.
   >     A customizable variable is either (i) a variable whose property
   >     list contains a non-nil ‘standard-value’ or ‘custom-autoload’
   >     property, or (ii) an alias for another customizable variable.

   >     [back]

   > as the function DOC string, and in the manual

   >  -- Function: custom-variable-p arg
   >      This function returns non-‘nil’ if ARG is a customizable variable.
   >      A customizable variable is either a variable that has a
   >      ‘standard-value’ or ‘custom-autoload’ property (usually meaning it
   >      was declared with ‘defcustom’), or an alias for another
   >      customizable variable.

   > while user-variable-p (understandably) is no longer documented.

   > So just what manual is it that you are consulting?

Well I took the   first entry google offered.
Great, I just looked into the http address:

https://ftp.gnu.org/old-gnu/Manuals/elisp-manual-21-2.8/html_node/elisp_143.html

It says *old* sigh! Sorry.

However I never really paid attention to defcustom,
so the nifty easy to use feature "*" 

as in

(defvar latexdiff-perl nil
"*Whether to use latexdiff based on perl or not, default is NIL.")

Is gone?

But

https://www.gnu.org/software/emacs/manual/html_node/eintr/defvar-and-asterisk.html#defvar-and-asterisk

Suggests that I still can use it. But it does not work for me,





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: defvar interactively, user-variable-p
  2015-10-18 12:13   ` Uwe Brauer
@ 2015-10-18 12:25     ` David Kastrup
  2015-10-18 13:59       ` Uwe Brauer
  0 siblings, 1 reply; 8+ messages in thread
From: David Kastrup @ 2015-10-18 12:25 UTC (permalink / raw)
  To: emacs-devel

Uwe Brauer <oub@mat.ucm.es> writes:

>    > Uwe Brauer <oub@mat.ucm.es> writes:
>
>
>    >     This function is obsolete since 24.3;
>    >     use ‘custom-variable-p’ instead.
>
>    >     Return non-nil if VARIABLE is a customizable variable.
>    >     A customizable variable is either (i) a variable whose property
>    >     list contains a non-nil ‘standard-value’ or ‘custom-autoload’
>    >     property, or (ii) an alias for another customizable variable.
>
>    >     [back]
>
>    > as the function DOC string, and in the manual
>
>    >  -- Function: custom-variable-p arg
>    >      This function returns non-‘nil’ if ARG is a customizable variable.
>    >      A customizable variable is either a variable that has a
>    >      ‘standard-value’ or ‘custom-autoload’ property (usually meaning it
>    >      was declared with ‘defcustom’), or an alias for another
>    >      customizable variable.
>
>    > while user-variable-p (understandably) is no longer documented.
>
>    > So just what manual is it that you are consulting?
>
> Well I took the   first entry google offered.

You _are_ aware that the manuals are installed as part of Emacs?

C-h i g (elisp) RET

or the respective entry from the Help menu should get you going.

-- 
David Kastrup



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: defvar interactively, user-variable-p
  2015-10-18 11:52 ` Michael Heerdegen
@ 2015-10-18 13:11   ` Uwe Brauer
  2015-10-18 15:35     ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Uwe Brauer @ 2015-10-18 13:11 UTC (permalink / raw)
  To: emacs-devel

>>> "Michael" == Michael Heerdegen <michael_heerdegen@web.de> writes:

   > Hello Uwe,
   > from NEWS.24:

   > ,----------------------------------------------------------------------
   > | * Incompatible Lisp Changes in Emacs 24.3
   > | 
   > | ** Docstrings starting with `*' no longer indicate user options.
   > | Only variables defined using `defcustom' are considered user options.
   > | The function `user-variable-p' is now an obsolete alias for
   > | `custom-variable-p'.
   > `----------------------------------------------------------------------

Thanks that settles it!

   > Could it be that your installed documentation is older than your Emacs
   > version?

I think I trust google too much :'(

BTW pitty that this functionality is gone. Anyhow 




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: defvar interactively, user-variable-p
  2015-10-18 12:25     ` David Kastrup
@ 2015-10-18 13:59       ` Uwe Brauer
  0 siblings, 0 replies; 8+ messages in thread
From: Uwe Brauer @ 2015-10-18 13:59 UTC (permalink / raw)
  To: emacs-devel


   > Uwe Brauer <oub@mat.ucm.es> writes:

   > You _are_ aware that the manuals are installed as part of Emacs?

   > C-h i g (elisp) RET

   > or the respective entry from the Help menu should get you going.

Sigh, yes and no. I unfortunately use that sparsely and rely too much
on google.... Bad custom I suppose.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: defvar interactively, user-variable-p
  2015-10-18 13:11   ` Uwe Brauer
@ 2015-10-18 15:35     ` Drew Adams
  0 siblings, 0 replies; 8+ messages in thread
From: Drew Adams @ 2015-10-18 15:35 UTC (permalink / raw)
  To: Uwe Brauer, emacs-devel

> BTW pitty that this functionality is gone. Anyhow

Note, though, that you have commands `customize-set-variable'
and `customize-set-value', each of which does a part of what
`set-variable' does (a prefix arg to `set-variable' gives the
buffer-local behavior) - and more.

Those commands have the advantage that they not only type-check
your input (respecting the defcustom `:type') but they also
respect other defcustom keywords, such as `:set'.

`set-variable' respects `:type', but unfortunately not `:set':

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6578
http://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00867.html
http://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00839.html

My impression is that too few users are aware of
`customize-set-variable' and `customize-set-value'.  If the
(complete) behaviors of those commands were rolled into the
single command `set-variable' then users might take more
advantage of them.

And users who today still use `setq' in their init files
to set user options might then take to using that instead,
reducing problems due to ignoring `:type', `:set', and
`:initialize'.

I would also like to see defvar allow keywords `:type' and
`:set'.  That is, let you optionally specify the types of
allowable values and specify a setter function.

http://lists.gnu.org/archive/html/emacs-devel/2009-10/msg00668.html

Not only are defvar variables sometimes set by users, but
they can be set by other libraries.  Letting the defining
library control the allowable types would be a definite
benefit, IMO.  Use of such keywords would be optional, of
course.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-18 15:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-18  9:48 defvar interactively, user-variable-p Uwe Brauer
2015-10-18 10:39 ` David Kastrup
2015-10-18 12:13   ` Uwe Brauer
2015-10-18 12:25     ` David Kastrup
2015-10-18 13:59       ` Uwe Brauer
2015-10-18 11:52 ` Michael Heerdegen
2015-10-18 13:11   ` Uwe Brauer
2015-10-18 15:35     ` Drew Adams

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.