From 9d678cf19f3f54006815970b952c0c87f184a020 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Fri, 6 Jul 2012 16:52:20 +2000 Subject: [PATCH] [PATCH v2 2/9] emacs: Separate search line parsing and display --- 76/f9a722ae4dd1e30d5da281fdb7c94cb33709bd | 136 ++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 76/f9a722ae4dd1e30d5da281fdb7c94cb33709bd diff --git a/76/f9a722ae4dd1e30d5da281fdb7c94cb33709bd b/76/f9a722ae4dd1e30d5da281fdb7c94cb33709bd new file mode 100644 index 000000000..f33a049c1 --- /dev/null +++ b/76/f9a722ae4dd1e30d5da281fdb7c94cb33709bd @@ -0,0 +1,136 @@ +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 88B39431FC2 + for ; Thu, 5 Jul 2012 13:52:48 -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 4GDSbmNaQWib for ; + Thu, 5 Jul 2012 13:52:47 -0700 (PDT) +Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU + [18.7.68.37]) + by olra.theworths.org (Postfix) with ESMTP id B824B431FC7 + for ; Thu, 5 Jul 2012 13:52:43 -0700 (PDT) +X-AuditID: 12074425-b7f9b6d0000008c4-88-4ff5fe9b6b2d +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP + id 1E.07.02244.B9EF5FF4; Thu, 5 Jul 2012 16:52:43 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q65Kqgv1011303; + Thu, 5 Jul 2012 16:52:42 -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 q65KqbmT027235 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Thu, 5 Jul 2012 16:52:39 -0400 (EDT) +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1Smt2T-0004XX-HV; Thu, 05 Jul 2012 16:52:37 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v2 2/9] emacs: Separate search line parsing and display +Date: Thu, 5 Jul 2012 16:52:20 -0400 +Message-Id: <1341521547-15502-3-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: <1341521547-15502-1-git-send-email-amdragon@mit.edu> +References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> + <1341521547-15502-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsUixCmqrTv731d/g6ZlIhar5/JYXL85k9ni + zcp5rA7MHjtn3WX3OPx1IYvHs1W3mAOYo7hsUlJzMstSi/TtErgyrv/YylawS7zi0PYjrA2M + L4W6GDk5JARMJHZcP8YOYYtJXLi3nq2LkYtDSGAfo8SlEx1MEM56Rolrc9YzQjgnmSQeHLnP + DuHMZZRo/tzEBtLPJqAhsW3/ckYQW0RAWmLn3dmsIDazQJzElin/weLCAu4S1+/1AcU5OFgE + VCUe7bcAMXkFHCR+bhKBuEJe4un9PrCJnAKOEhcmLgbrFBIol/iz5B/LBEb+BYwMqxhlU3Kr + dHMTM3OKU5N1i5MT8/JSi3Qt9HIzS/RSU0o3MYJCi91FdQfjhENKhxgFOBiVeHiNcr/4C7Em + lhVX5h5ilORgUhLlbfz91V+ILyk/pTIjsTgjvqg0J7X4EKMEB7OSCG9vBlCONyWxsiq1KB8m + Jc3BoiTOeyPlpr+QQHpiSWp2ampBahFMVoaDQ0mC9+lfoEbBotT01Iq0zJwShDQTByfIcB6g + 4S9AaniLCxJzizPTIfKnGBWlxHmvgyQEQBIZpXlwvbDYf8UoDvSKMO8nkCoeYNqA634FNJgJ + aHDe4k8gg0sSEVJSDYyHDd24n+xVzdhZH9gisDl0oZmrvtaZx39+qydec/qxofTwIl+Xf0Hf + aw22yi3s5BeoYleLc54oKVDywF7qSfwm4WbtaXJbWVe+7RZedsJ8caxsn8SBcwvnftDuObr7 + 15mPzjb7rijrJf1WdZ8h9qdfVTFH1r/Edy/j3vXrq9ZKuM09d/3BhTlKLMUZiYZazEXFiQBK + 402j2AIAAA== +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: Thu, 05 Jul 2012 20:52:48 -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 + -- 2.26.2