Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;
- ;; 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)))
- ; ("Attachments" (concat "mime:"
- ; (mailcap-extension-to-mime
- ; (last
- ; (split-string
- ; (substring-no-properties (thing-at-point 'filename))
- ; "\\."
- ; )
- ; )
- ; )
- ; )
- ; )
- (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))
Add Comment
Please, Sign In to add comment