Skip to content

Instantly share code, notes, and snippets.

@rberenguel
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rberenguel/970d7b23449dadbd7e5b to your computer and use it in GitHub Desktop.
Save rberenguel/970d7b23449dadbd7e5b to your computer and use it in GitHub Desktop.
The nicest would be :ft, which shows from/to depending on the source, hence making "sent" a more useful folder (since I'm pretty sure the "From" field in "Sent" is "me"
(setq mu4e-bookmarks
'( ("flag:unread AND NOT flag:trashed AND date:today..now AND maildir:/INBOX" "Today's inbox" ?i)
("date:today..now AND NOT maildir:/INBOX.Sent" "Today's messages" ?t)
("date:30d..now AND maildir:/INBOX.Sent" "Sent last 30 days" ?s)
("date:7d..now" "Last 7 days" ?w)
("mime:image/*" "Messages with images" ?p)
("size:1M..500M" "Big messages" ?b))
)
(add-to-list 'mu4e-header-info-custom
'(:mdir .
( :name "Small maildir" ;; long name, as seen in the message-view
:shortname "mdir" ;; short name, as seen in the headers view
:help "Maildir" ;; tooltip
:function
(lambda (msg)
(format "%s" (substring (mu4e-message-field msg :maildir) 6))))))
(add-to-list 'mu4e-header-info-custom
'(:ft .
( :name "From/To" ;; long name, as seen in the message-view
:shortname "F/T" ;; short name, as seen in the headers view
:help "From/To" ;; tooltip
:function
(lambda (msg)
(if (mu4e-message-contact-field-matches msg :from "mymail@somewhere.com")
(if (car (car (mu4e-message-field msg :to)))
(car (car (mu4e-message-field msg :to)))
(cadr (car (mu4e-message-field msg :to))))
(if (car (car (mu4e-message-field msg :from)))
(car (car (mu4e-message-field msg :from)))
(cadr (car (mu4e-message-field msg :from))))
)))))
(setq mu4e-headers-fields
'( (:human-date . 12)
(:flags . 6)
(:mdir . 20)
(:ft . 20)
(:subject . nil)))
(defun mu4e-msgv-action-view-in-browser (msg)
"View the body of the message in a web browser."
(interactive)
(let ((html (mu4e-msg-field (mu4e-message-at-point t) :body-html))
(tmpfile (format "%s/%d.html" temporary-file-directory (random))))
(unless html (error "No html part for this message"))
(with-temp-file tmpfile
(insert
"<html>"
"<head><meta http-equiv=\"content-type\""
"content=\"text/html;charset=UTF-8\">"
html))
(browse-url (concat "file://" tmpfile))))
(add-to-list 'mu4e-view-actions
'("View in browser" . mu4e-msgv-action-view-in-browser) t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment