From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1A71C431FC7 for ; Sat, 21 Jul 2012 10:37:25 -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 ys1EGiQf1q9O for ; Sat, 21 Jul 2012 10:37:23 -0700 (PDT) Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU [18.7.68.34]) by olra.theworths.org (Postfix) with ESMTP id 2F8B2431FC4 for ; Sat, 21 Jul 2012 10:37:20 -0700 (PDT) X-AuditID: 12074422-b7f1f6d00000090b-97-500ae8ce1e6c Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP id DF.D1.02315.EC8EA005; Sat, 21 Jul 2012 13:37:18 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q6LHbHl6026352; Sat, 21 Jul 2012 13:37:17 -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 q6LHbFue008017 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 21 Jul 2012 13:37:16 -0400 (EDT) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1SsdcB-0001Zo-D9; Sat, 21 Jul 2012 13:37:15 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v4 5/8] emacs: Replace other search text properties with result property Date: Sat, 21 Jul 2012 13:37:09 -0400 Message-Id: <1342892232-5659-6-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1342892232-5659-1-git-send-email-amdragon@mit.edu> References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> <1342892232-5659-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsUixG6nrnvuBVeAwdaHShZ79nlZrJ7LY3H9 5kxmB2aPu6e5PHbOusvu8WzVLeYA5igum5TUnMyy1CJ9uwSujNf75zEXLJKs6F7+k7mBcbJo FyMnh4SAicSv//PYIWwxiQv31rN1MXJxCAnsY5T4eecFI4SzgVFixekVUJlHTBK3j+9lgXDm Mkpc7HnDBNLPJqAhsW3/ckYQW0RAWmLn3dmsIDazQJrE9/a3YHFhgQiJBc8egNWzCKhK9HZt BbN5BewlVp3axwpxh7zE0/t9bCA2p4CDxKOzB1hAbCGBMonFHYcZJzDyL2BkWMUom5JbpZub mJlTnJqsW5ycmJeXWqRrqpebWaKXmlK6iREcWi5KOxh/HlQ6xCjAwajEw+sxizNAiDWxrLgy 9xCjJAeTkihv332uACG+pPyUyozE4oz4otKc1OJDjBIczEoivJtOA+V4UxIrq1KL8mFS0hws SuK811Ju+gsJpCeWpGanphakFsFkZTg4lCR43YExJCRYlJqeWpGWmVOCkGbi4AQZzgM0XAyk hre4IDG3ODMdIn+KUVFKnNcOJCEAksgozYPrhcX+K0ZxoFeEeb89B6riAaYNuO5XQIOZgAZL Z4ENLklESEk1MDpMkI44unv6w7uH/A4rPvM/uEFdoPH92of2tdnsW5SiSg6tURP6XJHjNelC w/fWJ3r6PdnrhN4UPrg4lXNakopUreF7PmNb/pUN2Ycf8007dZiPI3nh52hByRdvD0YKM3Ye 3cQmEeMnXMwu5d6ccFwryOrj7hdHr326sfOil31suFLdWm/7fiWW4oxEQy3mouJEAPH2ws7Y AgAA 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, 21 Jul 2012 17:37:25 -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 f79d004..7180b9d 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." @@ -790,13 +792,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