mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-02-17 23:53:15 +01:00
emacs: Clean up notmuch-search-show-result
This simplifies the code and makes it no longer cubic in the number of result fields.
This commit is contained in:
parent
898128b9f4
commit
bbc74d98f5
1 changed files with 10 additions and 9 deletions
|
@ -707,29 +707,30 @@ non-authors is found, assume that all of the authors match."
|
||||||
(overlay-put overlay 'isearch-open-invisible #'delete-overlay)))
|
(overlay-put overlay 'isearch-open-invisible #'delete-overlay)))
|
||||||
(insert padding))))
|
(insert padding))))
|
||||||
|
|
||||||
(defun notmuch-search-insert-field (field date count authors subject tags)
|
(defun notmuch-search-insert-field (field format-string date count authors subject tags)
|
||||||
(cond
|
(cond
|
||||||
((string-equal field "date")
|
((string-equal field "date")
|
||||||
(insert (propertize (format (cdr (assoc field notmuch-search-result-format)) date)
|
(insert (propertize (format format-string date)
|
||||||
'face 'notmuch-search-date)))
|
'face 'notmuch-search-date)))
|
||||||
((string-equal field "count")
|
((string-equal field "count")
|
||||||
(insert (propertize (format (cdr (assoc field notmuch-search-result-format)) count)
|
(insert (propertize (format format-string count)
|
||||||
'face 'notmuch-search-count)))
|
'face 'notmuch-search-count)))
|
||||||
((string-equal field "subject")
|
((string-equal field "subject")
|
||||||
(insert (propertize (format (cdr (assoc field notmuch-search-result-format)) subject)
|
(insert (propertize (format format-string subject)
|
||||||
'face 'notmuch-search-subject)))
|
'face 'notmuch-search-subject)))
|
||||||
|
|
||||||
((string-equal field "authors")
|
((string-equal field "authors")
|
||||||
(notmuch-search-insert-authors (cdr (assoc field notmuch-search-result-format)) authors))
|
(notmuch-search-insert-authors format-string authors))
|
||||||
|
|
||||||
((string-equal field "tags")
|
((string-equal field "tags")
|
||||||
|
;; Ignore format-string here because notmuch-search-set-tags
|
||||||
|
;; depends on the format of this
|
||||||
(insert (concat "(" (propertize tags 'font-lock-face 'notmuch-tag-face) ")")))))
|
(insert (concat "(" (propertize tags 'font-lock-face 'notmuch-tag-face) ")")))))
|
||||||
|
|
||||||
(defun notmuch-search-show-result (date count authors subject tags)
|
(defun notmuch-search-show-result (date count authors subject tags)
|
||||||
(let ((fields) (field))
|
(dolist (spec notmuch-search-result-format)
|
||||||
(setq fields (mapcar 'car notmuch-search-result-format))
|
(notmuch-search-insert-field (car spec) (cdr spec)
|
||||||
(loop for field in fields
|
date count authors subject tags))
|
||||||
do (notmuch-search-insert-field field date count authors subject tags)))
|
|
||||||
(insert "\n"))
|
(insert "\n"))
|
||||||
|
|
||||||
(defun notmuch-search-process-filter (proc string)
|
(defun notmuch-search-process-filter (proc string)
|
||||||
|
|
Loading…
Add table
Reference in a new issue