mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
emacs: Replace other search text properties with result property
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.
This commit is contained in:
parent
7ba5c86399
commit
e94b45112e
1 changed files with 10 additions and 14 deletions
|
@ -465,16 +465,18 @@ BEG."
|
||||||
(let (output)
|
(let (output)
|
||||||
(notmuch-search-foreach-result beg end
|
(notmuch-search-foreach-result beg end
|
||||||
(lambda (pos)
|
(lambda (pos)
|
||||||
(push (get-text-property pos property) output)))
|
(push (plist-get (notmuch-search-get-result pos) property) output)))
|
||||||
output))
|
output))
|
||||||
|
|
||||||
(defun notmuch-search-find-thread-id ()
|
(defun notmuch-search-find-thread-id ()
|
||||||
"Return the thread for the current thread"
|
"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)
|
(defun notmuch-search-find-thread-id-region (beg end)
|
||||||
"Return a list of threads for the current region"
|
"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)
|
(defun notmuch-search-find-thread-id-region-search (beg end)
|
||||||
"Return a search string for threads for the current region"
|
"Return a search string for threads for the current region"
|
||||||
|
@ -482,19 +484,19 @@ BEG."
|
||||||
|
|
||||||
(defun notmuch-search-find-authors ()
|
(defun notmuch-search-find-authors ()
|
||||||
"Return the authors for the current thread"
|
"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)
|
(defun notmuch-search-find-authors-region (beg end)
|
||||||
"Return a list of authors for the current region"
|
"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 ()
|
(defun notmuch-search-find-subject ()
|
||||||
"Return the subject for the current thread"
|
"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)
|
(defun notmuch-search-find-subject-region (beg end)
|
||||||
"Return a list of authors for the current region"
|
"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 ()
|
(defun notmuch-search-show-thread ()
|
||||||
"Display the currently selected 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))
|
(notmuch-search-insert-field (car spec) (cdr spec) result))
|
||||||
(insert "\n")
|
(insert "\n")
|
||||||
(notmuch-search-color-line beg (point) (plist-get result :tags))
|
(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-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)))
|
|
||||||
(when (string= (plist-get result :thread) notmuch-search-target-thread)
|
(when (string= (plist-get result :thread) notmuch-search-target-thread)
|
||||||
(setq notmuch-search-target-thread "found")
|
(setq notmuch-search-target-thread "found")
|
||||||
(goto-char beg)))))
|
(goto-char beg)))))
|
||||||
|
|
Loading…
Reference in a new issue