From 0f0df79d7d6d125fcd614350e8a4ed49cdbb1ecf Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Fri, 14 Feb 2014 09:15:18 +0000 Subject: [PATCH] [WIP Patch 6/7] emacs: search: use orig-tags in search --- 66/851c013feaca6ad9b540a0b1e882edbe275eb0 | 136 ++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 66/851c013feaca6ad9b540a0b1e882edbe275eb0 diff --git a/66/851c013feaca6ad9b540a0b1e882edbe275eb0 b/66/851c013feaca6ad9b540a0b1e882edbe275eb0 new file mode 100644 index 000000000..04e0df432 --- /dev/null +++ b/66/851c013feaca6ad9b540a0b1e882edbe275eb0 @@ -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 4C7FC431FC3 + for ; Fri, 14 Feb 2014 01:15:58 -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 5yoPKUTCT1sO for ; + Fri, 14 Feb 2014 01:15:52 -0800 (PST) +Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com + [209.85.212.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id DA4C3431FAE + for ; Fri, 14 Feb 2014 01:15:36 -0800 (PST) +Received: by mail-wi0-f172.google.com with SMTP id e4so250829wiv.5 + for ; Fri, 14 Feb 2014 01:15:35 -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=jgTuoGDRLVGeqvCm1pXe6eINyEJNe87IgtL0xzTC82c=; + b=UZ06rYhGAkd0zL8UR5qYHbqnBrUg4h+b+lhXgJPbnbsB6YtqvnqQnbVa2VLK91H4+E + 0gtL/x3IKLbrHpjNq6+6LsBVVWa083ZpmJz7euPYp8a6QtEAEtG2TkjlkQcxLX5UeqXm + ITPq9MkPuMQ8ScbMa6KsAdPvYu7g8NCtVj/zMgtonBmni6XtDCJVfI/UA1/ZqCt0Nh+B + Le9cu4n4YNczTf+gZv8c2c2p+yQk8VV54qLL4DXOXB5kt+G7EOALnLLKZH9NE1h/BbB5 + ZGlbqM6Vd9W9K4azRguPjihDYDg6E3Vyir1xGt6fNL2SrTEqcmMFWBWaEUxQK1zhlRCb + i8xw== +X-Received: by 10.194.119.230 with SMTP id kx6mr3297974wjb.13.1392369335761; + Fri, 14 Feb 2014 01:15:35 -0800 (PST) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPSA id v6sm2462420wif.0.2014.02.14.01.15.35 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Fri, 14 Feb 2014 01:15:35 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org, + Austin Clements +Subject: [WIP Patch 6/7] emacs: search: use orig-tags in search +Date: Fri, 14 Feb 2014 09:15:18 +0000 +Message-Id: <1392369319-24508-7-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1392369319-24508-1-git-send-email-markwalters1009@gmail.com> +References: <1392369319-24508-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: Fri, 14 Feb 2014 09:15:58 -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 1436e5a..f07b216 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." ++ (plist-put result :orig-tags (plist-get result :tags)) ++ (notmuch-search-show-result 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 + -- 2.26.2