-
-
Save notmgsk/827d973da06ca5120df280a30fcc1061 to your computer and use it in GitHub Desktop.
`M-.` style jumping from mu4e-message-view buffers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; | |
;; jump to thing on M-. | |
;; | |
(defun mu4e-jump-to-thing (u) | |
"jump to thing under point (should work with addresses, dates, tags)" | |
(interactive "P") | |
(let* | |
((type (string-remove-suffix ":" (first (split-string (thing-at-point 'line))))) | |
(query (pcase type | |
("From" (concat "contact:" (get-text-property (point) 'email))) | |
("To" (concat "contact:" (get-text-property (point) 'email))) | |
("Subject" (concat "subject:" (thing-at-point 'sentence)) ) | |
("Flags" (concat "flag:" (thing-at-point 'word))) | |
("Date" (concat "date:" (format-time-string "%Y%m%d" | |
(mu4e-message-field mu4e~view-msg :date)))) | |
("Maildir" (concat "maildir:" (thing-at-point 'filename))) | |
("Tags" (concat "tag:" (thing-at-point 'word))) | |
("List" (concat "list:" (thing-at-point 'sentence))) | |
(other "")))) | |
(progn | |
(mu4e-headers-search query nil u)))) | |
(eval-after-load 'mu4e-view | |
'(define-key mu4e-view-mode-map (kbd "M-.") 'mu4e-jump-to-thing)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment