From 35b838ea1f3301a30b6584118bbcfbfd1f6e76df Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Wed, 4 Jul 2012 21:47:25 +0100 Subject: [PATCH] Re: [PATCH 1/8] emacs: Clean up notmuch-search-show-result --- ca/d2a8e63d44d1e1883fdf5f4524879a5614dea4 | 156 ++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 ca/d2a8e63d44d1e1883fdf5f4524879a5614dea4 diff --git a/ca/d2a8e63d44d1e1883fdf5f4524879a5614dea4 b/ca/d2a8e63d44d1e1883fdf5f4524879a5614dea4 new file mode 100644 index 000000000..be746406c --- /dev/null +++ b/ca/d2a8e63d44d1e1883fdf5f4524879a5614dea4 @@ -0,0 +1,156 @@ +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 0630A431FB6 + for ; Wed, 4 Jul 2012 13:47:39 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 JL0+zouBZvsQ for ; + Wed, 4 Jul 2012 13:47:38 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id DCEE4431FAE + for ; Wed, 4 Jul 2012 13:47:37 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1SmWTy-0000Ys-8C; Wed, 04 Jul 2012 21:47:32 +0100 +Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223] + helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1SmWTx-0002UW-S1; Wed, 04 Jul 2012 21:47:30 +0100 +From: Mark Walters +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH 1/8] emacs: Clean up notmuch-search-show-result +In-Reply-To: <1341354059-29396-2-git-send-email-amdragon@mit.edu> +References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> + <1341354059-29396-2-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.13.2+70~gb6a56e7 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Wed, 04 Jul 2012 21:47:25 +0100 +Message-ID: <87ipe3fe3m.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 94.192.233.223 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 6d6a5247bab7c72097b89a1063fcc164 (of first 20000 bytes) +X-SpamAssassin-Score: -1.8 +X-SpamAssassin-SpamBar: - +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -1.8 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay + * domain + * 0.5 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +Cc: tomi.ollila@iki.fi +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, 04 Jul 2012 20:47:39 -0000 + +On Tue, 03 Jul 2012, Austin Clements wrote: +> This simplifies the code and makes it no longer cubic in the number of +> result fields. +> --- +> emacs/notmuch.el | 20 ++++++++++---------- +> 1 file changed, 10 insertions(+), 10 deletions(-) +> +> diff --git a/emacs/notmuch.el b/emacs/notmuch.el +> index c6236db..be217a2 100644 +> --- a/emacs/notmuch.el +> +++ b/emacs/notmuch.el +> @@ -707,29 +707,29 @@ non-authors is found, assume that all of the authors match." +> (overlay-put overlay 'isearch-open-invisible #'delete-overlay))) +> (insert padding)))) +> +> -(defun notmuch-search-insert-field (field date count authors subject tags) +> +(defun notmuch-search-insert-field (field format date count authors subject tags) +> (cond +> ((string-equal field "date") +> - (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) date) +> + (insert (propertize (format format date) +> 'face 'notmuch-search-date))) +> ((string-equal field "count") +> - (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) count) +> + (insert (propertize (format format count) +> 'face 'notmuch-search-count))) +> ((string-equal field "subject") +> - (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) subject) +> + (insert (propertize (format format subject) +> 'face 'notmuch-search-subject))) +> +> ((string-equal field "authors") +> - (notmuch-search-insert-authors (cdr (assoc field notmuch-search-result-format)) authors)) +> + (notmuch-search-insert-authors format authors)) +> +> ((string-equal field "tags") +> - (insert (concat "(" (propertize tags 'font-lock-face 'notmuch-tag-face) ")"))))) +> + (insert +> + (format format (propertize tags 'font-lock-face 'notmuch-tag-face)))))) + +Am I missing something or did the search result line previously ignore +the user's specification for tags and automatically print it with inside +()? Now this change does actually obey the user's specification. + +In principle that is a good thing, but the tag update code (when +changing a tag on a message) seems to rely on the brackets to find +something and errors out if the user format does not have any +brackets. (The code has things like "(re-search-backward "(")" in it). + +Incidentally, patch 8 does change the format slightly by not padding the +the date field string itself and only printing it padded. This (very +mildly) breaks things if the user has customised +notmuch-search-result-format + +Best wishes + +Mark + + + +> +> (defun notmuch-search-show-result (date count authors subject tags) +> - (let ((fields) (field)) +> - (setq fields (mapcar 'car notmuch-search-result-format)) +> - (loop for field in fields +> - do (notmuch-search-insert-field field date count authors subject tags))) +> + (dolist (format notmuch-search-result-format) +> + (notmuch-search-insert-field (car format) (cdr format) +> + date count authors subject tags)) +> (insert "\n")) +> +> (defun notmuch-search-process-filter (proc string) +> -- +> 1.7.10 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2