[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master b5dc6c6: Scale images in iimage-mode
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master b5dc6c6: Scale images in iimage-mode |
Date: |
Sun, 28 Jul 2019 10:48:26 -0400 (EDT) |
branch: master
commit b5dc6c63dae54c24e70f60e7d5daa35d52d9aff6
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
Scale images in iimage-mode
* lisp/iimage.el (iimage-mode-buffer): Scale images down to the
width/height of the buffer (bug#23434). Also add `image-map' to
the images so that they can be further scaled.
---
lisp/iimage.el | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/lisp/iimage.el b/lisp/iimage.el
index 39ee1fb..3b50064 100644
--- a/lisp/iimage.el
+++ b/lisp/iimage.el
@@ -116,6 +116,7 @@ Examples of image filename patterns to match:
(defun iimage-mode-buffer (arg)
"Display images if ARG is non-nil, undisplay them otherwise."
(let ((image-path (cons default-directory iimage-mode-image-search-path))
+ (edges (window-inside-pixel-edges (get-buffer-window)))
file)
(with-silent-modifications
(save-excursion
@@ -128,10 +129,15 @@ Examples of image filename patterns to match:
;; remove them either (we may leave some of ours, and we
;; may remove other packages's display properties).
(if arg
- (add-text-properties (match-beginning 0) (match-end 0)
- `(display ,(create-image file)
- modification-hooks
- (iimage-modification-hook)))
+ (add-text-properties
+ (match-beginning 0) (match-end 0)
+ `(display
+ ,(create-image file nil nil
+ :max-width (- (nth 2 edges) (nth 0 edges))
+ :max-height (- (nth 3 edges) (nth 1 edges)))
+ keymap ,image-map
+ modification-hooks
+ (iimage-modification-hook)))
(remove-text-properties (match-beginning 0) (match-end 0)
'(display modification-hooks))))))))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master b5dc6c6: Scale images in iimage-mode,
Lars Ingebrigtsen <=