all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Carlos Pita <carlosjosepita@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: 33631@debbugs.gnu.org
Subject: bug#33631: 26.1.90; Image mode should keep scale on auto-revert
Date: Wed, 2 Jan 2019 21:29:19 -0300	[thread overview]
Message-ID: <CAELgYhcB3a5m89kvTmAOXwVH+BwbBR-NyccsD6wkD2Bk+45OMQ@mail.gmail.com> (raw)
In-Reply-To: <CAELgYheg3pa=720iEKOK1-n2zv6JSvkxHHynbvehQprkiAesoA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

Here is a patch. image-transform-properties was not working on the
window of the current buffer, so I added a call to get-window-buffer.
In image-toggle-display-image (called from the auto-revert hook) this
was already being done, but the call to current-buffer was redundant
since it's the default, so I removed it. There are many other calls to
window-inside-pixel-edges around there but they don't seem to be
evaluated during auto-revert.

Regards
--
Carlos

[-- Attachment #2: 0001-Fix-auto-revert-resizing-33631.patch --]
[-- Type: text/x-patch, Size: 1886 bytes --]

From e4067b71b60c2507ce337b61e1282c1dc8e6ebcc Mon Sep 17 00:00:00 2001
From: memeplex <carlosjosepita@gmail.com>
Date: Wed, 2 Jan 2019 21:25:27 -0300
Subject: [PATCH] Fix auto-revert resizing #33631

---
 lisp/image-mode.el | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index c0186f0..9bf2ef3 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -756,8 +756,7 @@ image-toggle-display-image
 	 ;; If we have a `fit-width' or a `fit-height', don't limit
 	 ;; the size of the image to the window size.
 	 (edges (and (null image-transform-resize)
-		     (window-inside-pixel-edges
-		      (get-buffer-window (current-buffer)))))
+		     (window-inside-pixel-edges (get-buffer-window))))
 	 (type (if (fboundp 'imagemagick-types)
 		   'imagemagick
 		 (image-type file-or-data nil data-p)))
@@ -1161,6 +1160,7 @@ image-transform-properties
     ;; Note: `image-size' looks up and thus caches the untransformed
     ;; image.  There's no easy way to prevent that.
     (let* ((size (image-size spec t))
+           (edges (window-inside-pixel-edges (get-buffer-window)))
 	   (resized
 	    (cond
 	     ((numberp image-transform-resize)
@@ -1170,13 +1170,11 @@ image-transform-properties
 	     ((eq image-transform-resize 'fit-width)
 	      (image-transform-fit-width
 	       (car size) (cdr size)
-	       (- (nth 2 (window-inside-pixel-edges))
-		  (nth 0 (window-inside-pixel-edges)))))
+	       (- (nth 2 edges) (nth 0 edges))))
 	     ((eq image-transform-resize 'fit-height)
 	      (let ((res (image-transform-fit-width
 			  (cdr size) (car size)
-			  (- (nth 3 (window-inside-pixel-edges))
-			     (nth 1 (window-inside-pixel-edges))))))
+			  (- (nth 3 edges) (nth 1 edges)))))
 		(cons (cdr res) (car res)))))))
       `(,@(when (car resized)
 	    (list :width (car resized)))
-- 
2.19.2


  reply	other threads:[~2019-01-03  0:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-05 17:07 bug#33631: 26.1.90; Image mode should keep scale on auto-revert Carlos Pita
2018-12-29 21:33 ` Juri Linkov
2019-01-01 23:51   ` Carlos Pita
2019-01-03  0:08     ` Carlos Pita
2019-01-03  0:29       ` Carlos Pita [this message]
2019-06-23 20:50         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAELgYhcB3a5m89kvTmAOXwVH+BwbBR-NyccsD6wkD2Bk+45OMQ@mail.gmail.com \
    --to=carlosjosepita@gmail.com \
    --cc=33631@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.