From: Austin Clements Date: Wed, 12 Feb 2014 01:30:48 +0000 (+1900) Subject: Re: [PATCH 6/7] emacs: search: use orig-tags in search X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d540abf52aaec90f39e3f9b0e526aa2f6054c0b1;p=notmuch-archives.git Re: [PATCH 6/7] emacs: search: use orig-tags in search --- diff --git a/d1/2f71f15d040220e9eadb99745fbc51467eacf0 b/d1/2f71f15d040220e9eadb99745fbc51467eacf0 new file mode 100644 index 000000000..750de65af --- /dev/null +++ b/d1/2f71f15d040220e9eadb99745fbc51467eacf0 @@ -0,0 +1,136 @@ +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 8CDD7431FBF + for ; Tue, 11 Feb 2014 17:31:00 -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 U7SUFW4G8qA7 for ; + Tue, 11 Feb 2014 17:30:53 -0800 (PST) +Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu + [18.7.68.37]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 0338B431FBD + for ; Tue, 11 Feb 2014 17:30:52 -0800 (PST) +X-AuditID: 12074425-f79906d000000cf9-f9-52facecc1d8c +Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) + (using TLS with cipher AES256-SHA (256/256 bits)) + (Client did not present a certificate) + by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP + id 6D.E9.03321.CCECAF25; Tue, 11 Feb 2014 20:30:52 -0500 (EST) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id s1C1UoBY027104; + Tue, 11 Feb 2014 20:30:51 -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.8/8.12.4) with ESMTP id s1C1Unj9005196 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); + Tue, 11 Feb 2014 20:30:50 -0500 +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) + (envelope-from ) + id 1WDOf2-0003RE-Vp; Tue, 11 Feb 2014 20:30:49 -0500 +From: Austin Clements +To: Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH 6/7] emacs: search: use orig-tags in search +In-Reply-To: <1390087855-26194-7-git-send-email-markwalters1009@gmail.com> +References: <1390087855-26194-1-git-send-email-markwalters1009@gmail.com> + <1390087855-26194-7-git-send-email-markwalters1009@gmail.com> +User-Agent: Notmuch/0.17~rc2+14~g06f47e0 (http://notmuchmail.org) Emacs/23.4.1 + (i486-pc-linux-gnu) +Date: Tue, 11 Feb 2014 20:30:48 -0500 +Message-ID: <87lhxhm81j.fsf@awakening.csail.mit.edu> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFnrAIsWRmVeSWpSXmKPExsUixG6nonvm3K8gg+2fWS1Wz+WxuH5zJrMD + k8fOWXfZPZ6tusUcwBTFZZOSmpNZllqkb5fAlfH/YhtrwUuhiv99f9gbGHv5uxg5OSQETCTO + N7xmgrDFJC7cW8/WxcjFISQwm0ni998vTBDORkaJ/ivPWCGc00wSC15MZIZwljBKbJ+5lxWk + n01AQ2Lb/uWMILaIgKvE02+fmUFsYQF7iTc7JwPN5eDgFPCSOLqlAqK3nVHi4NunYDWiAkkS + p6f+ZgWpYRFQlfhx0AIkzAt03rN/x9ggbEGJkzOfsIDYzAJaEjf+vWSawCgwC0lqFpLUAkam + VYyyKblVurmJmTnFqcm6xcmJeXmpRboWermZJXqpKaWbGMEB6aK6g3HCIaVDjAIcjEo8vIKL + fgUJsSaWFVfmHmKU5GBSEuUNOAYU4kvKT6nMSCzOiC8qzUktPsQowcGsJMKrfwIox5uSWFmV + WpQPk5LmYFES5621AEoJpCeWpGanphakFsFkZTg4lCR4f54BygoWpaanVqRl5pQgpJk4OEGG + 8wAN/3MKZHhxQWJucWY6RP4Uo6KUOK/WWZDRIImM0jy4XljCeMUoDvSKMK8myAoeYLKB634F + NJgJaHB/NtjgkkSElFQDI29H294ZSbOsPp1liWcO9ZlZcCyzSof9H2/3hlJ2O5PZ2y9ees/S + I2o06eKzHIuqWsb78ucrw31XlpqbP35wwPHMQvEzUQe2zP9zwHubVcseq/YHpVwv3+2q8oub + plI/Uavr3VVXnU1Jwh7m6e8KjCs2HI6NLOp7vq0/7VdQWIfo2XjpgqStSizFGYmGWsxFxYkA + tTKOS/MCAAA= +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, 12 Feb 2014 01:31:00 -0000 + +On Sat, 18 Jan 2014, Mark Walters wrote: +> This uses the recent functionality to show the tag changes in the +> search buffer. Currently this is only used to show changes the search +> buffer makes itself: i.e., it does not make display any changes +> reflecting tagging done by other notmuch-buffers. +> --- +> emacs/notmuch.el | 12 +++++++++--- +> 1 files changed, 9 insertions(+), 3 deletions(-) +> +> diff --git a/emacs/notmuch.el b/emacs/notmuch.el +> index 1436e5a..f0ea5d4 100644 +> --- a/emacs/notmuch.el +> +++ b/emacs/notmuch.el +> @@ -753,14 +753,20 @@ non-authors is found, assume that all of the authors match." +> format-string (notmuch-sanitize (plist-get result :authors)))) +> +> ((string-equal field "tags") +> - (let ((tags (plist-get result :tags))) +> - (insert (format format-string (notmuch-tag-format-tags tags tags))))))) +> + (let ((tags (plist-get result :tags)) +> + (orig-tags (plist-get result :orig-tags))) +> + (insert (format format-string (notmuch-tag-format-tags tags orig-tags))))))) +> +> (defun notmuch-search-show-result (result &optional pos) +> "Insert RESULT at POS or the end of the buffer if POS is null." +> ;; Ignore excluded matches +> (unless (= (plist-get result :matched) 0) +> - (let ((beg (or pos (point-max)))) +> + (let ((beg (or pos (point-max))) +> + ;; If we are inserting the result for the first time POS +> + ;; will be nil and we should set orig-tags. +> + (result (if pos +> + result +> + (plist-put result :orig-tags (plist-get result :tags))))) + +This seems rather obtuse. I'd prefer a little wrapper that sits between +`notmuch-sexp-parse-partial-list' and `notmuch-search-show-result' that +adds :orig-tags. The wrapper could also pass (point-max) for pos and +pos could be made a required argument. E.g., + +(defun notmuch-search-process-result (result) + ;; Record original tags of this message + (setq result (plist-put result :orig-tags (plist-get result :tags))) + ;; Append the result to the search buffer + (notmuch-search-show-result result (point-max))) + +> (save-excursion +> (goto-char beg) +> (dolist (spec notmuch-search-result-format) +> -- +> 1.7.9.1 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch