From: Austin Clements Date: Sat, 14 Jul 2012 23:02:17 +0000 (+2000) Subject: [PATCH v3 5/8] emacs: Replace other search text properties with result property X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=35265d0ad33014dbc763b45906eaa2d56d832c7c;p=notmuch-archives.git [PATCH v3 5/8] emacs: Replace other search text properties with result property --- diff --git a/e3/1ccc53656631f4a9f217e7413f11fc3bfc025c b/e3/1ccc53656631f4a9f217e7413f11fc3bfc025c new file mode 100644 index 000000000..a932d1e4c --- /dev/null +++ b/e3/1ccc53656631f4a9f217e7413f11fc3bfc025c @@ -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 2CA68429E4E + for ; Sat, 14 Jul 2012 16:02:30 -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 Aez32YVW5sxL for ; + Sat, 14 Jul 2012 16:02:28 -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 B32B7431E62 + for ; Sat, 14 Jul 2012 16:02:26 -0700 (PDT) +X-AuditID: 1209190d-b7fd56d000000933-f7-5001fa8229f3 +Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) + by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP + id F9.3C.02355.28AF1005; Sat, 14 Jul 2012 19:02:26 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q6EN2PR8015444; + Sat, 14 Jul 2012 19:02:25 -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 q6EN2Ow3008497 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Sat, 14 Jul 2012 19:02:25 -0400 (EDT) +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1SqBLz-0002GD-VQ; Sat, 14 Jul 2012 19:02:23 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v3 5/8] emacs: Replace other search text properties with + result property +Date: Sat, 14 Jul 2012 19:02:17 -0400 +Message-Id: <1342306940-7499-6-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: <1342306940-7499-1-git-send-email-amdragon@mit.edu> +References: <1342140319-19859-1-git-send-email-amdragon@mit.edu> + <1342306940-7499-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsUixCmqrNv0izHAYM8edos9+7wsVs/lsbh+ + cyazA7PH3dNcHjtn3WX3eLbqFnMAcxSXTUpqTmZZapG+XQJXxpPLX9kLFklWTDpxnqmBcbJo + FyMnh4SAicS5nYfZIGwxiQv31gPZXBxCAvsYJb53fWWFcDYwSmxqboPKPGKSePRzGTOEM5dR + 4nf/eXaQfjYBDYlt+5czgtgiAtISO+/OZgWxmQXSJL63vwWLCwtESOxetZ8ZxGYRUJX4vfAK + WA2vgL3E2XnXoe6Ql3h6vw/M5hRwkDh84QRYjZBAmcSNJ99ZJzDyL2BkWMUom5JbpZubmJlT + nJqsW5ycmJeXWqRrpJebWaKXmlK6iREcWpK8OxjfHVQ6xCjAwajEw5vqzxAgxJpYVlyZe4hR + koNJSZT39U/GACG+pPyUyozE4oz4otKc1OJDjBIczEoivBJfgXK8KYmVValF+TApaQ4WJXHe + Kyk3/YUE0hNLUrNTUwtSi2CyMhwcShK8hSBDBYtS01Mr0jJzShDSTBycIMN5gIafBKnhLS5I + zC3OTIfIn2JUlBLn7QVJCIAkMkrz4Hphsf+KURzoFWHepSBVPMC0Adf9CmgwE9DgWT//+QMN + LklESEk1MJbpnz6nfKosPvVXULJDjf5GBeMTHWk31gZqN/005+NMuN0csaPqiojwxX3H5zus + nSuxjHWN2XmBGXP3/dipaDp/xmGTKpfkS4wmsoLSpRtS1nSLJ6dNmGw250PW0hVx/zffyzrD + 8qIrRP+D7M2/yrmbr93f5iFX1j+bJcn8zeMT+dIMd7U8WpVYijMSDbWYi4oTAY8DHqDYAgAA +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 23:02:30 -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 49367e0..8590529 100644 +--- a/emacs/notmuch.el ++++ b/emacs/notmuch.el +@@ -465,16 +465,18 @@ BEG." + (let (output) + (notmuch-search-foreach-result beg end + (lambda (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" +@@ -482,19 +484,19 @@ BEG." + + (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." +@@ -789,13 +791,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 +