[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Updating defcustoms of a loaded library

From: Stephen Berman
Subject: Updating defcustoms of a loaded library
Date: Fri, 21 Jul 2017 19:25:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]