From: Austin Clements Date: Wed, 7 Nov 2012 14:37:37 +0000 (+1900) Subject: Re: [PATCH] don't show x-foo tags in search view X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=2a0028c5be89850b9a6348105f114f4a058eb664;p=notmuch-archives.git Re: [PATCH] don't show x-foo tags in search view --- diff --git a/90/01bfa2260d8df449c7b32980ad42b20630ab84 b/90/01bfa2260d8df449c7b32980ad42b20630ab84 new file mode 100644 index 000000000..63f409a35 --- /dev/null +++ b/90/01bfa2260d8df449c7b32980ad42b20630ab84 @@ -0,0 +1,147 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 165D8431FB6 + for ; Wed, 7 Nov 2012 06:37:43 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id UvgE3k-7oiHA for ; + Wed, 7 Nov 2012 06:37:42 -0800 (PST) +Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU + [18.7.68.35]) + by olra.theworths.org (Postfix) with ESMTP id 80191431FAE + for ; Wed, 7 Nov 2012 06:37:42 -0800 (PST) +X-AuditID: 12074423-b7fab6d0000008f9-28-509a7236c5af +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP + id 31.63.02297.6327A905; Wed, 7 Nov 2012 09:37:42 -0500 (EST) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id qA7Ebf8Q007314; + Wed, 7 Nov 2012 09:37:41 -0500 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qA7Ebctl016224 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Wed, 7 Nov 2012 09:37:39 -0500 (EST) +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) + (envelope-from ) + id 1TW6l8-0006sj-3T; Wed, 07 Nov 2012 09:37:38 -0500 +Date: Wed, 7 Nov 2012 09:37:37 -0500 +From: Austin Clements +To: James Vasile +Subject: Re: [PATCH] don't show x-foo tags in search view +Message-ID: <20121107143737.GC22284@mit.edu> +References: <87fw4x3y3e.fsf@hackervisions.org> + <87liepw0b4.fsf@convex-new.cs.unb.ca> + <87625tc6xd.fsf@hackervisions.org> <20121030005700.GE15377@mit.edu> + <87390w57oo.fsf@hackervisions.org> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <87390w57oo.fsf@hackervisions.org> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFuphleLIzCtJLcpLzFFi42IR4hTV1jUrmhVgsOYgu8WN1m5Gi//N1RbX + b85kdmD2mNT1jMnj2apbzB5bDr1nDmCO4rJJSc3JLEst0rdL4MpoW7WRuWCxcMWuX7vYGhj/ + 83UxcnBICJhIvHle0sXICWSKSVy4t56ti5GLQ0hgH6PEsznToZz1jBKvd11ggnBOMEl8Pn+a + HcJZwijx499LJpB+FgEViVdNl9lAbDYBDYlt+5czgtgiAloSK8/PA7OZBeIk2jpvs4CsFhaw + lOj5FA8S5hXQkTg5HWbBYUaJDzdvsEEkBCVOznzCAtGrJXEDbBcHkC0tsfwfB0iYU0Bf4tHC + hWAniAKdMOXkNrYJjEKzkHTPQtI9C6F7ASPzKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl0zvdzM + Er3UlNJNjKBAZ3dR3sH456DSIUYBDkYlHt6GyJkBQqyJZcWVuYcYJTmYlER59+bMChDiS8pP + qcxILM6ILyrNSS0+xCjBwawkwstSCJTjTUmsrEotyodJSXOwKInzXku56S8kkJ5YkpqdmlqQ + WgSTleHgUJLgZQZpFCxKTU+tSMvMKUFIM3FwggznARoeATa8uCAxtzgzHSJ/ilFRSpz3YwFQ + QgAkkVGaB9cLS0SvGMWBXhHmdQVp5wEmMbjuV0CDmYAGF1+bATK4JBEhJdXAWLd//9ldzPeX + njn8St5tm8SELt+Z509INNVzHq8M8HSIsPL4kZ30573uj9S7Pbu+PxLabPXlxZQ1O+svpb+N + 3zTnk8tZziVh+da+51+d3xd/ocj73ZKt5bs9/sxzuHtqzbI5bnd/rr1zVCj7XVLajXLpjrzC + 8+w/nS496vhow7dX0E/aw96xpFyJpTgj0VCLuag4EQAQq3voHwMAAA== +Cc: notmuch mailing list +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 07 Nov 2012 14:37:43 -0000 + +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)))))) +> + +