(anonymous) wrote:

>>>>>     C-h f setopt or
>>>>>     (info "(elisp) Setting Variables")

>>>> I am not sure why setq shouldn't be used anymore

>>> 1. ‘setq’ will *not* execute any ‘custom-set’ form that
>>>     might be associated with the user option.  But ‘setopt’
>>>     *will* execute any ‘custom-set’ form associate with a user
>>>     option.  Whether there exists a ‘custom-set’ form is up to
>>>     the programmer who defined a given user option.  There might
>>>     be one or might not.  The end-user is simply to use ‘setopt’
>>>     in order to have ‘setopt’ take this step, if any.

>>> 2. Unlike ‘setopt’, ‘setq’ will NOT emit a warning if the
>>>     type of value provided by the user does not match the
>>>     type of the corresponding variable declared by
>>>     ‘defcustom’.

>> I have got many "setq"s in my init.el file
>> because I copied them from the web, which refer to times before Emacs 29

>> So how can I find out, which ones to change into: setopt?
>> because, I guess, almost everything in my init.el file is like a custom-set

> One at a time, place point on each variable in your init
> file and type C-h v.  Emacs will then display the "Describe
> variable (default [your-variable])" prompt.  Press the
> return/enter key to accept the default.  Emacs will display
> a description of the variable in a *Help* buffer.  Scroll
> down in that buffer to see whether the description says that
> you can customize the variable.  If it does, then the
> variable is a user option, and you should use ‘setopt’ for
> the variable.  Otherwise, it is not a user option and you
> should use ‘setq’.

> […]

What is the harm in using setopt for all variables,
customizable or not?

Tim

  • ... Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader (in English)
    • ... Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader (in English)
      • ... tpeplt
        • ... Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader (in English)
          • ... tpeplt
            • ... gfp
              • ... tpeplt
                • ... Tim Landscheidt
                • ... tpeplt
                • ... Juergen Fenn
                • ... tpeplt
                • ... Juergen Fenn
                • ... tpeplt
                • ... Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader (in English)
              • ... Michael Heerdegen

Reply via email to