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

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

Re: How to save custom variable programmatically?


From: Michael Heerdegen
Subject: Re: How to save custom variable programmatically?
Date: Tue, 10 Nov 2020 12:23:01 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Jean Louis <bugs@gnu.support> writes:

> I would like to use custom variables in such way to ask user
> pragmatically, not through customize interface, to change a
> variable. This could be for example user's location.
>
> Upon changing it, I would like programatically to save it for future.
>
> Should I use below function? Or maybe something else is recommended?
>
> (defun customize-save-variable (variable value &optional comment)
>
>   This way it is not working:
>   
> (require 'cus-edit)
> (customize-save hyperscope-default-server "localhost")

(you wanted to typw `customize-save-variable' I guess)

Note that `customize-save-variable' is a function.  Above you pass the
value of a variable instead of a variable: When a function call is
interpreted all arguments are evaluated first.  So you need to quote the
variable name to pass the symbol itself to the function.

Apart from that I think you could use that function.  But do you also
want a prompt for a value?

Michael.




reply via email to

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