From 09f5baf3eb3f25d4981b9bd3bcc37a1d9a206abc Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Sat, 14 Jul 2012 23:43:24 +2000 Subject: [PATCH] [PATCH v2 5/7] emacs: Replace other search text properties with result property --- 30/e934e55cdf7d2e114c424eebe694011fca24c8 | 149 ++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 30/e934e55cdf7d2e114c424eebe694011fca24c8 diff --git a/30/e934e55cdf7d2e114c424eebe694011fca24c8 b/30/e934e55cdf7d2e114c424eebe694011fca24c8 new file mode 100644 index 000000000..aab5ad1cd --- /dev/null +++ b/30/e934e55cdf7d2e114c424eebe694011fca24c8 @@ -0,0 +1,149 @@ +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 B52BF41ED7D + for ; Fri, 13 Jul 2012 20:43:45 -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 fC1f7uoRmuTw for ; + Fri, 13 Jul 2012 20:43:44 -0700 (PDT) +Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU + [18.9.25.15]) + by olra.theworths.org (Postfix) with ESMTP id 1B265421192 + for ; Fri, 13 Jul 2012 20:43:40 -0700 (PDT) +X-AuditID: 1209190f-b7f306d0000008b4-3a-5000eaebd701 +Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) + by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP + id 63.93.02228.BEAE0005; Fri, 13 Jul 2012 23:43:39 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q6E3hcSd014753; + Fri, 13 Jul 2012 23:43:38 -0400 +Received: from drake.dyndns.org + (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com + [209.6.116.242]) (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6E3hbAK021331 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Fri, 13 Jul 2012 23:43:38 -0400 (EDT) +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1SptGa-0000a5-SV; Fri, 13 Jul 2012 23:43:36 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v2 5/7] emacs: Replace other search text properties with + result property +Date: Fri, 13 Jul 2012 23:43:24 -0400 +Message-Id: <1342237406-32507-6-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: <1342237406-32507-1-git-send-email-amdragon@mit.edu> +References: <1342140319-19859-1-git-send-email-amdragon@mit.edu> + <1342237406-32507-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsUixG6novv6FUOAwZTJEhar5/JYXL85k9mB + yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgypjyfiV7wSvJio0vVrE1MF4U7WLk4JAQMJE4 + doyxi5ETyBSTuHBvPVsXIxeHkMA+Rokdl+6yQzgbGCU2Nc2Ach4xSSy69ogZwpnLKDHnwnMW + kH42AQ2JbfuXg80SEZCW2Hl3NiuIzSzgKPF5/yI2EFtYIELi5d6tYDaLgKrEog0PwHp5BRwk + nh1aBXWHvMTT+31gNZxAvW29t8HiQgLlEte/rWGawMi/gJFhFaNsSm6Vbm5iZk5xarJucXJi + Xl5qka6JXm5miV5qSukmRlAgcUry72D8dlDpEKMAB6MSD2+GP0OAEGtiWXFl7iFGSQ4mJVFe + XmAYCvEl5adUZiQWZ8QXleakFh9ilOBgVhLhNW8DyvGmJFZWpRblw6SkOViUxHmvptz0FxJI + TyxJzU5NLUgtgsnKcHAoSfAKgwwVLEpNT61Iy8wpQUgzcXCCDOcBGi4NUsNbXJCYW5yZDpE/ + xagoJc5rB5IQAElklObB9cIi/RWjONArwrw2IFU8wCQB1/0KaDAT0OBZP//5Aw0uSURISTUw + dnbNtDoqz5R5iiXcImbvjQ8TufUNVhg9kb0eY/2r9KDIi72Rnx6e890Y063bxv/wvruHauDm + NUz3DDn3TJA7/m/75uKw/SwHF2quNL19JPeoi07D+7mm/y4/mn6YRWz6fEdRNdnfYjV5th+O + lx7Oc9todeHoy16eraE749qqFn4OyV7ttlmqUomlOCPRUIu5qDgRAMTwXM7PAgAA +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: Sat, 14 Jul 2012 03:43:46 -0000 + +Since the result object contains everything that the other text +properties recorded, we can remove the other text properties and +simply look in the plist of the appropriate result object. +--- + emacs/notmuch.el | 24 ++++++++++-------------- + 1 file changed, 10 insertions(+), 14 deletions(-) + +diff --git a/emacs/notmuch.el b/emacs/notmuch.el +index 92ba2c1..9e061b6 100644 +--- a/emacs/notmuch.el ++++ b/emacs/notmuch.el +@@ -452,16 +452,18 @@ current result." + (defun notmuch-search-properties-in-region (property beg end) + (let (output) + (notmuch-search-do-results beg end pos +- (push (get-text-property pos property) output)) ++ (push (plist-get (notmuch-search-get-result pos) property) output)) + output)) + + (defun notmuch-search-find-thread-id () + "Return the thread for the current thread" +- (get-text-property (point) 'notmuch-search-thread-id)) ++ (let ((thread (plist-get (notmuch-search-get-result) :thread))) ++ (when thread (concat "thread:" thread)))) + + (defun notmuch-search-find-thread-id-region (beg end) + "Return a list of threads for the current region" +- (notmuch-search-properties-in-region 'notmuch-search-thread-id beg end)) ++ (mapcar (lambda (thread) (concat "thread:" thread)) ++ (notmuch-search-properties-in-region :thread beg end))) + + (defun notmuch-search-find-thread-id-region-search (beg end) + "Return a search string for threads for the current region" +@@ -469,19 +471,19 @@ current result." + + (defun notmuch-search-find-authors () + "Return the authors for the current thread" +- (get-text-property (point) 'notmuch-search-authors)) ++ (plist-get (notmuch-search-get-result) :authors)) + + (defun notmuch-search-find-authors-region (beg end) + "Return a list of authors for the current region" +- (notmuch-search-properties-in-region 'notmuch-search-authors beg end)) ++ (notmuch-search-properties-in-region :authors beg end)) + + (defun notmuch-search-find-subject () + "Return the subject for the current thread" +- (get-text-property (point) 'notmuch-search-subject)) ++ (plist-get (notmuch-search-get-result) :subject)) + + (defun notmuch-search-find-subject-region (beg end) + "Return a list of authors for the current region" +- (notmuch-search-properties-in-region 'notmuch-search-subject beg end)) ++ (notmuch-search-properties-in-region :subject beg end)) + + (defun notmuch-search-show-thread () + "Display the currently selected thread." +@@ -774,13 +776,7 @@ non-authors is found, assume that all of the authors match." + (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) +- (put-text-property beg (point) 'notmuch-search-thread-id +- (concat "thread:" (plist-get result :thread))) +- (put-text-property beg (point) 'notmuch-search-authors +- (plist-get result :authors)) +- (put-text-property beg (point) 'notmuch-search-subject +- (plist-get result :subject))) ++ (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))))) +-- +1.7.10 + -- 2.26.2