emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117651: Use a max-width when displaying images


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] trunk r117651: Use a max-width when displaying images
Date: Tue, 05 Aug 2014 18:18:50 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117651
revision-id: address@hidden
parent: address@hidden
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Tue 2014-08-05 20:18:39 +0200
message:
  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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/image-mode.el             
imagemode.el-20091113204419-o5vbwnq5f7feedwu-3391
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-08-05 18:15:52 +0000
+++ b/lisp/ChangeLog    2014-08-05 18:18:39 +0000
@@ -1,3 +1,8 @@
+2014-08-05  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * image-mode.el (image-toggle-display-image): Alway rescale images
+       to not be bigger than the current window.
+
 2014-08-05  Eric Brown  <address@hidden>  (tiny change)
 
        * net/eww.el (eww-bookmarks-directory): New variable.

=== modified file 'lisp/image-mode.el'
--- a/lisp/image-mode.el        2014-04-21 14:34:49 +0000
+++ b/lisp/image-mode.el        2014-08-05 18:18:39 +0000
@@ -638,8 +638,14 @@
                           (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))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]