Created
March 23, 2018 23:47
-
-
Save killdash9/fb28ae6a35c9a58d6aa10f5fb65e6e8d to your computer and use it in GitHub Desktop.
Mu4e HTML images are not shown by default. This gives you a way to toggle them on.
This file contains hidden or 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
;; mu4e toggle html images | |
(defvar killdash9/mu4e~view-html-images nil | |
"Whether to show images in html messages") | |
(defun killdash9/mu4e-view-toggle-html-images () | |
"Toggle image-display of html message." | |
(interactive) | |
(setq-local killdash9/mu4e~view-html-images (not killdash9/mu4e~view-html-images)) | |
(message "Images are %s" (if killdash9/mu4e~view-html-images "on" "off")) | |
(mu4e-view-refresh)) | |
(defun mu4e-shr2text (msg) | |
"Convert html in MSG to text using the shr engine; this can be | |
used in `mu4e-html2text-command' in a new enough emacs. Based on | |
code by Titus von der Malsburg." | |
(lexical-let ((view-images killdash9/mu4e~view-html-images)) | |
(mu4e~html2text-wrapper | |
(lambda () | |
(let ((shr-inhibit-images (not view-images))) | |
(shr-render-region (point-min) (point-max)))) msg))) | |
(define-key mu4e-view-mode-map "i" 'killdash9/mu4e-view-toggle-html-images) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, dude.