[PATCH] don't show x-foo tags in search view
Austin Clements
amdragon at MIT.EDU
Wed Nov 7 06:37:37 PST 2012
The code looks good to me (two minor comments below), but, as David
pointed out, this needs a commit message.
Quoth James Vasile on Oct 30 at 10:57 am:
> Austin,
>
> Thanks for the helpful comments. I redid the patch to take a list of
> regexps. That way users can banish different kinds of tags or simply
> list the tags themselves. I've responded to your comments in text below
> the patch.
>
> ---
> emacs/notmuch.el | 26 +++++++++++++++++++++++++-
> 1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index f9454d8..05aa114 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -775,6 +775,21 @@ non-authors is found, assume that all of the authors match."
> (overlay-put overlay 'isearch-open-invisible #'delete-overlay)))
> (insert padding))))
>
> +
Extra blank link inserted.
> +(defcustom notmuch-search-hide-tag-regexps '()
> + "List of regular expressionss specifying tags to hide in search view.
> +
> +Notmuch will hide any tags in search view that match the regexps
> +specified in the list `notmuch-search-hide-tag-regexp`. The
> +match is case-insensitive.
> +
> +If you are not comfortable with regular expressions, a list of
> +tag words will work, assuming those tags use only alphanumeric
> +characters. An empty list will disable hiding of tags in search
> +view. The list can be set via setq or the customize interface."
The last sentence isn't necessary. This is true of virtually every
customize variable by design.
> + :type '(repeat regexp)
> + :group 'notmuch-search)
> +
> (defun notmuch-search-insert-field (field format-string result)
> (cond
> ((string-equal field "date")
> @@ -793,7 +808,16 @@ non-authors is found, assume that all of the authors match."
> (notmuch-search-insert-authors format-string (plist-get result :authors)))
>
> ((string-equal field "tags")
> - (let ((tags-str (mapconcat 'identity (plist-get result :tags) " ")))
> + (let ((tags-str
> + (mapconcat 'identity
> + (let ((case-fold-search t))
> + (remove-if
> + (lambda (tag)
> + (find tag notmuch-search-hide-tag-regexps
> + :test (lambda (tag regexp)
> + (string-match regexp tag))))
> + (plist-get result :tags)))
> + " ")))
> (insert (propertize (format format-string tags-str)
> 'face 'notmuch-tag-face))))))
>
More information about the notmuch
mailing list