unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: emacs-devel@gnu.org
Subject: Updating defcustoms of a loaded library
Date: Fri, 21 Jul 2017 19:25:58 +0200	[thread overview]
Message-ID: <87shhpsnvd.fsf@rosalinde> (raw)

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	other threads:[~2017-07-21 17:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-21 17:25 Stephen Berman [this message]
2017-07-21 17:33 ` Updating defcustoms of a loaded library 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shhpsnvd.fsf@rosalinde \
    --to=stephen.berman@gmx.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).