Guest User

Untitled

a guest
Dec 15th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. ;;
  2. ;; jump to thing on M-.
  3. ;;
  4. (defun mu4e-jump-to-thing (u)
  5. "jump to thing under point (should work with addresses, dates, tags)"
  6. (interactive "P")
  7. (let*
  8. (
  9. (type (string-remove-suffix ":" (first (split-string (thing-at-point 'line)))))
  10. (
  11. query (pcase type
  12. ("From" (concat "contact:" (get-text-property (point) 'email)))
  13. ("To" (concat "contact:" (get-text-property (point) 'email)))
  14. ("Subject" (concat "subject:" (thing-at-point 'sentence)) )
  15. ("Flags" (concat "flag:" (thing-at-point 'word)))
  16. ("Date" (concat "date:" (format-time-string "%Y%m%d"
  17. (mu4e-message-field mu4e~view-msg :date))))
  18. ("Maildir" (concat "maildir:" (thing-at-point 'filename)))
  19. ("Tags" (concat "tag:" (thing-at-point 'word)))
  20. ("List" (concat "list:" (thing-at-point 'sentence)))
  21. ; ("Attachments" (concat "mime:"
  22. ; (mailcap-extension-to-mime
  23. ; (last
  24. ; (split-string
  25. ; (substring-no-properties (thing-at-point 'filename))
  26. ; "\\."
  27. ; )
  28. ; )
  29. ; )
  30. ; )
  31. ; )
  32. (other "")
  33. )
  34. )
  35. )
  36. (progn
  37. (mu4e-headers-search query nil u)
  38. )
  39. )
  40. )
  41.  
  42. (eval-after-load 'mu4e-view
  43. '(define-key mu4e-view-mode-map (kbd "M-.") 'mu4e-jump-to-thing))
Add Comment
Please, Sign In to add comment