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 C474B431FBD for ; Wed, 4 Jul 2012 09:22:49 -0700 (PDT) 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 rkcFGi0jdmjj for ; Wed, 4 Jul 2012 09:22:48 -0700 (PDT) Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU [18.9.25.12]) by olra.theworths.org (Postfix) with ESMTP id B5B7D431FAE for ; Wed, 4 Jul 2012 09:22:46 -0700 (PDT) X-AuditID: 1209190c-b7f806d000006b87-bf-4ff46dd6eea7 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP id 35.A6.27527.6DD64FF4; Wed, 4 Jul 2012 12:22:46 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q64GMjcp002277; Wed, 4 Jul 2012 12:22:45 -0400 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 q64GMiBA006235 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Wed, 4 Jul 2012 12:22:44 -0400 (EDT) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1SmSLj-0000Db-Vu; Wed, 04 Jul 2012 12:22:44 -0400 Date: Wed, 4 Jul 2012 12:22:43 -0400 From: Austin Clements To: Mark Walters Subject: Re: [PATCH 1/8] emacs: Clean up notmuch-search-show-result Message-ID: <20120704162243.GC21653@mit.edu> References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> <1341354059-29396-2-git-send-email-amdragon@mit.edu> <87lij0gdwt.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87lij0gdwt.fsf@qmul.ac.uk> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphleLIzCtJLcpLzFFi42IRYrdT172W+8XfYOJKEYvVc3ksrt+cyWzx ZuU8Vgdmj52z7rJ7HP66kMXj2apbzAHMUVw2Kak5mWWpRfp2CVwZ3/dfYim4K1Hx8v4G1gbG U8JdjJwcEgImEsfOf2SFsMUkLtxbz9bFyMUhJLCPUeLg97OMEM56Rokl2++ygVQJCZxgkjje 7ASRWMIo8W9KLwtIgkVARWLZlFvMIDabgIbEtv3LGUFsEQEdiduHFrCD2MwC+hIrT84EqxEW cJa43LEKqJeDgxeoZudvX4iZUxklmvYsBavhFRCUODnzCQtEr5bEjX8vmUDqmQWkJZb/4wAJ cwKt2n/sOBOILQp0wpST29gmMArNQtI9C0n3LITuBYzMqxhlU3KrdHMTM3OKU5N1i5MT8/JS i3QN9XIzS/RSU0o3MYICnVOSZwfjm4NKhxgFOBiVeHiTFT77C7EmlhVX5h5ilORgUhLl3ZT1 xV+ILyk/pTIjsTgjvqg0J7X4EKMEB7OSCK99OFCONyWxsiq1KB8mJc3BoiTOeznlpr+QQHpi SWp2ampBahFMVoaDQ0mCVxYY0UKCRanpqRVpmTklCGkmDk6Q4TxAw5fkgAwvLkjMLc5Mh8if YlSUEuflA2kWAElklObB9cIS0StGcaBXhHn/gLTzAJMYXPcroMFMQIPzFn8CGVySiJCSamDU rWvd0mjCJP/6ziOPEKkdEXOvZsh/PNDHNp/vOKPKvKlf3jZ4fzt86P6MbVtOLPl7Z+vs6Qf/ ay0+uCQ+YdYFq5Ac4YyTzyqOG4vbi26aE2trPf9I3objoZryj0svfI28Kia6JU7+YMk2NYOo Xyzf80yTrr/2VdtkGbP9jmvckeKlvSz3vnS8U2Ipzkg01GIuKk4EAFtVQMofAwAA Cc: tomi.ollila@iki.fi, notmuch@notmuchmail.org 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 16:22:50 -0000 Quoth Mark Walters on Jul 04 at 8:53 am: > On Tue, 03 Jul 2012, Austin Clements wrote: > > This simplifies the code and makes it no longer cubic in the number of > > result fields. > > This looks good to me and all tests pass, and I agree that this patch > can be pushed independently of the later patches in the series. > > My one comment is that I, as a lisp beginner, found the use of "format" > as a function and a variable confusing (particularly as I had not come > across the dolist macro and that use really makes format look like a > function). I can see how that would be confusing. Unless this version of the series is somehow perfect, I'll rename it in the second version. Perhaps result-format for the loop variable and spec for the format string argument? > Best wishes > > Mark > > > --- > > 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)))))) > > > > (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)