Skip to content

Instantly share code, notes, and snippets.

@notmgsk
Forked from ziprandom/mu4e-jump-to-thing.el
Last active December 12, 2017 19:02
Show Gist options
  • Save notmgsk/827d973da06ca5120df280a30fcc1061 to your computer and use it in GitHub Desktop.
Save notmgsk/827d973da06ca5120df280a30fcc1061 to your computer and use it in GitHub Desktop.
`M-.` style jumping from mu4e-message-view buffers
;;
;; 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