[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reading compile.el, modifying settings
From: |
Tassilo Horn |
Subject: |
Re: reading compile.el, modifying settings |
Date: |
Thu, 05 May 2011 21:09:54 +0200 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) |
Sam Steingold <sds@gnu.org> writes:
Hi Sam,
>>> compilation-error-regexp-alist is defined with defcustom, so it should
>>> be modified with custom-set-variables, not with setq. Don't ask.
>>
>> No, that's not true. You can setq any defcustom as if it was a defvar.
>
> Sure. You can setq any symbol.
> However, the _effect_ of setq on a variable defined with defcustom is
> different - it is not respected by emacs on the same level as
> custom-set-variables.
> At least it was not a few years ago, when I had the same problem - my
> setting being ignored - as Paul is having now.
If that really happens, I'd consider it a bug.
> 1. some packages use symbol properties in addition to the symbol value,
> these are modified by custom-set-variables automatically
,----
| ;; foo is not defined before
| (setq foo 17)
| ;; now load its defcustom
| (defcustom foo 111
| "Bla bla")
| ;; still has my value plus the props of the defcustom
| (cons foo (symbol-plist 'foo))
| ==> (17 standard-value (111) custom-requests nil variable-documentation "Bla
bla")
`----
> 2. some custom variables have fancy setters which are called by
> custom-set-variables but not by setq (like symbol macros in CL)
Yeah, but that has to be stated in the docs:
,----[ (info "(elisp)Variable Definitions") ]
| If you specify the `:set' keyword, to make the variable take other
| special actions when set through the customization buffer, the
| variable's documentation string should tell the user specifically
| how to do the same job in hand-written Lisp code.
`----
Good examples here are all those minor mode *variables*, which can be
customized to enable a mode globally, but to enable them from lisp, you
have to use the mode *function*:
;; Works
(custom-set-variables
'(hl-line-mode t))
;; Does not work (i.e., doesn't enable that mode)
(setq hl-line-mode t)
;; so you need to use the mode function from lisp
(hl-line-mode 1)
> In short, the rule of thumb is: do not use setq on custom variables,
> use custom-set-variables instead.
I really don't buy that. My emacs is highly customized in plain lisp
only, so that I can comment what I do and structure it according to my
likings.
Bye,
Tassilo
- reading compile.el, modifying settings, Paul Graham, 2011/05/05
- Re: reading compile.el, modifying settings, Tassilo Horn, 2011/05/05
- Re: reading compile.el, modifying settings, Sam Steingold, 2011/05/05
- Re: reading compile.el, modifying settings, Tassilo Horn, 2011/05/05
- Re: reading compile.el, modifying settings, Sam Steingold, 2011/05/05
- Re: reading compile.el, modifying settings,
Tassilo Horn <=
- Re: reading compile.el, modifying settings, Sam Steingold, 2011/05/05
- Re: reading compile.el, modifying settings, Tassilo Horn, 2011/05/06
Re: reading compile.el, modifying settings, Tassilo Horn, 2011/05/05