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 72263431FC2 for ; Tue, 3 Jul 2012 15:21:18 -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 CQKy3Fx1JZ5Q for ; Tue, 3 Jul 2012 15:21:17 -0700 (PDT) Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU [18.9.25.13]) by olra.theworths.org (Postfix) with ESMTP id EE190431FD0 for ; Tue, 3 Jul 2012 15:21:06 -0700 (PDT) X-AuditID: 1209190d-b7fd56d000000933-d2-4ff37052ae2b Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP id 63.F1.02355.25073FF4; Tue, 3 Jul 2012 18:21:06 -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 q63ML46X010807; Tue, 3 Jul 2012 18:21:04 -0400 Received: from drake.dyndns.org (26-4-182.dynamic.csail.mit.edu [18.26.4.182]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q63ML19w023220 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Tue, 3 Jul 2012 18:21:02 -0400 (EDT) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1SmBSu-0007fM-W9; Tue, 03 Jul 2012 18:21:00 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 2/8] emacs: Separate search line parsing and display Date: Tue, 3 Jul 2012 18:20:53 -0400 Message-Id: <1341354059-29396-3-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1341354059-29396-1-git-send-email-amdragon@mit.edu> References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrPIsWRmVeSWpSXmKPExsUixG6nrhtU8NnfYP9rDosje2axWyw985/Z 4vrNmcwWb1bOY3Vg8dg56y67x+GvC1k8nq26xezR9GMxawBLFJdNSmpOZllqkb5dAlfGp70z 2QqWile8vvyBvYHxtlAXIweHhICJxOLfyV2MnECmmMSFe+vZuhi5OIQE9jFKnLnzkgXCWc8o 8X3/TXYI5ySTxMlt36CcuYwSV6+vZgHpZxPQkNi2fzkjiC0iIC2x8+5sVhCbWSBX4mzrYUaQ dcICLhIf7kuBmCwCqhKnj6aAVPAKOEh8/32IEeIKeYmn9/vYQGxOAUeJFTfPgk0XAqrZ9qGD dQIj/wJGhlWMsim5Vbq5iZk5xanJusXJiXl5qUW6Rnq5mSV6qSmlmxhB4cYpybuD8d1BpUOM AhyMSjy8iQqf/YVYE8uKK3MPMUpyMCmJ8l7JAwrxJeWnVGYkFmfEF5XmpBYfYpTgYFYS4V2d BJTjTUmsrEotyodJSXOwKInzXkm56S8kkJ5YkpqdmlqQWgSTleHgUJLgPZAP1ChYlJqeWpGW mVOCkGbi4AQZzgM0fBlIDW9xQWJucWY6RP4Uo6KUOO9OkIQASCKjNA+uF5YOXjGKA70izHsU pIoHmErgul8BDWYCGpy3+BPI4JJEhJRUA+PF/1c7RBfe9hP9Oyt7edzp5z+aQ0TzfApPfQ3R FpxXY8HgeZej/Y7UnO2h8+RWrxC/WtR/NWOixmLFJ0wC9z2n/vQLFiu/9VR8Qc0Zln0XeCYn STqqZ9euuLCt+9Sl2+oTSi4sX2Wodyq4Q75mubnOFk71JXF9fvHHv39+IWfN6rdoft2dvY5K LMUZiYZazEXFiQBXzuK04gIAAA== 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: Tue, 03 Jul 2012 22:21:18 -0000 Previously, much of the display of search lines was done in the same function that parsed the CLI's output. Now the parsing function only parses, and notmuch-search-show-result fully inserts the search result in the search buffer. --- emacs/notmuch.el | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index be217a2..dadc6d6 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -726,11 +726,19 @@ non-authors is found, assume that all of the authors match." (insert (format format (propertize tags 'font-lock-face 'notmuch-tag-face)))))) -(defun notmuch-search-show-result (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-show-result (thread-id date count authors subject tags) + ;; Ignore excluded matches + (unless (eq (aref count 1) ?0) + (let ((beg (point)) + (tags-str (mapconcat 'identity tags " "))) + (dolist (format notmuch-search-result-format) + (notmuch-search-insert-field (car format) (cdr format) + date count authors subject tags-str)) + (insert "\n") + (notmuch-search-color-line beg (point) tags) + (put-text-property beg (point) 'notmuch-search-thread-id thread-id) + (put-text-property beg (point) 'notmuch-search-authors authors) + (put-text-property beg (point) 'notmuch-search-subject subject)))) (defun notmuch-search-process-filter (proc string) "Process and filter the output of \"notmuch search\"" @@ -758,17 +766,10 @@ non-authors is found, assume that all of the authors match." (goto-char (point-max)) (if (/= (match-beginning 1) line) (insert (concat "Error: Unexpected output from notmuch search:\n" (substring string line (match-beginning 1)) "\n"))) - ;; We currently just throw away excluded matches. - (unless (eq (aref count 1) ?0) - (let ((beg (point))) - (notmuch-search-show-result date count authors subject tags) - (notmuch-search-color-line beg (point) tag-list) - (put-text-property beg (point) 'notmuch-search-thread-id thread-id) - (put-text-property beg (point) 'notmuch-search-authors authors) - (put-text-property beg (point) 'notmuch-search-subject subject) - (when (string= thread-id notmuch-search-target-thread) - (set 'found-target beg) - (set 'notmuch-search-target-thread "found")))) + (when (string= thread-id notmuch-search-target-thread) + (set 'found-target (point)) + (set 'notmuch-search-target-thread "found")) + (notmuch-search-show-result thread-id date count authors subject tag-list) (set 'line (match-end 0))) (set 'more nil) (while (and (< line (length string)) (= (elt string line) ?\n)) -- 1.7.10