Subject: Re: bug#62679: 29.0.60; Bindings on `image-map` cause error on sliced images

From: Rah Guzar <[email-masked]>
Date: Thu, 06 Apr 2023 17:43:55 +0200

Hi Eli,
  I can confirm that the issue is mostly fixed now. One thing I noticed
  was that it is still possible to trigger the error by starting with my
  recipe before, moving the point to somewhere on the image and then
  using right arrow key. Since the image has a single column the point
  is now off image but on the same line. This buffer position still has
  the "image-map" and pressing e.g. "i +" still causes the error.

  I also see the artifacts you mentioned with "i -". I am using
  "insert-sliced-image" to insert image of typeset math in a comint
  derived mode and I have seen visual artifacts at the end of line
  there too and like in this case "describe-char" shows them to be
  control characters. The also seem to disappear on their own if I
  switch buffer and back. I haven't been able to get rid of them and
  can't reproduce them in "emacs -Q" so I might be doing something wrong
  but this makes me think this might be the result of creating the image
  with a ":max-width" property which might cause the equivalent of "i-".

  According to the info manual, the advantage of using sliced images is
  to get a more intuitive scrolling behavior and that is the reason I am
  using them. I think for everything else the image should behave as a
  single image. For that reason the behavior of "i r" seems correct to
  me. It rotates the image and then slices. From the perspective of
  scrolling it would nicer to have slices which have a fixed length and
  width so that number of slices changes when "i +" and "i -" are used.

Thanks a lot!
Rah Guzar

Eli Zaretskii <[email-masked]> writes:

>> Date: Wed, 05 Apr 2023 17:23:11 +0200
>> From:  Rah Guzar via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <[email-masked]>
>>
>> (let* ((image (create-image path-to-png 'png nil :mask 'heuristic))
>>        (rows (max 1 (1- (cdr (image-size image))))))
>>   (goto-char (point-max))
>>   (insert "\n")
>>   (insert-sliced-image image " " nil rows))
>> ```
>> This inserts the image specified at the end of the buffer. The image
>> has a `keymap` text property which include binding for various
>> operations on images but moving point to the image and trying to use
>> any of these (e.g. `i +` to increase image size) results in the error,
>>
>> Error running timer ‘image--change-size’: (error "No image under point")
>
> This should be fixed now on the emacs-29 branch.
>
> It isn't perfect: "i -" leaves display artifacts (which I think are
> unrelated to this bug report per se), and "i r" doesn't really work,
> except when you type 'r' 4 times in a row.  But I'm not sure I
> understand the conceptual meaning of rotating a sliced image, and even
> resizing it doesn't necessarily have a clear-cut meaning IMO.
>
> Perhaps we should decide we don't support these operations for sliced
> images, and simply show a different error message specifically about
> that non-support?
>
> Lars, any comments and/or ideas?