In commit 2a7b11b064233afc4feead876fa396e3c18a6b91 the default value
for notmuch-search-line-faces was changed so that it didn't match the
specification in the corresponding defcustom. This meant that it was
difficult for the user to customize this variable as they got a type
mismatch error.

Note anyone who had already customised this variable would not see
this bug as their customisation would match the defcustom.

Getting this defcustom to work was quite tricky, so please could
people test: just try M-x customize-variable notmuch-search-line-faces
and see if a custom widget displays correctly (in particular that it
doesn't complaine about a type mismatch.

For testing devel/try-emacs-mua -q (or -Q) is useful (which seems to
be fine) so I am particularly interested in whether people's existsing
customisations break the defcustom widget.

I could not persuade the custom-edit-face widget to respect the :tag
property so had to do create a new widget. Anyway, this seems to fix
the defcustom so that the new default value, and previously customised
values all work.

I am not certain this is better than just reverting 2a7b -- even with
the above the customisation for notmuch-search-line-faces is more
complex (to the user as well as in the code)

Finally, the docstring says that a list of faces is also allowed. I
believe that is true but making that work with the customize widget
would be horrible. I think we should remove the documentation for it
from the defcustom and just put a lisp comment in the source code --
if the user wants to set it with a "setq" then they can read the
actual source.

Best wishes


emacs/notmuch.el | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 2834d44..d00c21a 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -670,9 +670,16 @@ of the result."
                  (goto-char (point-min))
                  (forward-line (1- notmuch-search-target-line)))))))))
+(define-widget 'notmuch--custom-face-edit 'lazy
+  "Custom face edit with a tag Edit Face"
+  ;; I could not persuage custom-face-edit to respect the :tag
+  ;; property so create a widget specially
+  :tag "Manually specify face"
+  :type 'custom-face-edit)
 (defcustom notmuch-search-line-faces
-  '(("unread" 'notmuch-search-unread-face)
-    ("flagged" 'notmuch-search-flagged-face))
+  '(("unread" . notmuch-search-unread-face)
+    ("flagged" . notmuch-search-flagged-face))
   "Alist of tags to faces for line highlighting in notmuch-search.
 Each element looks like (TAG . FACE).
 A thread with TAG will have FACE applied.
@@ -690,7 +697,9 @@ matching tags are merged, with earlier attributes overriding
 later. A message having both \"deleted\" and \"unread\" tags with
 the above settings would have a green foreground and blue
-  :type '(alist :key-type (string) :value-type (custom-face-edit))
+  :type '(alist :key-type (string)
+               :value-type (radio (face :tag "Face name")
+                                   (notmuch--custom-face-edit)))
   :group 'notmuch-search
   :group 'notmuch-faces)

notmuch mailing list

Reply via email to