* bug#24393: 25.1.50; image-mode ignore the image :scale
@ 2016-09-08 12:14 Tino Calancha
2016-09-08 17:15 ` Eli Zaretskii
2019-09-26 15:59 ` Lars Ingebrigtsen
0 siblings, 2 replies; 10+ messages in thread
From: Tino Calancha @ 2016-09-08 12:14 UTC (permalink / raw
To: 24393
emacs -Q IMAGE ; IMAGE is the file name of an image file
M-x: image-transform-fit-to-width
;; assertion fails. The image width is bigger than the window width.
This happens after commit: ad1951db
In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.21.5)
of 2016-09-07
Repository revision: ba5d32398ba42fcf14ad5242d95c68133981744f
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#24393: 25.1.50; image-mode ignore the image :scale
2016-09-08 12:14 bug#24393: 25.1.50; image-mode ignore the image :scale Tino Calancha
@ 2016-09-08 17:15 ` Eli Zaretskii
2016-09-08 18:13 ` Tino Calancha
2019-09-26 15:59 ` Lars Ingebrigtsen
1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2016-09-08 17:15 UTC (permalink / raw
To: Tino Calancha; +Cc: 24393
> From: Tino Calancha <tino.calancha@gmail.com>
> Date: Thu, 8 Sep 2016 21:14:26 +0900 (JST)
>
>
> emacs -Q IMAGE ; IMAGE is the file name of an image file
> M-x: image-transform-fit-to-width
> ;; assertion fails. The image width is bigger than the window width.
>
> This happens after commit: ad1951db
Please show a backtrace from the assertion violation.
Thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#24393: 25.1.50; image-mode ignore the image :scale
2016-09-08 17:15 ` Eli Zaretskii
@ 2016-09-08 18:13 ` Tino Calancha
2016-09-09 8:06 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Tino Calancha @ 2016-09-08 18:13 UTC (permalink / raw
To: Eli Zaretskii; +Cc: 24393, Tino Calancha
On Thu, 8 Sep 2016, Eli Zaretskii wrote:
>> From: Tino Calancha <tino.calancha@gmail.com>
>> Date: Thu, 8 Sep 2016 21:14:26 +0900 (JST)
>>
>>
>> emacs -Q IMAGE ; IMAGE is the file name of an image file
>> M-x: image-transform-fit-to-width
>> ;; assertion fails. The image width is bigger than the window width.
>>
>> This happens after commit: ad1951db
>
> Please show a backtrace from the assertion violation.
Debugger entered: ((cl-assertion-failed (= (car size) (- (nth 2 (window-inside-pixel-edges)) (nth 0 (window-inside-pixel-edges)))) nil 4299 2514))
cl--assertion-failed((= (car size) (- (nth 2 (window-inside-pixel-edges)) (nth 0 (window-inside-pixel-edges)))) nil (4299 2514) nil)
image-transform-check-size()
image-toggle-display-image()
image-transform-fit-to-width()
eval((image-transform-fit-to-width) nil)
eval-expression((image-transform-fit-to-width) nil)
funcall-interactively(eval-expression (image-transform-fit-to-width)
nil)
call-interactively(eval-expression nil nil)
command-execute(eval-expression)
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#24393: 25.1.50; image-mode ignore the image :scale
2016-09-08 18:13 ` Tino Calancha
@ 2016-09-09 8:06 ` Eli Zaretskii
2016-09-09 10:23 ` Tino Calancha
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2016-09-09 8:06 UTC (permalink / raw
To: Tino Calancha; +Cc: 24393
> From: Tino Calancha <tino.calancha@gmail.com>
> Date: Fri, 9 Sep 2016 03:13:36 +0900 (JST)
> cc: Tino Calancha <tino.calancha@gmail.com>, 24393@debbugs.gnu.org
>
> >> emacs -Q IMAGE ; IMAGE is the file name of an image file
> >> M-x: image-transform-fit-to-width
> >> ;; assertion fails. The image width is bigger than the window width.
> >>
> >> This happens after commit: ad1951db
> >
> > Please show a backtrace from the assertion violation.
> Debugger entered: ((cl-assertion-failed (= (car size) (- (nth 2 (window-inside-pixel-edges)) (nth 0 (window-inside-pixel-edges)))) nil 4299 2514))
> cl--assertion-failed((= (car size) (- (nth 2 (window-inside-pixel-edges)) (nth 0 (window-inside-pixel-edges)))) nil (4299 2514) nil)
> image-transform-check-size()
> image-toggle-display-image()
> image-transform-fit-to-width()
> eval((image-transform-fit-to-width) nil)
> eval-expression((image-transform-fit-to-width) nil)
> funcall-interactively(eval-expression (image-transform-fit-to-width)
> nil)
> call-interactively(eval-expression nil nil)
> command-execute(eval-expression)
Isn't there something wrong with the logic from the following fragment
of image-toggle-display-image? The comment certainly seems to have it
backwards, or at least in contradiction to what
image-transform-fit-to-width expects.
;; 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)))))
I think 'edges' should be non-nil if image-transform-resize is
non-nil, no?
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#24393: 25.1.50; image-mode ignore the image :scale
2016-09-09 8:06 ` Eli Zaretskii
@ 2016-09-09 10:23 ` Tino Calancha
2016-09-09 13:15 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Tino Calancha @ 2016-09-09 10:23 UTC (permalink / raw
To: Eli Zaretskii; +Cc: 24393, Tino Calancha
On Fri, 9 Sep 2016, Eli Zaretskii wrote:
> Isn't there something wrong with the logic from the following fragment
> of image-toggle-display-image? The comment certainly seems to have it
> backwards, or at least in contradiction to what
> image-transform-fit-to-width expects.
>
> ;; 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)))))
>
> I think 'edges' should be non-nil if image-transform-resize is
> non-nil, no?
I think is OK. Maybe i would adjust the comment a bit, because
`image-transform-resize' can also be a number (set by
`image-transform-set-scale'): i would say:
;; If `image-transform-resize' is non-nil, don't limit
;; the size of the image to the window size.
I think the logic is as follows:
The proportion width/height is an invariant of this transformation.
If you call `image-transform-fit-to-width', your image width will occupy
all the window width. Then, the height is increased in the same
proportion as the width, so the final image height may be longer than
the window height. That's OK.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#24393: 25.1.50; image-mode ignore the image :scale
2016-09-09 10:23 ` Tino Calancha
@ 2016-09-09 13:15 ` Eli Zaretskii
2016-09-09 13:51 ` Tino Calancha
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2016-09-09 13:15 UTC (permalink / raw
To: Tino Calancha; +Cc: 24393
> From: Tino Calancha <tino.calancha@gmail.com>
> Date: Fri, 9 Sep 2016 19:23:02 +0900 (JST)
> cc: Tino Calancha <tino.calancha@gmail.com>, 24393@debbugs.gnu.org
>
> > ;; 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)))))
> >
> > I think 'edges' should be non-nil if image-transform-resize is
> > non-nil, no?
> I think is OK. Maybe i would adjust the comment a bit, because
> `image-transform-resize' can also be a number (set by
> `image-transform-set-scale'): i would say:
> ;; If `image-transform-resize' is non-nil, don't limit
> ;; the size of the image to the window size.
>
> I think the logic is as follows:
> The proportion width/height is an invariant of this transformation.
> If you call `image-transform-fit-to-width', your image width will occupy
> all the window width. Then, the height is increased in the same
> proportion as the width, so the final image height may be longer than
> the window height. That's OK.
When image-transform-fit-to-width sets image-transform-resize to the
symbol 'fit-width', image-toggle-display-image will not pass any
dimensions to create-image. So how will the image be resized at all
in this case? What am I missing?
And how do you explain the assertion violation in this case, anyway?
What are the window dimensions in pixels?
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#24393: 25.1.50; image-mode ignore the image :scale
2016-09-09 13:15 ` Eli Zaretskii
@ 2016-09-09 13:51 ` Tino Calancha
0 siblings, 0 replies; 10+ messages in thread
From: Tino Calancha @ 2016-09-09 13:51 UTC (permalink / raw
To: Eli Zaretskii; +Cc: 24393, Tino Calancha
On Fri, 9 Sep 2016, Eli Zaretskii wrote:
>> From: Tino Calancha <tino.calancha@gmail.com>
>> Date: Fri, 9 Sep 2016 19:23:02 +0900 (JST)
>> cc: Tino Calancha <tino.calancha@gmail.com>, 24393@debbugs.gnu.org
>>
>>> ;; 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)))))
>>>
>>> I think 'edges' should be non-nil if image-transform-resize is
>>> non-nil, no?
>> I think is OK. Maybe i would adjust the comment a bit, because
>> `image-transform-resize' can also be a number (set by
>> `image-transform-set-scale'): i would say:
>> ;; If `image-transform-resize' is non-nil, don't limit
>> ;; the size of the image to the window size.
>>
>> I think the logic is as follows:
>> The proportion width/height is an invariant of this transformation.
>> If you call `image-transform-fit-to-width', your image width will occupy
>> all the window width. Then, the height is increased in the same
>> proportion as the width, so the final image height may be longer than
>> the window height. That's OK.
>
> When image-transform-fit-to-width sets image-transform-resize to the
> symbol 'fit-width', image-toggle-display-image will not pass any
> dimensions to create-image. So how will the image be resized at all
> in this case? What am I missing?
It is done inside `image-toggle-display-image'. Maybe the word 'toggle'
inside this function is misleading: indeed it looks more than a toggle.
This 'toggle' calls `image-transform-properties' which calculate the
resize for 'fit-width/'fit-height cases.
> And how do you explain the assertion violation in this case, anyway?
> What are the window dimensions in pixels?
The same 'toggle' calls `image-transform-check-size' to check
the sizes (do the cl-asserts).
I guess, the origin of the problem is that these functions,
`image-transform-properties' and `image-transform-check-size',
don't use the image scale. After the commit mentioned in my original
report, the scale of an image matters. We need somehow to teach
`image-mode' to use :scale to fix this bug.
We could fix this file amending those functions. I tried before and
i didn't like this approach.
I also suggested in
https://lists.gnu.org/archive/html/emacs-devel/2016-09/msg00159.html
that if image-mode.el uses more the API in image.el (maybe extending
the API a bit ), then this bug could get fix easily; currently both
files define resizes and rotations; for me it has much sense that,
if the API already provide those functionalities, then image-mode.el
just use them: one source of truth, easier to maintain.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#24393: 25.1.50; image-mode ignore the image :scale
2016-09-08 12:14 bug#24393: 25.1.50; image-mode ignore the image :scale Tino Calancha
2016-09-08 17:15 ` Eli Zaretskii
@ 2019-09-26 15:59 ` Lars Ingebrigtsen
2019-09-26 17:42 ` Tino Calancha
1 sibling, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2019-09-26 15:59 UTC (permalink / raw
To: Tino Calancha; +Cc: 24393
Tino Calancha <tino.calancha@gmail.com> writes:
> emacs -Q IMAGE ; IMAGE is the file name of an image file
> M-x: image-transform-fit-to-width
> ;; assertion fails. The image width is bigger than the window width.
I'm unable to reproduce this bug in Emacs 27. Are you still seeing
this?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#24393: 25.1.50; image-mode ignore the image :scale
2019-09-26 15:59 ` Lars Ingebrigtsen
@ 2019-09-26 17:42 ` Tino Calancha
2019-09-26 17:49 ` Lars Ingebrigtsen
0 siblings, 1 reply; 10+ messages in thread
From: Tino Calancha @ 2019-09-26 17:42 UTC (permalink / raw
To: Lars Ingebrigtsen; +Cc: 24393
On Thu, 26 Sep 2019, Lars Ingebrigtsen wrote:
> Tino Calancha <tino.calancha@gmail.com> writes:
>
>> emacs -Q IMAGE ; IMAGE is the file name of an image file
>> M-x: image-transform-fit-to-width
>> ;; assertion fails. The image width is bigger than the window width.
>
> I'm unable to reproduce this bug in Emacs 27. Are you still seeing
> this?
No, I don't see this anymore; and I am using
`image-transform-fit-to-width' `image-transform-fit-to-height' quite
often. It seems fixed.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#24393: 25.1.50; image-mode ignore the image :scale
2019-09-26 17:42 ` Tino Calancha
@ 2019-09-26 17:49 ` Lars Ingebrigtsen
0 siblings, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2019-09-26 17:49 UTC (permalink / raw
To: Tino Calancha; +Cc: 24393
Tino Calancha <tino.calancha@gmail.com> writes:
> No, I don't see this anymore; and I am using
> `image-transform-fit-to-width' `image-transform-fit-to-height' quite
> often. It seems fixed.
Thanks; closing.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-09-26 17:49 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-08 12:14 bug#24393: 25.1.50; image-mode ignore the image :scale Tino Calancha
2016-09-08 17:15 ` Eli Zaretskii
2016-09-08 18:13 ` Tino Calancha
2016-09-09 8:06 ` Eli Zaretskii
2016-09-09 10:23 ` Tino Calancha
2016-09-09 13:15 ` Eli Zaretskii
2016-09-09 13:51 ` Tino Calancha
2019-09-26 15:59 ` Lars Ingebrigtsen
2019-09-26 17:42 ` Tino Calancha
2019-09-26 17:49 ` Lars Ingebrigtsen
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.