1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-11 09:20:51 +00:00

Use a max-width when displaying images

* lisp/image-mode.el (image-toggle-display-image): Alway rescale images
to not be bigger than the current window.
This commit is contained in:
Lars Magne Ingebrigtsen 2014-08-05 20:18:39 +02:00
parent 06e7319ce3
commit 81d0eae714
2 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2014-08-05 Lars Magne Ingebrigtsen <larsi@gnus.org>
* image-mode.el (image-toggle-display-image): Alway rescale images
to not be bigger than the current window.
2014-08-05 Eric Brown <brown@fastmail.fm> (tiny change)
* net/eww.el (eww-bookmarks-directory): New variable.

View File

@ -638,8 +638,14 @@ was inserted."
(string-make-unibyte
(buffer-substring-no-properties (point-min) (point-max)))
filename))
(type (image-type file-or-data nil data-p))
(image (create-image file-or-data type data-p))
(edges (window-inside-pixel-edges
(get-buffer-window (current-buffer))))
(type (if (fboundp 'imagemagick-types)
'imagemagick
(image-type file-or-data nil data-p)))
(image (create-image file-or-data type data-p
:max-width (- (nth 2 edges) (nth 0 edges))
:max-height (- (nth 3 edges) (nth 1 edges))))
(inhibit-read-only t)
(buffer-undo-list t)
(modified (buffer-modified-p))