mirror of https://github.com/djcb/mu.git
* mu4e: do a better job of trying to show images (without delay)
This commit is contained in:
parent
c7c18505fc
commit
b26bd3a4e7
|
@ -600,6 +600,7 @@ and fill the list `mu4e~contacts-for-completion' with it, with
|
|||
each element looking like
|
||||
name <email>
|
||||
This is used by the completion function in mu4e-compose."
|
||||
(setq mu4e~contact-list contacts)
|
||||
(let ((lst)
|
||||
;; sort by the frequency (descending), then timestamp (descending)
|
||||
;; FIXME: sadly, the emacs completion subsystem re-sorts the list
|
||||
|
@ -929,11 +930,11 @@ This includes expanding e.g. 3-5 into 3,4,5. If the letter
|
|||
(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 (ie.,
|
||||
(defun mu4e-display-image (imgpath &optional maxwidth maxheight)
|
||||
"Display image IMG at point; optionally specify MAXWIDTH and
|
||||
MAXHEIGHT. Function tries to use imagemagick if available (ie.,
|
||||
emacs was compiled with inmagemagick support); otherwise MAXWIDTH
|
||||
is ignored."
|
||||
and MAXHEIGHT are ignored."
|
||||
(let* ((have-im (and (fboundp 'imagemagick-types)
|
||||
(imagemagick-types))) ;; hmm, should check for specific type
|
||||
(identify (and have-im maxwidth
|
||||
|
@ -949,8 +950,12 @@ is ignored."
|
|||
(create-image imgpath))))
|
||||
;;(message "DISPLAY: %S %S" imgpath img)
|
||||
(when img
|
||||
(newline)
|
||||
(insert-image img))))
|
||||
(insert "\n")
|
||||
(let ((size (image-size img))) ;; inspired by gnus..
|
||||
(insert-char ?\n (max 0 (round (- (window-height) (or maxheight (cdr size)) 1) 2)))
|
||||
(insert-char ?\ (max 0 (round (- (window-width) (or maxwidth (car size))) 2)))
|
||||
(insert-image img)))))
|
||||
|
||||
|
||||
(defun mu4e-hide-other-mu4e-buffers ()
|
||||
"Bury mu4e-buffers (main, headers, view) (and delete all windows
|
||||
|
|
|
@ -80,6 +80,13 @@ This is only effective if you're using an emacs with Imagemagick
|
|||
support, and `mu4e-view-show-images' is non-nil."
|
||||
:group 'mu4e-view)
|
||||
|
||||
(defcustom mu4e-view-image-max-height 600
|
||||
"The maximum height for images to display.
|
||||
This is only effective if you're using an emacs with Imagemagick
|
||||
support, and `mu4e-view-show-images' is non-nil."
|
||||
:group 'mu4e-view)
|
||||
|
||||
|
||||
(defcustom mu4e-view-scroll-to-next t
|
||||
"If non-nil, move to the next message when calling
|
||||
`mu4e-view-scroll-up-or-next' (typically bound to SPC) when at the
|
||||
|
@ -743,7 +750,9 @@ What browser is called is depending on
|
|||
(when (and imgfile (file-exists-p imgfile))
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(mu4e-display-image imgfile mu4e-view-image-max-width)))))))))
|
||||
(mu4e-display-image imgfile
|
||||
mu4e-view-image-max-width
|
||||
mu4e-view-image-max-height)))))))))
|
||||
|
||||
;; this is fairly simplistic...
|
||||
(defun mu4e~view-make-urls-clickable ()
|
||||
|
|
|
@ -2831,9 +2831,7 @@ default for various reasons.
|
|||
(setq mu4e-attachment-dir "~/Desktop")
|
||||
|
||||
;; attempt to show images when viewing messages
|
||||
(setq
|
||||
mu4e-view-show-images t
|
||||
mu4e-view-image-max-width 800)
|
||||
(setq mu4e-view-show-images t)
|
||||
@end lisp
|
||||
|
||||
@node FAQ
|
||||
|
|
Loading…
Reference in New Issue