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 5A0E141ED71 for ; Thu, 12 Jul 2012 17:45:37 -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 mzoeOtVCSWmF for ; Thu, 12 Jul 2012 17:45:35 -0700 (PDT) Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU [18.9.25.14]) by olra.theworths.org (Postfix) with ESMTP id 99E8741ED73 for ; Thu, 12 Jul 2012 17:45:30 -0700 (PDT) X-AuditID: 1209190e-b7fb56d0000008b2-f6-4fff6faa1f4d Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP id 91.51.02226.AAF6FFF4; Thu, 12 Jul 2012 20:45:30 -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 q6D0jU8B010246; Thu, 12 Jul 2012 20:45:30 -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 q6D0jSC7010704 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Thu, 12 Jul 2012 20:45:29 -0400 (EDT) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1SpU0e-0005S5-LG; Thu, 12 Jul 2012 20:45:28 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 5/7] emacs: Replace other search text properties with result property Date: Thu, 12 Jul 2012 20:45:17 -0400 Message-Id: <1342140319-19859-6-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1342140319-19859-1-git-send-email-amdragon@mit.edu> References: <1342140319-19859-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsUixG6norsq/7+/wckGbovrN2cyOzB6PFt1 izmAMYrLJiU1J7MstUjfLoErY+XjR6wFryQr5my6wtzAeFG0i5GDQ0LAROLOFekuRk4gU0zi wr31bCC2kMA+Rol3tyW7GLmA7A2MEoen9zBCOI+YJG7c6mGCcOYySlz838EI0sImoCGxbf9y MFtEQFpi593ZrCAbmAXUJP50qYCEhQVCJdY+ugBWwiKgKnG+5QiYzSvgIPGlaQsTxBXyEk/v 94FdwSngKLHhywVWiIscJBqPzWSewMi/gJFhFaNsSm6Vbm5iZk5xarJucXJiXl5qka6xXm5m iV5qSukmRlDIcEry7WD8elDpEKMAB6MSD+/v2P/+QqyJZcWVuYcYJTmYlER5XbKBQnxJ+SmV GYnFGfFFpTmpxYcYJTiYlUR419kD5XhTEiurUovyYVLSHCxK4rxXUm76CwmkJ5akZqemFqQW wWRlODiUJHg5gbEhJFiUmp5akZaZU4KQZuLgBBnOAzR8Wx7I8OKCxNzizHSI/ClGRSlx3gsg CQGQREZpHlwvLKZfMYoDvSLMuxOkigeYDuC6XwENZgIaPOvnP5DBJYkIKakGxugThw9tP/Ey Iun7/Sh1r+8rjtrMvMG7wCVf8doc17Vxrlk/Z7L2iMj4zGR7fVBtu873a447ujf+FlDQy2d6 F/J08qGPjBvrFri9FG/U/ezSsP6758NFeZbqSaoLftjET7TXyF0TGMu2V+b6bIkVWb8sdi2f dc/i0/x3SXcOaCos8ck8dCB3ma4SS3FGoqEWc1FxIgAza16fxAIAAA== 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, 13 Jul 2012 00:45:37 -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 3f72427..a5cf0dc 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." @@ -769,13 +771,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