From: Mark Walters Date: Wed, 19 Feb 2014 20:20:11 +0000 (+0000) Subject: [PATCH v2 6/7] emacs: search: use orig-tags in search X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=edc7b92051b40f4d27b181c983f58d9f67631b1e;p=notmuch-archives.git [PATCH v2 6/7] emacs: search: use orig-tags in search --- diff --git a/7a/0d52eeddba2c49c08560c949dbef94301de4d1 b/7a/0d52eeddba2c49c08560c949dbef94301de4d1 new file mode 100644 index 000000000..a8799c5f7 --- /dev/null +++ b/7a/0d52eeddba2c49c08560c949dbef94301de4d1 @@ -0,0 +1,135 @@ +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 9B05F429E29 + for ; Wed, 19 Feb 2014 12:20:59 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + 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 fZ0hQbfCUiTy for ; + Wed, 19 Feb 2014 12:20:54 -0800 (PST) +Received: from mail-we0-f175.google.com (mail-we0-f175.google.com + [74.125.82.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 9CE34431FD6 + for ; Wed, 19 Feb 2014 12:20:42 -0800 (PST) +Received: by mail-we0-f175.google.com with SMTP id q59so755199wes.20 + for ; Wed, 19 Feb 2014 12:20:41 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=BS4YuF+JhlxmG7PCK2TmAJvuRPC1Zb1+hBTbJdB1wwo=; + b=qpzyxfI35AuPKZ+DXbVLLc/U8cuOs7P4aVWuHpXwYQJaIp455yiSlrDjGFZJn980Sz + PE4XjqK7EQu7i6Sxuh68AEFT6LQTKeOysL01rQYMai6L/6nH5mcB77xzsVtwpGWbbRZ4 + Ci2AG5XoM+BLRkCBMNK+NP9kzJuVo5G4aS00FK4Fi5Q5+eLAIbO9UDd10maKIfCDL2T4 + 2TkTdoIHNApSlNyLzJ6NlS62mhiy6TRt9p+6nEXAargmrL4Ka0U+q9qUSNghNMd5OaNC + /XHMqF+S2k/ghbP06sL83axREUk1SnE1xADmwT7zPUamvkBtL9/Bquu8WeN4iyjfKx5Z + NKIg== +X-Received: by 10.180.107.136 with SMTP id hc8mr3428001wib.11.1392841241449; + Wed, 19 Feb 2014 12:20:41 -0800 (PST) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPSA id ee5sm4677221wib.8.2014.02.19.12.20.40 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Wed, 19 Feb 2014 12:20:40 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v2 6/7] emacs: search: use orig-tags in search +Date: Wed, 19 Feb 2014 20:20:11 +0000 +Message-Id: <1392841212-8494-7-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1392841212-8494-1-git-send-email-markwalters1009@gmail.com> +References: <1392841212-8494-1-git-send-email-markwalters1009@gmail.com> +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, 19 Feb 2014 20:20:59 -0000 + +This uses the recent functionality to show the tag changes in the +search buffer. Currently this is only used to show changes the search +buffer makes itself: i.e., it does not make display any changes +reflecting tagging done by other notmuch-buffers. +--- + emacs/notmuch.el | 40 ++++++++++++++++++++++++---------------- + 1 files changed, 24 insertions(+), 16 deletions(-) + +diff --git a/emacs/notmuch.el b/emacs/notmuch.el +index 04587c0..d8aef27 100644 +--- a/emacs/notmuch.el ++++ b/emacs/notmuch.el +@@ -753,24 +753,32 @@ non-authors is found, assume that all of the authors match." + format-string (notmuch-sanitize (plist-get result :authors)))) + + ((string-equal field "tags") +- (let ((tags (plist-get result :tags))) +- (insert (format format-string (notmuch-tag-format-tags tags tags))))))) ++ (let ((tags (plist-get result :tags)) ++ (orig-tags (plist-get result :orig-tags))) ++ (insert (format format-string (notmuch-tag-format-tags tags orig-tags))))))) + +-(defun notmuch-search-show-result (result &optional pos) +- "Insert RESULT at POS or the end of the buffer if POS is null." ++(defun notmuch-search-show-result (result beg) ++ "Insert RESULT at BEG." + ;; Ignore excluded matches + (unless (= (plist-get result :matched) 0) +- (let ((beg (or pos (point-max)))) +- (save-excursion +- (goto-char beg) +- (dolist (spec notmuch-search-result-format) +- (notmuch-search-insert-field (car spec) (cdr spec) result)) +- (insert "\n") +- (notmuch-search-color-line beg (point) (plist-get result :tags)) +- (put-text-property beg (point) 'notmuch-search-result result)) +- (when (string= (plist-get result :thread) notmuch-search-target-thread) +- (setq notmuch-search-target-thread "found") +- (goto-char beg))))) ++ (save-excursion ++ (goto-char beg) ++ (dolist (spec notmuch-search-result-format) ++ (notmuch-search-insert-field (car spec) (cdr spec) result)) ++ (insert "\n") ++ (notmuch-search-color-line beg (point) (plist-get result :tags)) ++ (put-text-property beg (point) 'notmuch-search-result result)) ++ (when (string= (plist-get result :thread) notmuch-search-target-thread) ++ (setq notmuch-search-target-thread "found") ++ (goto-char beg)))) ++ ++(defun notmuch-search-append-result (result) ++ "Insert RESULT at the end of the buffer. ++ ++This is only called when a result is first inserted so it also ++sets the :orig-tag property." ++ (let ((new-result (plist-put result :orig-tags (plist-get result :tags)))) ++ (notmuch-search-show-result new-result (point-max)))) + + (defun notmuch-search-process-filter (proc string) + "Process and filter the output of \"notmuch search\"" +@@ -784,7 +792,7 @@ non-authors is found, assume that all of the authors match." + (save-excursion + (goto-char (point-max)) + (insert string)) +- (notmuch-sexp-parse-partial-list 'notmuch-search-show-result ++ (notmuch-sexp-parse-partial-list 'notmuch-search-append-result + results-buf))))) + + (defun notmuch-search-tag-all (tag-changes) +-- +1.7.9.1 +