From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id A18B6431FB6 for ; Wed, 4 Jul 2012 14:00:36 -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 67SKNLFpig-z for ; Wed, 4 Jul 2012 14:00:36 -0700 (PDT) Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU [18.7.68.36]) by olra.theworths.org (Postfix) with ESMTP id EEAFA431FAE for ; Wed, 4 Jul 2012 14:00:35 -0700 (PDT) X-AuditID: 12074424-b7f2a6d0000008bf-fa-4ff4aef3cabd Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP id 7E.6B.02239.3FEA4FF4; Wed, 4 Jul 2012 17:00:35 -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 q64L0YxJ021417; Wed, 4 Jul 2012 17:00:34 -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 q64L0UCX004684 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Wed, 4 Jul 2012 17:00:32 -0400 (EDT) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1SmWgY-0000o7-O0; Wed, 04 Jul 2012 17:00:30 -0400 Date: Wed, 4 Jul 2012 17:00:30 -0400 From: Austin Clements To: Mark Walters Subject: Re: [PATCH 1/8] emacs: Clean up notmuch-search-show-result Message-ID: <20120704210030.GE21653@mit.edu> References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> <1341354059-29396-2-git-send-email-amdragon@mit.edu> <87ipe3fe3m.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ipe3fe3m.fsf@qmul.ac.uk> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA01SbUgTYRzv2d22Z2tXt1Pb09SgQ0mkTQUjCbXMRL/Ewo+V5Omubbmdspvi 9klR8gWCVQptkS5tDCcqJEhSaU17WZQlgq8lBBJkpmEWVCDdbb59+/2f39vzBjHKI9VCC+dg 7RxjpWVKnJLnHtP97N8wpPdOUVm991RZM3MeLGulp0N6Bisa9n6SF439uo8XfQnOYxewi8ps I2u11LD2tNxSpXl9Pqbqe2Kte3RTVgc+alqBAiIyE7WsdoAoPoQ+LA7IWoESUuQIQNMv/ZLo MABQ4Hb3FvNagjoH1+TR4QFAN9YaZaIfJ5PQQqAbE7GMTEFDo4FIbix5HC2EfHIRY2Qa6gl7 IpoYMh9NNQdxEROCZuJf/VZdO0C/g0+kUUKNwp4lPGpORbObXwURFHA8CmxCcVkhdLlD7khm nLCHtvCQzA0o7x63d4/bu+v2ASwIEo02l87GWKw8W67jyxmOY+26k3qbxaFnjdUPQeTWzyU9 Ag0hOgRICGgVkWHbMFBSpoZ32kLgMJTQccSpPmHpQFml0WlmePMVe7WV5UMAQYyOJaBH4Agj 43Sx9sptKh7itIaYMc4ZKNLEONgKlq1i7dtsAoQ0IiqEl6bUdtbE1l61WB27tAQqxHCVEH5N LCb4KsbGW0xR/g3Qwf6V8VlA4Vwlx2o1hEMMIkWRuZrbydn+UctAIxwrhjgvqlTCf9tJWhZK JEIJ170uljiYXUpbB4rL/vTpOzpf6emD9c+WSv6m3kwuaJroyUn29Dj96y5Dy4m8H7eeNk82 DE/nJGe66c9HC8MFxbMmzdT7Qfh2KNxVe10xfDnBd9e3Os6UTqsf55/mm9q0wfZGwr/44nn6 yILmW54p21Aydqlrn7qwUflOmlLR5jrrn1yT778DjtA4b2YyUjE7z/wHfP1vLiwDAAA= 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 21:00:36 -0000 Quoth Mark Walters on Jul 04 at 9:47 pm: > 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). Mm, that's a good point. For now I should probably just revert the code to ignoring the user's format specification. A better solution would be to remember the result's plist and simply rebuild the whole line when the tags change, rather than trying to incrementally edit 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 Yes, that's true. I could pad out the date to keep this backwards compatible, but since all of the other fields are variable width, I think I'd rather switch to the variable size date field and just mention this in the news. > 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)