[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22703: 24.5; PROPOSAL: Is there a way to update available choices fo
bug#22703: 24.5; PROPOSAL: Is there a way to update available choices for defcustom variable?
Tue, 16 Feb 2016 20:20:23 +0200
Recently I ask question:
because I didn't understand show to build code from that I read in docs.
While answer to question help me to build my first "customize" code it miss
main point and I think because the way Emacs customize API works, so nobody
even think about doing as I asked.
I have values:
'((pylint . (my/python-pylint-command my/python-pylint-args))
(pep8 . (my/python-pep8-command my/python-pep8-args))
(pyflakes . (my/python-pyflakes-command my/python-pyflakes-args)))
"Known Python source code checkers.")
and want to build `defcustom' definition based on that values:
(choice (const . pylint) (const . pep8) (const . pyflakes))
(defcustom my/python-default-checker 'pyflakes
"Default Python source code checker. See `my/python-checker-alist' for full
:type (cons 'choice (mapcar (lambda (e) (cons 'const (car e)))
I am worrying is there a mechanic that **automatically** update `:type' value
with my variable?
Official info states:
The argument of ‘:type’ is evaluated, but only once when the
‘defcustom’ is executed, so it isn’t useful for the value to vary.
If someone potentially extend my/python-checker-alist his addition would be
invisible in my/python-default-checker.
I thing it is wrong to ask someone not only to update possible values:
(add-to-list 'my/python-checker-alist ...))
but also somehow to update default values (for my/python-default-checker)
Are there standard convention for such situation?
I see ":options" and "custom-add-frequent-value" but this is not useful when
":type (choice ...)" used. Also it cumbersome even in case of :options ask any
extension developers to call "custom-add-frequent-value" for their additions.
":set" function called after user see menu with pre-filled values while
desired situation when used see updated list of available options.
Solution to this request is to allow value of ":type" be a function which is
evaluated on M-x customize-group / M-x customize-variable.
|[Prev in Thread]
||[Next in Thread]|
- bug#22703: 24.5; PROPOSAL: Is there a way to update available choices for defcustom variable?,
Oleksandr Gavenko <=