unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@MIT.EDU>
To: James Vasile <james@hackervisions.org>
Cc: notmuch mailing list <notmuch@notmuchmail.org>
Subject: Re: [PATCH] don't show x-foo tags in search view
Date: Wed, 7 Nov 2012 09:37:37 -0500	[thread overview]
Message-ID: <20121107143737.GC22284@mit.edu> (raw)
In-Reply-To: <87390w57oo.fsf@hackervisions.org>

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))))))
>  

  parent reply	other threads:[~2012-11-07 14:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-29 18:57 [PATCH] don't show x-foo tags in search view James Vasile
2012-10-29 19:22 ` David Bremner
2012-10-29 19:47   ` James Vasile
2012-10-29 21:19   ` James Vasile
2012-10-30  0:57     ` Austin Clements
2012-10-30 14:57       ` James Vasile
2012-11-07 12:44         ` David Bremner
2012-11-07 14:15           ` James Vasile
2012-11-07 14:37         ` Austin Clements [this message]
2012-10-30  9:41 ` Damien Cassou
2012-10-30 16:42   ` James Vasile

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://notmuchmail.org/

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

  git send-email \
    --in-reply-to=20121107143737.GC22284@mit.edu \
    --to=amdragon@mit.edu \
    --cc=james@hackervisions.org \
    --cc=notmuch@notmuchmail.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://yhetil.org/notmuch.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).