* Updating defcustoms of a loaded library
@ 2017-07-21 17:25 Stephen Berman
2017-07-21 17:33 ` Clément Pit-Claudel
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Berman @ 2017-07-21 17:25 UTC (permalink / raw)
To: emacs-devel
In todo-mode.el there are several defcustoms whose value can be one or
more of the files operated on by todo-mode. These operations include
adding new file and deleting existing files, which hence can change the
possible customizable values. In order to update the defcustoms while
using todo-mode, I defined several functions, which are called after
adding or deleting a todo file, that simple call `eval' on the defcustom
forms, e.g.:
(defun todo-reevaluate-filter-files-defcustom ()
"Reevaluate defcustom of `todo-filter-files'.
Called after adding or deleting a todo file."
(eval (defcustom todo-filter-files nil
"List of files for multifile item filtering."
:type `(set ,@(todo--files-type-list))
:group 'todo)))
An insightful reviewer of the code had this to say about these functions:
;; FIXME: This is hideous! I don't know enough about Custom to
;; offer something better, but please ask on emacs-devel!
So I'm asking, is there a better way?
Steve Berman
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Updating defcustoms of a loaded library
2017-07-21 17:25 Updating defcustoms of a loaded library Stephen Berman
@ 2017-07-21 17:33 ` Clément Pit-Claudel
2017-07-21 17:41 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Clément Pit-Claudel @ 2017-07-21 17:33 UTC (permalink / raw)
To: emacs-devel
On 2017-07-21 19:25, Stephen Berman wrote:
> So I'm asking, is there a better way?
Yup, IIRC you can do this:
(put 'todo-filter-files 'custom-type `(set ,@(todo--files-type-list)))
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Updating defcustoms of a loaded library
2017-07-21 17:33 ` Clément Pit-Claudel
@ 2017-07-21 17:41 ` Stefan Monnier
2017-07-21 17:51 ` Clément Pit-Claudel
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2017-07-21 17:41 UTC (permalink / raw)
To: emacs-devel
>> So I'm asking, is there a better way?
> Yup, IIRC you can do this:
> (put 'todo-filter-files 'custom-type `(set ,@(todo--files-type-list)))
It's less hideous, but isn't there a way to create a type that says "the
set returned by this function"?
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Updating defcustoms of a loaded library
2017-07-21 17:41 ` Stefan Monnier
@ 2017-07-21 17:51 ` Clément Pit-Claudel
2017-07-28 8:45 ` Stephen Berman
0 siblings, 1 reply; 5+ messages in thread
From: Clément Pit-Claudel @ 2017-07-21 17:51 UTC (permalink / raw)
To: emacs-devel
On 2017-07-21 19:41, Stefan Monnier wrote:
>>> So I'm asking, is there a better way?
>> Yup, IIRC you can do this:
>> (put 'todo-filter-files 'custom-type `(set ,@(todo--files-type-list)))
>
> It's less hideous, but isn't there a way to create a type that says "the
> set returned by this function"?
Not that I know of. I'd be happy to learn something new, though!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Updating defcustoms of a loaded library
2017-07-21 17:51 ` Clément Pit-Claudel
@ 2017-07-28 8:45 ` Stephen Berman
0 siblings, 0 replies; 5+ messages in thread
From: Stephen Berman @ 2017-07-28 8:45 UTC (permalink / raw)
To: Clément Pit-Claudel; +Cc: emacs-devel
On Fri, 21 Jul 2017 19:51:13 +0200 Clément Pit-Claudel <cpitclaudel@gmail.com> wrote:
> On 2017-07-21 19:41, Stefan Monnier wrote:
>>>> So I'm asking, is there a better way?
>>> Yup, IIRC you can do this:
>>> (put 'todo-filter-files 'custom-type `(set ,@(todo--files-type-list)))
>>
>> It's less hideous, but isn't there a way to create a type that says "the
>> set returned by this function"?
>
> Not that I know of. I'd be happy to learn something new, though!
I guess it should be possible with define-widget? I put looking into it
on one of my Todo lists, but in the mean time I'll reduce the
hideousness with `put'. Thanks for the suggestion and the feedback.
Steve Berman
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-07-28 8:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-21 17:25 Updating defcustoms of a loaded library Stephen Berman
2017-07-21 17:33 ` Clément Pit-Claudel
2017-07-21 17:41 ` Stefan Monnier
2017-07-21 17:51 ` Clément Pit-Claudel
2017-07-28 8:45 ` Stephen Berman
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).