GNU bug report logs -
#22703
24.5; PROPOSAL: Is there a way to update available choices for defcustom variable?
Previous Next
Reported by: Oleksandr Gavenko <gavenkoa <at> gmail.com>
Date: Tue, 16 Feb 2016 18:21:02 UTC
Severity: wishlist
Tags: fixed
Found in version 24.5
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22703 in the body.
You can then email your comments to 22703 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#22703
; Package
emacs
.
(Tue, 16 Feb 2016 18:21:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Oleksandr Gavenko <gavenkoa <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 16 Feb 2016 18:21:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Recently I ask question:
http://emacs.stackexchange.com/questions/20350/defcustom-values-for-selecting-from-function-call
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:
(defvar my/python-checker-alist
'((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 alist."
:group 'my/python
:type (cons 'choice (mapcar (lambda (e) (cons 'const (car e))) my/python-checker-alist)) )
I am worrying is there a mechanic that **automatically** update `:type' value when
user visit:
M-x customize-group
M-x customize-variable
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:
(with-eval-after-load 'my/python
(add-to-list 'my/python-checker-alist ...))
but also somehow to update default values (for my/python-default-checker)
synchronously.
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.
--
http://defun.work/
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#22703
; Package
emacs
.
(Thu, 01 Aug 2019 12:45:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 22703 <at> debbugs.gnu.org (full text, mbox):
Oleksandr Gavenko <gavenkoa <at> gmail.com> writes:
> Recently I ask question:
>
> http://emacs.stackexchange.com/questions/20350/defcustom-values-for-selecting-from-function-call
>
> 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:
>
> (defvar my/python-checker-alist
> '((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 alist."
> :group 'my/python
> :type (cons 'choice (mapcar (lambda (e) (cons 'const (car e))) my/python-checker-alist)) )
>
> I am worrying is there a mechanic that **automatically** update `:type' value when
> user visit:
>
> M-x customize-group
> M-x customize-variable
>
> 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:
>
> (with-eval-after-load 'my/python
> (add-to-list 'my/python-checker-alist ...))
>
> but also somehow to update default values (for my/python-default-checker)
> synchronously.
>
> Are there standard convention for such situation?
(I'm going through old bug reports that have unfortunately not gotten
any responses.)
Yes, the person extending the defcustom can call
`custom-declare-variable' with the new :type, too. This should be
mentioned in the doc string for `defcustom', I think, and I'm making
that change on the Emacs trunk now.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 01 Aug 2019 12:49:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 27.1, send any further explanations to
22703 <at> debbugs.gnu.org and Oleksandr Gavenko <gavenkoa <at> gmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 01 Aug 2019 12:49:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 30 Aug 2019 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 241 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.