Re: [PATCH] don't show x-foo tags in search view
authorAustin Clements <amdragon@MIT.EDU>
Wed, 7 Nov 2012 14:37:37 +0000 (09:37 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:50:24 +0000 (09:50 -0800)
90/01bfa2260d8df449c7b32980ad42b20630ab84 [new file with mode: 0644]

diff --git a/90/01bfa2260d8df449c7b32980ad42b20630ab84 b/90/01bfa2260d8df449c7b32980ad42b20630ab84
new file mode 100644 (file)
index 0000000..63f409a
--- /dev/null
@@ -0,0 +1,147 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 165D8431FB6\r
+       for <notmuch@notmuchmail.org>; Wed,  7 Nov 2012 06:37:43 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id UvgE3k-7oiHA for <notmuch@notmuchmail.org>;\r
+       Wed,  7 Nov 2012 06:37:42 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU\r
+       [18.7.68.35])\r
+       by olra.theworths.org (Postfix) with ESMTP id 80191431FAE\r
+       for <notmuch@notmuchmail.org>; Wed,  7 Nov 2012 06:37:42 -0800 (PST)\r
+X-AuditID: 12074423-b7fab6d0000008f9-28-509a7236c5af\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+       by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 31.63.02297.6327A905; Wed,  7 Nov 2012 09:37:42 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id qA7Ebf8Q007314; \r
+       Wed, 7 Nov 2012 09:37:41 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qA7Ebctl016224\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Wed, 7 Nov 2012 09:37:39 -0500 (EST)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1TW6l8-0006sj-3T; Wed, 07 Nov 2012 09:37:38 -0500\r
+Date: Wed, 7 Nov 2012 09:37:37 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: James Vasile <james@hackervisions.org>\r
+Subject: Re: [PATCH] don't show x-foo tags in search view\r
+Message-ID: <20121107143737.GC22284@mit.edu>\r
+References: <87fw4x3y3e.fsf@hackervisions.org>\r
+       <87liepw0b4.fsf@convex-new.cs.unb.ca>\r
+       <87625tc6xd.fsf@hackervisions.org> <20121030005700.GE15377@mit.edu>\r
+       <87390w57oo.fsf@hackervisions.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <87390w57oo.fsf@hackervisions.org>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFuphleLIzCtJLcpLzFFi42IR4hTV1jUrmhVgsOYgu8WN1m5Gi//N1RbX\r
+       b85kdmD2mNT1jMnj2apbzB5bDr1nDmCO4rJJSc3JLEst0rdL4MpoW7WRuWCxcMWuX7vYGhj/\r
+       83UxcnBICJhIvHle0sXICWSKSVy4t56ti5GLQ0hgH6PEsznToZz1jBKvd11ggnBOMEl8Pn+a\r
+       HcJZwijx499LJpB+FgEViVdNl9lAbDYBDYlt+5czgtgiAloSK8/PA7OZBeIk2jpvs4CsFhaw\r
+       lOj5FA8S5hXQkTg5HWbBYUaJDzdvsEEkBCVOznzCAtGrJXEDbBcHkC0tsfwfB0iYU0Bf4tHC\r
+       hWAniAKdMOXkNrYJjEKzkHTPQtI9C6F7ASPzKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl0zvdzM\r
+       Er3UlNJNjKBAZ3dR3sH456DSIUYBDkYlHt6GyJkBQqyJZcWVuYcYJTmYlER59+bMChDiS8pP\r
+       qcxILM6ILyrNSS0+xCjBwawkwstSCJTjTUmsrEotyodJSXOwKInzXku56S8kkJ5YkpqdmlqQ\r
+       WgSTleHgUJLgZQZpFCxKTU+tSMvMKUFIM3FwggznARoeATa8uCAxtzgzHSJ/ilFRSpz3YwFQ\r
+       QgAkkVGaB9cLS0SvGMWBXhHmdQVp5wEmMbjuV0CDmYAGF1+bATK4JBEhJdXAWLd//9ldzPeX\r
+       njn8St5tm8SELt+Z509INNVzHq8M8HSIsPL4kZ30573uj9S7Pbu+PxLabPXlxZQ1O+svpb+N\r
+       3zTnk8tZziVh+da+51+d3xd/ocj73ZKt5bs9/sxzuHtqzbI5bnd/rr1zVCj7XVLajXLpjrzC\r
+       8+w/nS496vhow7dX0E/aw96xpFyJpTgj0VCLuag4EQAQq3voHwMAAA==\r
+Cc: notmuch mailing list <notmuch@notmuchmail.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 07 Nov 2012 14:37:43 -0000\r
+\r
+The code looks good to me (two minor comments below), but, as David\r
+pointed out, this needs a commit message.\r
+\r
+Quoth James Vasile on Oct 30 at 10:57 am:\r
+> Austin,\r
+> \r
+> Thanks for the helpful comments.  I redid the patch to take a list of\r
+> regexps.  That way users can banish different kinds of tags or simply\r
+> list the tags themselves.  I've responded to your comments in text below\r
+> the patch.\r
+> \r
+> ---\r
+>  emacs/notmuch.el |   26 +++++++++++++++++++++++++-\r
+>  1 file changed, 25 insertions(+), 1 deletion(-)\r
+> \r
+> diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+> index f9454d8..05aa114 100644\r
+> --- a/emacs/notmuch.el\r
+> +++ b/emacs/notmuch.el\r
+> @@ -775,6 +775,21 @@ non-authors is found, assume that all of the authors match."\r
+>        (overlay-put overlay 'isearch-open-invisible #'delete-overlay)))\r
+>        (insert padding))))\r
+>  \r
+> +  \r
+\r
+Extra blank link inserted.\r
+\r
+> +(defcustom notmuch-search-hide-tag-regexps '()\r
+> +  "List of regular expressionss specifying tags to hide in search view.\r
+> +\r
+> +Notmuch will hide any tags in search view that match the regexps\r
+> +specified in the list `notmuch-search-hide-tag-regexp`.  The\r
+> +match is case-insensitive.\r
+> +\r
+> +If you are not comfortable with regular expressions, a list of\r
+> +tag words will work, assuming those tags use only alphanumeric\r
+> +characters.  An empty list will disable hiding of tags in search\r
+> +view.  The list can be set via setq or the customize interface."\r
+\r
+The last sentence isn't necessary.  This is true of virtually every\r
+customize variable by design.\r
+\r
+> +  :type '(repeat  regexp)\r
+> +  :group 'notmuch-search)\r
+> +\r
+>  (defun notmuch-search-insert-field (field format-string result)\r
+>    (cond\r
+>     ((string-equal field "date")\r
+> @@ -793,7 +808,16 @@ non-authors is found, assume that all of the authors match."\r
+>      (notmuch-search-insert-authors format-string (plist-get result :authors)))\r
+>  \r
+>     ((string-equal field "tags")\r
+> -    (let ((tags-str (mapconcat 'identity (plist-get result :tags) " ")))\r
+> +    (let ((tags-str\r
+> +       (mapconcat 'identity\r
+> +                  (let ((case-fold-search t))\r
+> +                    (remove-if\r
+> +                     (lambda (tag)\r
+> +                       (find tag notmuch-search-hide-tag-regexps\r
+> +                             :test (lambda (tag regexp)\r
+> +                                     (string-match regexp tag))))\r
+> +                     (plist-get result :tags)))\r
+> +                  " ")))\r
+>        (insert (propertize (format format-string tags-str)\r
+>                        'face 'notmuch-tag-face))))))\r
+>  \r
+\r
+\r