mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
emacs: Use pcase in notmuch-search-insert-field
Rather than lots of string-equal calls, use the pcase macro.
This commit is contained in:
parent
b03b0d4e41
commit
071fb57a35
1 changed files with 20 additions and 20 deletions
|
@ -833,26 +833,26 @@ non-authors is found, assume that all of the authors match."
|
||||||
(insert padding))))
|
(insert padding))))
|
||||||
|
|
||||||
(defun notmuch-search-insert-field (field format-string result)
|
(defun notmuch-search-insert-field (field format-string result)
|
||||||
(cond
|
(pcase field
|
||||||
((string-equal field "date")
|
("date"
|
||||||
(insert (propertize (format format-string (plist-get result :date_relative))
|
(insert (propertize (format format-string (plist-get result :date_relative))
|
||||||
'face 'notmuch-search-date)))
|
'face 'notmuch-search-date)))
|
||||||
((string-equal field "count")
|
("count"
|
||||||
(insert (propertize (format format-string
|
(insert (propertize (format format-string
|
||||||
(format "[%s/%s]" (plist-get result :matched)
|
(format "[%s/%s]" (plist-get result :matched)
|
||||||
(plist-get result :total)))
|
(plist-get result :total)))
|
||||||
'face 'notmuch-search-count)))
|
'face 'notmuch-search-count)))
|
||||||
((string-equal field "subject")
|
("subject"
|
||||||
(insert (propertize (format format-string
|
(insert (propertize (format format-string
|
||||||
(notmuch-sanitize (plist-get result :subject)))
|
(notmuch-sanitize (plist-get result :subject)))
|
||||||
'face 'notmuch-search-subject)))
|
'face 'notmuch-search-subject)))
|
||||||
((string-equal field "authors")
|
("authors"
|
||||||
(notmuch-search-insert-authors
|
(notmuch-search-insert-authors format-string
|
||||||
format-string (notmuch-sanitize (plist-get result :authors))))
|
(notmuch-sanitize (plist-get result :authors))))
|
||||||
((string-equal field "tags")
|
("tags"
|
||||||
(let ((tags (plist-get result :tags))
|
(let ((tags (plist-get result :tags))
|
||||||
(orig-tags (plist-get result :orig-tags)))
|
(orig-tags (plist-get result :orig-tags)))
|
||||||
(insert (format format-string (notmuch-tag-format-tags tags orig-tags)))))))
|
(insert (format format-string (notmuch-tag-format-tags tags orig-tags)))))))
|
||||||
|
|
||||||
(defun notmuch-search-show-result (result pos)
|
(defun notmuch-search-show-result (result pos)
|
||||||
"Insert RESULT at POS."
|
"Insert RESULT at POS."
|
||||||
|
|
Loading…
Reference in a new issue