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 6723D431FBF for ; Mon, 9 Jul 2012 14:42:50 -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 bc5b8DVljDup for ; Mon, 9 Jul 2012 14:42:49 -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 52D06431FAE for ; Mon, 9 Jul 2012 14:42:49 -0700 (PDT) X-AuditID: 1209190d-b7fd56d000000933-8f-4ffb505852b5 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP id 58.19.02355.8505BFF4; Mon, 9 Jul 2012 17:42:48 -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 q69LglVv006999; Mon, 9 Jul 2012 17:42:47 -0400 Received: from drake.dyndns.org (26-4-176.dynamic.csail.mit.edu [18.26.4.176]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q69Lgib6022683 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Mon, 9 Jul 2012 17:42:45 -0400 (EDT) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1SoLjA-0004fr-01; Mon, 09 Jul 2012 17:42:43 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v3 2/9] emacs: Separate search line parsing and display Date: Mon, 9 Jul 2012 17:42:35 -0400 Message-Id: <1341870162-17782-3-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1341870162-17782-1-git-send-email-amdragon@mit.edu> References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> <1341870162-17782-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOIsWRmVeSWpSXmKPExsUixG6nrhsR8Nvf4NhTDYvVc3ksrt+cyWzx ZuU8Vgdmj52z7rJ7HP66kMXj2apbzAHMUVw2Kak5mWWpRfp2CVwZ139sZSvYJV5xaPsR1gbG l0JdjJwcEgImEq2vNrJC2GISF+6tZ+ti5OIQEtjHKHFg60xWCGc9o8T2/a+hnJNMElfOP4Vy 5jJKrGjYxQLSzyagIbFt/3JGEFtEQFpi593ZYHOZBeIktkz5DxYXFnCXWL96NRuIzSKgKjFz +W+wXl4BB4kj/7ZB3SEv8fR+H1gNp4CjxJybO8B6hQTKJT7f+Mc8gZF/ASPDKkbZlNwq3dzE zJzi1GTd4uTEvLzUIl0jvdzMEr3UlNJNjKDw4pTk3cH47qDSIUYBDkYlHt4opt/+QqyJZcWV uYcYJTmYlER58zyBQnxJ+SmVGYnFGfFFpTmpxYcYJTiYlUR4b7kC5XhTEiurUovyYVLSHCxK 4rxXUm76CwmkJ5akZqemFqQWwWRlODiUJHin+QM1ChalpqdWpGXmlCCkmTg4QYbzAA2fAFLD W1yQmFucmQ6RP8WoKCXOOxkkIQCSyCjNg+uFxf8rRnGgV4R5d4BU8QBTB1z3K6DBTECD23t+ gQwuSURISTUwLspwcJaNtpN4nugvf94n8u1DQ98vT4Qc3k9JL7sYbBZ31+NOwZ/vEadsOWW+ O69/tzuz++U5JdZ3/TKNPO9SNUoPveloCTdr2ZMmUM8c+EwiSE4+TGGaftV7ix9qb7Yub7CT K3KTCzzW+erxGacl6do6AUd+z1vo0GGkrt23rK4/x0smRE6JpTgj0VCLuag4EQBgJYcR2gIA AA== 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: Mon, 09 Jul 2012 21:42:50 -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 8ad0b68..746d0cb 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -727,11 +727,19 @@ non-authors is found, assume that all of the authors match." ;; depends on the format of this (insert (concat "(" (propertize tags 'font-lock-face 'notmuch-tag-face) ")"))))) -(defun notmuch-search-show-result (date count authors subject tags) - (dolist (spec notmuch-search-result-format) - (notmuch-search-insert-field (car spec) (cdr spec) - 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 (spec notmuch-search-result-format) + (notmuch-search-insert-field (car spec) (cdr spec) + 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\"" @@ -759,17 +767,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