Allow an empty string in notmuch-tag-formats which matches all tags except those matched explicitly matched. This allows the user to tell notmuch to hide all tags except those specified. This will be useful once formatting for deleted/added tags is added later in the series: a user might want to hide all deleted tags for example. --- emacs/notmuch-tag.el | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index 2153068..92c1249 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -65,14 +65,15 @@ This gives a list that maps from tag names to lists of formatting expressions. The car of each element gives a tag name and the cdr gives a list of Elisp expressions that modify the tag. If -the list is empty, the tag will simply be hidden. Otherwise, -each expression will be evaluated in order: for the first -expression, the variable `tag' will be bound to the tag name; for -each later expression, the variable `tag' will be bound to the -result of the previous expression. In this way, each expression -can build on the formatting performed by the previous expression. -The result of the last expression will displayed in place of the -tag. +the car is an empty string it matches all tags that do not have +an explicit match. If the list is empty, the tag will simply be +hidden. Otherwise, each expression will be evaluated in order: +for the first expression, the variable `tag' will be bound to the +tag name; for each later expression, the variable `tag' will be +bound to the result of the previous expression. In this way, +each expression can build on the formatting performed by the +previous expression. The result of the last expression will +displayed in place of the tag. For example, to replace a tag with another string, simply use that string as a formatting expression. To change the foreground @@ -140,7 +141,8 @@ This can be used with `notmuch-tag-format-image-data'." (defun notmuch-tag-format-tag (tag) "Format TAG by looking into `notmuch-tag-formats'." - (let ((formats (assoc tag notmuch-tag-formats))) + (let ((formats (or (assoc tag notmuch-tag-formats) + (assoc "" notmuch-tag-formats)))) (cond ((null formats) ;; - Tag not in `notmuch-tag-formats', tag) ;; the format is the tag itself. -- 1.7.9.1