This adds an extra variable notmuch-saved-search-extras that allows the user to add extra options to the saved-search customize variable. Of course it is up to them to make these extra options do anything afterwards. The difficulty is that the code definining a defcustom is executed when the the file is first read which would normally occur before any optional extras are loaded. To get around this I suggest that extras that wish to use this infrastucture add a helper loader file that does something like the following (this example is for a tweaked version of Austin's notmuch-go) (defvar notmuch-saved-search-extras nil) (setq notmuch-saved-search-extras (append notmuch-saved-search-extras '((checklist :inline t :format "%v" (group :format "%v" :inline t (const :format " Go key: " :go.key) (key-sequence :format "%v")))))) (eval-after-load 'notmuch '(require 'notmuch-go)) (provide 'notmuch-go-loader) The user should then (require 'notmuch-go-loader) before loading notmuch. --- The patch below is quite simple: almost all of the diff is whitespace. The more difficult part to get right was the above code snippet. It would be nice if a single file could say "don't read the following code until feature 'notmuch is present" but I don't know how to do that cleanly. The above at least means that it is simple from a user's perspective. And all that happens if they do load the extension after notmuch is that the defcustom is not updated and that is unavoidable. Best wishes Mark emacs/notmuch-hello.el | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 3de5238..e627f42 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -76,21 +76,25 @@ (defun notmuch-hello--saved-searches-to-plist (symbol) (let ((saved-searches (default-value symbol))) (mapcar #'notmuch-hello-saved-search-to-plist saved-searches))) +(defvar notmuch-saved-search-extras nil + "Extra formats to add to defcustom saved search widget") + (define-widget 'notmuch-saved-search-plist 'list "A single saved search property list." :tag "Saved Search" - :args '((list :inline t - :format "%v" - (group :format "%v" :inline t (const :format " Name: " :name) (string :format "%v")) - (group :format "%v" :inline t (const :format " Query: " :query) (string :format "%v"))) - (checklist :inline t - :format "%v" - (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v")) - (group :format "%v" :inline t (const :format "" :sort-order) - (choice :tag " Sort Order" - (const :tag "Default" nil) - (const :tag "Oldest-first" oldest-first) - (const :tag "Newest-first" newest-first)))))) + :args (append '((list :inline t + :format "%v" + (group :format "%v" :inline t (const :format " Name: " :name) (string :format "%v")) + (group :format "%v" :inline t (const :format " Query: " :query) (string :format "%v"))) + (checklist :inline t + :format "%v" + (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v")) + (group :format "%v" :inline t (const :format "" :sort-order) + (choice :tag " Sort Order" + (const :tag "Default" nil) + (const :tag "Oldest-first" oldest-first) + (const :tag "Newest-first" newest-first))))) + notmuch-saved-search-extras)) (defcustom notmuch-saved-searches '((:name "inbox" :query "tag:inbox") (:name "unread" :query "tag:unread")) -- 1.7.10.4