As another example, suppose we would like to search for messages by the sender of the message at point:
(defun search-for-sender (msg) "Search for messages sent by the sender of the message at point." (mu4e-headers-search (concat "from:" (cdar (mu4e-message-field msg :from))))) ;; define 'x' as the shortcut (add-to-list 'mu4e-view-actions '("xsearch for sender" . search-for-sender) t)
If you wonder why we use
cdar, remember that the From:-field is a list
(NAME . EMAIL) cells; thus,
cdar gets us the e-mail address of the
first in the list. From:-fields rarely contain multiple cells.