* WIP: show image attachment inline (mu4e-view-show-images)

This commit is contained in:
djcb
2012-05-16 20:47:13 +03:00
parent 47e7720464
commit 0776476522
5 changed files with 85 additions and 11 deletions

View File

@ -720,6 +720,27 @@ mu4e logs some of its internal workings to a log-buffer. See
(error "No debug log available"))
(switch-to-buffer buf)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar mu4e-imagemagick-identify "identify"
"Name/path of the Imagemagick 'identify' program.")
(defun mu4e-display-image (imgpath &optional maxwidth)
"Display image IMG at point; optionally specify
MAXWIDTH. Function tries to use imagemagick if available; otherwise
MAXWIDTH is ignored."
(when
(let*
((identify (and maxwidth (executable-find mu4e-imagemagick-identify)))
(props (and identify (shell-command-to-string
(format "%s -format '%%w' %s"
identify (shell-quote-argument imgpath)))))
(width (and props (string-to-number props)))
(img
(if (> (or width 0) (or maxwidth 0))
(create-image imgpath 'imagemagick nil :width maxwidth)
(create-image imgpath 'imagemagick))))
(newline)
(insert-image img imgpath nil t))))
(provide 'mu4e-utils)