GNU bug report logs - #69602
29.1; Image :map should adjust with :scale and :rotation

Previous Next

Package: emacs;

Reported by: Joseph Turner <joseph <at> breatheoutbreathe.in>

Date: Thu, 7 Mar 2024 06:09:02 UTC

Severity: normal

Found in version 29.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 69602 in the body.
You can then email your comments to 69602 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to stephen.berman <at> gmx.net, juri <at> linkov.net, bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Thu, 07 Mar 2024 06:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Joseph Turner <joseph <at> breatheoutbreathe.in>:
New bug report received and forwarded. Copy sent to stephen.berman <at> gmx.net, juri <at> linkov.net, bug-gnu-emacs <at> gnu.org. (Thu, 07 Mar 2024 06:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.1; Image :map should adjust with :scale and :rotation
Date: Wed, 06 Mar 2024 21:37:50 -0800
Currently, when running `image-increase-size' or `image-decrease-size'
on an image with a :map property, the image scales but the image map
does not.  For example, run the following snippet:

(with-current-buffer (get-buffer-create "*image-properties-test*")
  (let ((svg "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.43.0 (0)\n -->\n<!-- Title: orggraphview Pages: 1 -->\n<svg width=\"128pt\" height=\"128pt\"\n viewBox=\"0.00 0.00 127.59 127.59\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 123.59)\">\n<title>orggraphview</title>\n<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-123.59 123.59,-123.59 123.59,4 -4,4\"/>\n<!-- a -->\n<g id=\"node1\" class=\"node\">\n<title>a</title>\n<g id=\"a_node1\"><a xlink:href=\"1\" xlink:title=\"Hover me!\">\n<ellipse fill=\"none\" stroke=\"black\" cx=\"59.79\" cy=\"-59.79\" rx=\"59.59\" ry=\"59.59\"/>\n<text text-anchor=\"middle\" x=\"59.79\" y=\"-56.09\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">Hover me!</text>\n</a>\n</g>\n</g>\n</g>\n</svg>\n")
        (map '(((circle (85 . 85) . 80) "1" (help-echo "Surprise!"))))
        (inhibit-read-only t))
    (erase-buffer)
    (insert-image (create-image svg 'svg t :map map))
    (goto-char (point-min))
    (pop-to-buffer (current-buffer))))

Hovering the circle alters the pointer style and displays the tooltip.

Now run `M-x image-increase-size' or press "i +".  While the image
becomes larger, the area which activates the tooltip remains the same.

See earlier discussion here:

https://yhetil.org/emacs-devel/87r0gng41l.fsf <at> ushin.org/T/#t

While a proper solution perhaps belongs on the C side, the following
workaround adds an :unscaled-map property to images and sets :map
according to :unscaled-map and :scale whenever :scale changes.

This workaround does not (yet) handle :rotation.

--8<---------------cut here---------------start------------->8---

(defun image--scale-map (map factor)
  "Scale MAP by FACTOR, destructively modifying it."
  (unless (= 1 factor)
    (pcase-dolist (`(,`(,type . ,coords) ,_id ,_plist) map)
      (pcase-exhaustive type
        ('rect
         (setf (caar coords) (round (* (caar coords) factor)))
         (setf (cdar coords) (round (* (cdar coords) factor)))
         (setf (cadr coords) (round (* (cadr coords) factor)))
         (setf (cddr coords) (round (* (cddr coords) factor))))
        ('circle
         (setf (caar coords) (round (* (caar coords) factor)))
         (setf (cdar coords) (round (* (cdar coords) factor)))
         (setf (cdr coords) (round (* (cdr coords) factor))))
        ('poly
         (dotimes (i (length coords))
           (aset coords i
                 (round (* (aref coords i) factor))))))))
  map)

(defun image--create-image-add-unscaled-map
    (orig-fun file-or-data &optional type data-p &rest props)
  "Add :unscaled-map property to image returned by ORIG-FUN and return it.
Intended to be used as :around advice for `create-image'."
  (let ((image (apply orig-fun file-or-data type data-p props)))
    (when-let ((map (image-property image :map)))
      (setq image (nconc image
                         (list :unscaled-map (copy-tree map t))))
      (when-let* ((props-scale (plist-get props :scale))
                  ((numberp props-scale)))
        (setf (image-property image :unscaled-map)
              (image--scale-map (image-property image :unscaled-map)
                                (/ 1.0 props-scale)))))
    image))

(advice-add #'create-image :around #'image--create-image-add-unscaled-map)

(defun image--change-size-scale-map (_factor &optional position)
  "Scale :map property of image at point to fit its :scale.
Intended to be used as :after advice for `image--change-size'."
  (when-let* ((image (image--get-imagemagick-and-warn position))
              (map (image-property image :map))
              (unscaled-map (image-property image :unscaled-map))
              (scale (image-property image :scale)))
    (setf (image-property image :map)
          ;; TODO: Instead of copying `:unscaled-map', reuse the :map vector?
          (image--scale-map (copy-tree unscaled-map t) scale))))

(advice-add #'image--change-size :after #'image--change-size-scale-map)

--8<---------------cut here---------------end--------------->8---

Thank you!

Joseph




In GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37,
cairo version 1.16.0)
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Thu, 07 Mar 2024 07:05:01 GMT) Full text and rfc822 format available.

Message #8 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1;
 Image :map should adjust with :scale and :rotation
Date: Thu, 07 Mar 2024 09:04:06 +0200
> Cc: Stephen Berman <stephen.berman <at> gmx.net>, Juri Linkov <juri <at> linkov.net>
> Date: Wed, 06 Mar 2024 21:37:50 -0800
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Currently, when running `image-increase-size' or `image-decrease-size'
> on an image with a :map property, the image scales but the image map
> does not.  For example, run the following snippet:
> 
> (with-current-buffer (get-buffer-create "*image-properties-test*")
>   (let ((svg "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.43.0 (0)\n -->\n<!-- Title: orggraphview Pages: 1 -->\n<svg width=\"128pt\" height=\"128pt\"\n viewBox=\"0.00 0.00 127.59 127.59\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 123.59)\">\n<title>orggraphview</title>\n<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-123.59 123.59,-123.59 123.59,4 -4,4\"/>\n<!-- a -->\n<g id=\"node1\" class=\"node\">\n<title>a</title>\n<g id=\"a_node1\"><a xlink:href=\"1\" xlink:title=\"Hover me!\">\n<ellipse fill=\"none\" stroke=\"black\" cx=\"59.79\" cy=\"-59.79\" rx=\"59.59\" ry=\"59.59\"/>\n<text text-anchor=\"middle\" x=\"59.79\" y=\"-56.09\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">Hover me!</text>\n</a>\n</g>\n</g>\n</g>\n</svg>\n")
>         (map '(((circle (85 . 85) . 80) "1" (help-echo "Surprise!"))))
>         (inhibit-read-only t))
>     (erase-buffer)
>     (insert-image (create-image svg 'svg t :map map))
>     (goto-char (point-min))
>     (pop-to-buffer (current-buffer))))
> 
> Hovering the circle alters the pointer style and displays the tooltip.
> 
> Now run `M-x image-increase-size' or press "i +".  While the image
> becomes larger, the area which activates the tooltip remains the same.
> 
> See earlier discussion here:
> 
> https://yhetil.org/emacs-devel/87r0gng41l.fsf <at> ushin.org/T/#t
> 
> While a proper solution perhaps belongs on the C side, the following
> workaround adds an :unscaled-map property to images and sets :map
> according to :unscaled-map and :scale whenever :scale changes.

The ELisp manual says about :map:

     Note that the map's coordinates should reflect the displayed image
     after all transforms have been done (rotation, scaling and so on),
     and also note that Emacs (by default) performs auto-scaling of
     images, so to make things match up, you should either specify
     ‘:scale 1.0’ when creating the image, or use the result of
     ‘image-compute-scaling-factor’ to compute the elements of the map.

Can this technique help?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Thu, 07 Mar 2024 07:40:01 GMT) Full text and rfc822 format available.

Message #11 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Wed, 06 Mar 2024 23:14:21 -0800
Eli Zaretskii <eliz <at> gnu.org> writes:
> The ELisp manual says about :map:
>
>      Note that the map's coordinates should reflect the displayed image
>      after all transforms have been done (rotation, scaling and so on),
>      and also note that Emacs (by default) performs auto-scaling of
>      images, so to make things match up, you should either specify
>      ‘:scale 1.0’ when creating the image, or use the result of
>      ‘image-compute-scaling-factor’ to compute the elements of the map.
>
> Can this technique help?

Thank you for your help!

When the user runs `image-increase-size', where should third-party code
recompute :map to fit the new image scale?

There's no `image-after-change-size-hook' nor `image-after-rotate-hook'.

Joseph




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Thu, 07 Mar 2024 07:57:02 GMT) Full text and rfc822 format available.

Message #14 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Thu, 07 Mar 2024 09:55:42 +0200
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
> Date: Wed, 06 Mar 2024 23:14:21 -0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> > The ELisp manual says about :map:
> >
> >      Note that the map's coordinates should reflect the displayed image
> >      after all transforms have been done (rotation, scaling and so on),
> >      and also note that Emacs (by default) performs auto-scaling of
> >      images, so to make things match up, you should either specify
> >      ‘:scale 1.0’ when creating the image, or use the result of
> >      ‘image-compute-scaling-factor’ to compute the elements of the map.
> >
> > Can this technique help?
> 
> Thank you for your help!
> 
> When the user runs `image-increase-size', where should third-party code
> recompute :map to fit the new image scale?
> 
> There's no `image-after-change-size-hook' nor `image-after-rotate-hook'.

I think the idea is to define the value of :map such that it runs
image-compute-scaling-factor as part of computing the coordinates of
the map.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Thu, 07 Mar 2024 08:20:02 GMT) Full text and rfc822 format available.

Message #17 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Thu, 07 Mar 2024 00:08:57 -0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
>> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
>> Date: Wed, 06 Mar 2024 23:14:21 -0800
>>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> > The ELisp manual says about :map:
>> >
>> >      Note that the map's coordinates should reflect the displayed image
>> >      after all transforms have been done (rotation, scaling and so on),
>> >      and also note that Emacs (by default) performs auto-scaling of
>> >      images, so to make things match up, you should either specify
>> >      ‘:scale 1.0’ when creating the image, or use the result of
>> >      ‘image-compute-scaling-factor’ to compute the elements of the map.
>> >
>> > Can this technique help?
>>
>> Thank you for your help!
>>
>> When the user runs `image-increase-size', where should third-party code
>> recompute :map to fit the new image scale?
>>
>> There's no `image-after-change-size-hook' nor `image-after-rotate-hook'.
>
> I think the idea is to define the value of :map such that it runs
> image-compute-scaling-factor as part of computing the coordinates of
> the map.

Sorry, I don't understand.

When creating an image, we set its :map property according to the return
value of `image-compute-scaling-factor'.  Once the image is inserted into
the buffer, the user may run `image-increase-size' or `image-rotate',
which changes how the image is displayed but not its :map.

Now, we need to rerun `image-compute-scaling-factor' and recompute :map.
However, there is no hook which runs after the user runs those commands,
so AFAICT there's no way for our code to know when to recompute :map.

Thanks!

Joseph




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Thu, 07 Mar 2024 09:29:02 GMT) Full text and rfc822 format available.

Message #20 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Thu, 07 Mar 2024 11:27:53 +0200
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
> Date: Thu, 07 Mar 2024 00:08:57 -0800
> 
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> >      Note that the map's coordinates should reflect the displayed image
> >> >      after all transforms have been done (rotation, scaling and so on),
> >> >      and also note that Emacs (by default) performs auto-scaling of
> >> >      images, so to make things match up, you should either specify
> >> >      ‘:scale 1.0’ when creating the image, or use the result of
> >> >      ‘image-compute-scaling-factor’ to compute the elements of the map.
> >> >
> >> > Can this technique help?
> >>
> >> Thank you for your help!
> >>
> >> When the user runs `image-increase-size', where should third-party code
> >> recompute :map to fit the new image scale?
> >>
> >> There's no `image-after-change-size-hook' nor `image-after-rotate-hook'.
> >
> > I think the idea is to define the value of :map such that it runs
> > image-compute-scaling-factor as part of computing the coordinates of
> > the map.
> 
> Sorry, I don't understand.

I hoped :map allows its value to be a form that is evaluated when the
image is being processed, in which case that form could call
image-compute-scaling-factor when it produces the coordinates.

If that doesn't work, then...

> When creating an image, we set its :map property according to the return
> value of `image-compute-scaling-factor'.  Once the image is inserted into
> the buffer, the user may run `image-increase-size' or `image-rotate',
> which changes how the image is displayed but not its :map.
> 
> Now, we need to rerun `image-compute-scaling-factor' and recompute :map.
> However, there is no hook which runs after the user runs those commands,
> so AFAICT there's no way for our code to know when to recompute :map.

...AFAIU, when an image is rescaled, we call
image-transform-properties to produce the updated image properties.
So I guess you'd like that function to recompute the coordinates in
:map according to the transform?

IOW, I don't understand why you think the problem can only be solved
in C: AFAIK almost all of the machinery that performs image transforms
is implemented in Lisp, and each time an image is rescaled, we
basically re-process the image descriptor anew.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Fri, 08 Mar 2024 00:08:01 GMT) Full text and rfc822 format available.

Message #23 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Thu, 07 Mar 2024 05:53:11 -0800
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
>> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
>> Date: Thu, 07 Mar 2024 00:08:57 -0800
>>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
> I hoped :map allows its value to be a form that is evaluated when the
> image is being processed, in which case that form could call
> image-compute-scaling-factor when it produces the coordinates.

Thanks!  Would this require a change in C?

> If that doesn't work, then...
>
>> When creating an image, we set its :map property according to the return
>> value of `image-compute-scaling-factor'.  Once the image is inserted into
>> the buffer, the user may run `image-increase-size' or `image-rotate',
>> which changes how the image is displayed but not its :map.
>>
>> Now, we need to rerun `image-compute-scaling-factor' and recompute :map.

What I said here is wrong.  `image-compute-scaling-factor' is not
useful for recomputing :map, but `image--current-scaling' is.

>> However, there is no hook which runs after the user runs those commands,
>> so AFAICT there's no way for our code to know when to recompute :map.
>
> ...AFAIU, when an image is rescaled, we call
> image-transform-properties to produce the updated image properties.

There are two ways to rescale an image, `image-transform-properties'
(defined in image-mode.el; works only on file-backed images in
image-mode) and `image--change-size' (defined in image.el; works
on any image object in any mode).

For now, I'd like to focus on improving `image.el'.

> So I guess you'd like that function to recompute the coordinates in
> :map according to the transform?
>
> IOW, I don't understand why you think the problem can only be solved
> in C: AFAIK almost all of the machinery that performs image transforms
> is implemented in Lisp, and each time an image is rescaled, we
> basically re-process the image descriptor anew.

The attached patch adds two hooks in `image.el' which allow packages to
recompute an image's map after it's rescaled or rotated.

The following demonstrates `image-after-change-size-hooks':

(progn
  (defun image--scale-map (map factor)
    "Scale MAP by FACTOR, destructively modifying it."
    (when (and factor (/= 1 factor))
      (pcase-dolist (`(,`(,type . ,coords) ,_id ,_plist) map)
        (pcase-exhaustive type
          ('rect
           (setf (caar coords) (round (* (caar coords) factor)))
           (setf (cdar coords) (round (* (cdar coords) factor)))
           (setf (cadr coords) (round (* (cadr coords) factor)))
           (setf (cddr coords) (round (* (cddr coords) factor))))
          ('circle
           (setf (caar coords) (round (* (caar coords) factor)))
           (setf (cdar coords) (round (* (cdar coords) factor)))
           (setf (cdr coords) (round (* (cdr coords) factor))))
          ('poly
           (dotimes (i (length coords))
             (aset coords i
                   (round (* (aref coords i) factor))))))))
    map)

  (defun image-rescale-image-map ()
    "Recalculate and set :map property of image at point.
Assumes that image has an :unscaled-map property."
    (when-let* ((image (image--get-imagemagick-and-warn))
                (unscaled-image (image--image-without-parameters image))
                (unscaled-map (image-property image :unscaled-map))
                (scale (image--current-scaling image unscaled-image)))
      (setf (image-property image :map)
            (image--scale-map (copy-tree unscaled-map t) scale))))

  (with-current-buffer (get-buffer-create "*image-properties-test*")
    (let* ((svg-string "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.43.0 (0)\n -->\n<!-- Title: orggraphview Pages: 1 -->\n<svg width=\"128pt\" height=\"128pt\"\n viewBox=\"0.00 0.00 127.59 127.59\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 123.59)\">\n<title>orggraphview</title>\n<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-123.59 123.59,-123.59 123.59,4 -4,4\"/>\n<!-- a -->\n<g id=\"node1\" class=\"node\">\n<title>a</title>\n<g id=\"a_node1\"><a xlink:href=\"1\" xlink:title=\"Hover me!\">\n<ellipse fill=\"none\" stroke=\"black\" cx=\"59.79\" cy=\"-59.79\" rx=\"59.59\" ry=\"59.59\"/>\n<text text-anchor=\"middle\" x=\"59.79\" y=\"-56.09\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">Hover me!</text>\n</a>\n</g>\n</g>\n</g>\n</svg>\n")
           (scale 0.75)  ; Adjust initial image scale
           (unscaled-map '(((circle (85 . 85) . 80) "1" (help-echo "Surprise!"))))
           (map (image--scale-map (copy-tree unscaled-map t) scale))
           (image
            (create-image svg-string 'svg t
                          :scale scale :map map :unscaled-map unscaled-map)))
      (add-hook 'image-after-change-size-hooks #'image-rescale-image-map nil t)
      (erase-buffer)
      (insert-image image)
      (goto-char (point-min))
      (pop-to-buffer (current-buffer)))))

After applying the attached patch, evaluate the above form, press "i +"
and "i -" repeatedly to see the image and its map scale together.

Thanks!

Joseph

[0001-Add-image-after-change-size-hooks-image-after-rotate.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Fri, 08 Mar 2024 07:15:01 GMT) Full text and rfc822 format available.

Message #26 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eli Zaretskii <eliz <at> gnu.org>, 69602 <at> debbugs.gnu.org,
 stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Thu, 07 Mar 2024 23:02:24 -0800
[Message part 1 (text/plain, inline)]
Joseph Turner <joseph <at> breatheoutbreathe.in> writes:

> The attached patch adds two hooks in `image.el' which allow packages to
> recompute an image's map after it's rescaled or rotated.

In this new attached patch, rescaling image maps is handled within
image.el.  No new hooks are added.  This change should be backwards
compatible, except that :unscaled-map is now a reserved image property.

If we decide to install this patch, I'll work on modifying image maps
inside of `image-rotate', as well as update the manual and NEWS.

Test it out!

(with-current-buffer (get-buffer-create "*image-properties-test*")
  (let* ((svg-string "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.43.0 (0)\n -->\n<!-- Title: orggraphview Pages: 1 -->\n<svg width=\"128pt\" height=\"128pt\"\n viewBox=\"0.00 0.00 127.59 127.59\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 123.59)\">\n<title>orggraphview</title>\n<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-123.59 123.59,-123.59 123.59,4 -4,4\"/>\n<!-- a -->\n<g id=\"node1\" class=\"node\">\n<title>a</title>\n<g id=\"a_node1\"><a xlink:href=\"1\" xlink:title=\"Hover me!\">\n<ellipse fill=\"none\" stroke=\"black\" cx=\"59.79\" cy=\"-59.79\" rx=\"59.59\" ry=\"59.59\"/>\n<text text-anchor=\"middle\" x=\"59.79\" y=\"-56.09\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">Hover me!</text>\n</a>\n</g>\n</g>\n</g>\n</svg>\n")
         (map '(((circle (85 . 85) . 80) "1" (help-echo "Surprise!"))))
         (image (create-image svg-string 'svg t :map map)))
    (erase-buffer)
    (insert-image image)
    (goto-char (point-min))
    (pop-to-buffer (current-buffer))))

Thank you!

Joseph

[0001-Recalculate-map-when-image-scale-changes.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Fri, 08 Mar 2024 07:26:01 GMT) Full text and rfc822 format available.

Message #29 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Fri, 08 Mar 2024 09:24:28 +0200
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
> Date: Thu, 07 Mar 2024 05:53:11 -0800
> 
> > IOW, I don't understand why you think the problem can only be solved
> > in C: AFAIK almost all of the machinery that performs image transforms
> > is implemented in Lisp, and each time an image is rescaled, we
> > basically re-process the image descriptor anew.
> 
> The attached patch adds two hooks in `image.el' which allow packages to
> recompute an image's map after it's rescaled or rotated.

Thanks, but please accompany the code change with suitable changes for
NEWS and the ELisp manual.  Bonus points for adding tests for this to
our test suite.

Also, I think we don't need the "after" part in the names of these two
hooks: their doc strings explicitly document that they are run after
the transformation, and image-change-size-hook is easier to remember,
since the name basically says "a hook run when image is resized".

And finally, please mention the hooks in the doc strings of public
functions that perform size-changes and rotations of images, as we
usually do with other hooks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Fri, 08 Mar 2024 08:33:01 GMT) Full text and rfc822 format available.

Message #32 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Fri, 08 Mar 2024 10:31:12 +0200
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Date: Thu, 07 Mar 2024 23:02:24 -0800
> 
> Joseph Turner <joseph <at> breatheoutbreathe.in> writes:
> 
> > The attached patch adds two hooks in `image.el' which allow packages to
> > recompute an image's map after it's rescaled or rotated.
> 
> In this new attached patch, rescaling image maps is handled within
> image.el.  No new hooks are added.  This change should be backwards
> compatible, except that :unscaled-map is now a reserved image property.

Are we sure no Lisp program out there would want the coordinates in
:map to remain unchanged under these transformation?  Maybe we should
add a variable to control this, so that the change could be truly
backward-compatible?

> If we decide to install this patch, I'll work on modifying image maps
> inside of `image-rotate', as well as update the manual and NEWS.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Fri, 08 Mar 2024 09:02:01 GMT) Full text and rfc822 format available.

Message #35 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Fri, 08 Mar 2024 00:39:16 -0800
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
>> Date: Thu, 07 Mar 2024 23:02:24 -0800
>>
>> Joseph Turner <joseph <at> breatheoutbreathe.in> writes:
>>
>> > The attached patch adds two hooks in `image.el' which allow packages to
>> > recompute an image's map after it's rescaled or rotated.
>>
>> In this new attached patch, rescaling image maps is handled within
>> image.el.  No new hooks are added.  This change should be backwards
>> compatible, except that :unscaled-map is now a reserved image property.
>
> Are we sure no Lisp program out there would want the coordinates in
> :map to remain unchanged under these transformation?  Maybe we should
> add a variable to control this, so that the change could be truly
> backward-compatible?

Good point.  Thanks!

What if explicitly passing :unscaled-map 'no-recalculate in
`create-image' prevented :map from being recalculated later?

If not, what kind of variable did you have in mind?  A special variable
let-bound the call?  Or another argument to `create-image'?

See patches.

[0002-Allow-map-to-not-be-recalculated-after-image-rescali.patch (text/x-diff, attachment)]
[0001-Recalculate-map-when-image-scale-changes.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Fri, 08 Mar 2024 11:52:03 GMT) Full text and rfc822 format available.

Message #38 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Fri, 08 Mar 2024 13:50:38 +0200
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
> Date: Fri, 08 Mar 2024 00:39:16 -0800
> 
> > Are we sure no Lisp program out there would want the coordinates in
> > :map to remain unchanged under these transformation?  Maybe we should
> > add a variable to control this, so that the change could be truly
> > backward-compatible?
> 
> Good point.  Thanks!
> 
> What if explicitly passing :unscaled-map 'no-recalculate in
> `create-image' prevented :map from being recalculated later?

I think that's less desirable, since some images could be created
outside of control of a Lisp program that wants to control the
coordinates.

> If not, what kind of variable did you have in mind?  A special variable
> let-bound the call?  Or another argument to `create-image'?

I had in mind a special variable (we'd need to mention it in NEWS and
in the doc string of the relevant functions).  Adding an argument is a
heavier change, and I think it is not justified in this case, because
I do agree with you that most, if not all, applications would want the
coordinates to scale together with the image.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Thu, 21 Mar 2024 06:53:01 GMT) Full text and rfc822 format available.

Message #41 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Wed, 20 Mar 2024 23:45:34 -0700
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
>> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
>> Date: Fri, 08 Mar 2024 00:39:16 -0800
>>
>> > Are we sure no Lisp program out there would want the coordinates in
>> > :map to remain unchanged under these transformation?  Maybe we should
>> > add a variable to control this, so that the change could be truly
>> > backward-compatible?
>>
>> Good point.  Thanks!
>>
>> What if explicitly passing :unscaled-map 'no-recalculate in
>> `create-image' prevented :map from being recalculated later?
>
> I think that's less desirable, since some images could be created
> outside of control of a Lisp program that wants to control the
> coordinates.
>
>> If not, what kind of variable did you have in mind?  A special variable
>> let-bound the call?  Or another argument to `create-image'?
>
> I had in mind a special variable (we'd need to mention it in NEWS and
> in the doc string of the relevant functions).  Adding an argument is a
> heavier change, and I think it is not justified in this case, because
> I do agree with you that most, if not all, applications would want the
> coordinates to scale together with the image.

Thanks for your feedback and your patience!

Please see attached patch.

Joseph

[0001-Recompute-map-when-image-scale-rotation-or-flip-chan.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Thu, 21 Mar 2024 12:02:02 GMT) Full text and rfc822 format available.

Message #44 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Thu, 21 Mar 2024 13:59:59 +0200
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
> Date: Wed, 20 Mar 2024 23:45:34 -0700
> 
> > I had in mind a special variable (we'd need to mention it in NEWS and
> > in the doc string of the relevant functions).  Adding an argument is a
> > heavier change, and I think it is not justified in this case, because
> > I do agree with you that most, if not all, applications would want the
> > coordinates to scale together with the image.
> 
> Thanks for your feedback and your patience!
> 
> Please see attached patch.

Thanks.  The tests you added have some problems:

 . you use thread-first, but don't require subr-x when compiling
 . the tests fail when run in batch mode
 . when invoked interactively in a GUI session, one test fails:

    F image--compute-map-and-original-map
	Test ‘image--compute-map’ and ‘image--compute-original-map’.
	(ert-test-failed
	 ((should (equal (image--compute-map image) flipped-map)) :form
	  (equal
	   (((circle ... . 24) "a" (help-echo "A"))
	    ((rect ... 162 . 149) "b" (help-echo "B"))
	    ((poly . [6 29 7 22 13 15 21 10 31 7 ...]) "c" (help-echo "C")))
	   (((circle ... . 24) "a" (help-echo "A"))
	    ((rect ... 161 . 149) "b" (help-echo "B"))
	    ((poly . [5 29 6 22 12 15 20 10 30 7 ...]) "c" (help-echo "C"))))
	  :value nil :explanation (list-elt 0 (list-elt 0 (cdr (car ...))))))

It looks like some pixels do not match exactly?  Perhaps some
tolerances need to be allowed?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Sat, 23 Mar 2024 00:23:01 GMT) Full text and rfc822 format available.

Message #47 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Fri, 22 Mar 2024 17:11:17 -0700
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
>> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
>> Date: Wed, 20 Mar 2024 23:45:34 -0700
>>
>> > I had in mind a special variable (we'd need to mention it in NEWS and
>> > in the doc string of the relevant functions).  Adding an argument is a
>> > heavier change, and I think it is not justified in this case, because
>> > I do agree with you that most, if not all, applications would want the
>> > coordinates to scale together with the image.
>>
>> Thanks for your feedback and your patience!
>>
>> Please see attached patch.
>
> Thanks.  The tests you added have some problems:
>
>  . you use thread-first, but don't require subr-x when compiling

I removed thread-first.

>  . the tests fail when run in batch mode

I added (skip-unless (display-images-p)) to the two problematic tests,
and it solved the issue on my machine.

>  . when invoked interactively in a GUI session, one test fails:
>
>     F image--compute-map-and-original-map
> 	Test ‘image--compute-map’ and ‘image--compute-original-map’.
> 	(ert-test-failed
> 	 ((should (equal (image--compute-map image) flipped-map)) :form
> 	  (equal
> 	   (((circle ... . 24) "a" (help-echo "A"))
> 	    ((rect ... 162 . 149) "b" (help-echo "B"))
> 	    ((poly . [6 29 7 22 13 15 21 10 31 7 ...]) "c" (help-echo "C")))
> 	   (((circle ... . 24) "a" (help-echo "A"))
> 	    ((rect ... 161 . 149) "b" (help-echo "B"))
> 	    ((poly . [5 29 6 22 12 15 20 10 30 7 ...]) "c" (help-echo "C"))))
> 	  :value nil :explanation (list-elt 0 (list-elt 0 (cdr (car ...))))))
>
> It looks like some pixels do not match exactly?  Perhaps some
> tolerances need to be allowed?

Interesting - does the result of `image-size` vary per machine?

In any case, I added `image-tests--map-equal' to compare image maps with
some tolerance. Do the tests pass on your machine now?

Thank you!

Joseph

[0001-Recompute-map-when-image-scale-rotation-or-flip-chan.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Sat, 23 Mar 2024 08:22:01 GMT) Full text and rfc822 format available.

Message #50 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Sat, 23 Mar 2024 09:58:51 +0200
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
> Date: Fri, 22 Mar 2024 17:11:17 -0700
> 
> > Thanks.  The tests you added have some problems:
> >
> >  . you use thread-first, but don't require subr-x when compiling
> 
> I removed thread-first.
> 
> >  . the tests fail when run in batch mode
> 
> I added (skip-unless (display-images-p)) to the two problematic tests,
> and it solved the issue on my machine.

Solves it here as well.

> >  . when invoked interactively in a GUI session, one test fails:
> >
> >     F image--compute-map-and-original-map
> > 	Test ‘image--compute-map’ and ‘image--compute-original-map’.
> > 	(ert-test-failed
> > 	 ((should (equal (image--compute-map image) flipped-map)) :form
> > 	  (equal
> > 	   (((circle ... . 24) "a" (help-echo "A"))
> > 	    ((rect ... 162 . 149) "b" (help-echo "B"))
> > 	    ((poly . [6 29 7 22 13 15 21 10 31 7 ...]) "c" (help-echo "C")))
> > 	   (((circle ... . 24) "a" (help-echo "A"))
> > 	    ((rect ... 161 . 149) "b" (help-echo "B"))
> > 	    ((poly . [5 29 6 22 12 15 20 10 30 7 ...]) "c" (help-echo "C"))))
> > 	  :value nil :explanation (list-elt 0 (list-elt 0 (cdr (car ...))))))
> >
> > It looks like some pixels do not match exactly?  Perhaps some
> > tolerances need to be allowed?
> 
> Interesting - does the result of `image-size` vary per machine?

I guess so.  The transformations are AFAIK done in floating-point
arithmetics, so some minor inaccuracies are possible.

> In any case, I added `image-tests--map-equal' to compare image maps with
> some tolerance. Do the tests pass on your machine now?

Yes, they do now, thanks.  However, there's a warning when compiling
the tests:

  In image-tests--map-equal:
  lisp/image-tests.el:192:17: Warning: Unused lexical variable `i'

Can you fix this, please?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Sat, 23 Mar 2024 17:56:01 GMT) Full text and rfc822 format available.

Message #53 received at 69602 <at> debbugs.gnu.org (full text, mbox):

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Sat, 23 Mar 2024 10:41:59 -0700
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
>> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
>> Date: Fri, 22 Mar 2024 17:11:17 -0700
>>
>> > Thanks.  The tests you added have some problems:
>> >
>> >  . you use thread-first, but don't require subr-x when compiling
>>
>> I removed thread-first.
>>
>> >  . the tests fail when run in batch mode
>>
>> I added (skip-unless (display-images-p)) to the two problematic tests,
>> and it solved the issue on my machine.
>
> Solves it here as well.
>
>> >  . when invoked interactively in a GUI session, one test fails:
>> >
>> >     F image--compute-map-and-original-map
>> > 	Test ‘image--compute-map’ and ‘image--compute-original-map’.
>> > 	(ert-test-failed
>> > 	 ((should (equal (image--compute-map image) flipped-map)) :form
>> > 	  (equal
>> > 	   (((circle ... . 24) "a" (help-echo "A"))
>> > 	    ((rect ... 162 . 149) "b" (help-echo "B"))
>> > 	    ((poly . [6 29 7 22 13 15 21 10 31 7 ...]) "c" (help-echo "C")))
>> > 	   (((circle ... . 24) "a" (help-echo "A"))
>> > 	    ((rect ... 161 . 149) "b" (help-echo "B"))
>> > 	    ((poly . [5 29 6 22 12 15 20 10 30 7 ...]) "c" (help-echo "C"))))
>> > 	  :value nil :explanation (list-elt 0 (list-elt 0 (cdr (car ...))))))
>> >
>> > It looks like some pixels do not match exactly?  Perhaps some
>> > tolerances need to be allowed?
>>
>> Interesting - does the result of `image-size` vary per machine?
>
> I guess so.  The transformations are AFAIK done in floating-point
> arithmetics, so some minor inaccuracies are possible.
>
>> In any case, I added `image-tests--map-equal' to compare image maps with
>> some tolerance. Do the tests pass on your machine now?
>
> Yes, they do now, thanks.  However, there's a warning when compiling
> the tests:
>
>   In image-tests--map-equal:
>   lisp/image-tests.el:192:17: Warning: Unused lexical variable `i'
>
> Can you fix this, please?

Oops!  I just re-read the dotimes docstring to discover that the RESULT
arg is deprecated.  Fixed.  Thank you!

Joseph

[0001-Recompute-map-when-image-scale-rotation-or-flip-chan.patch (text/x-diff, attachment)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 23 Mar 2024 18:00:02 GMT) Full text and rfc822 format available.

Notification sent to Joseph Turner <joseph <at> breatheoutbreathe.in>:
bug acknowledged by developer. (Sat, 23 Mar 2024 18:00:02 GMT) Full text and rfc822 format available.

Message #58 received at 69602-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: 69602-done <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Sat, 23 Mar 2024 19:58:42 +0200
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
> Date: Sat, 23 Mar 2024 10:41:59 -0700
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >   In image-tests--map-equal:
> >   lisp/image-tests.el:192:17: Warning: Unused lexical variable `i'
> >
> > Can you fix this, please?
> 
> Oops!  I just re-read the dotimes docstring to discover that the RESULT
> arg is deprecated.  Fixed.  Thank you!

Thanks, installed on master, and closing the bug.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Sat, 23 Mar 2024 18:40:02 GMT) Full text and rfc822 format available.

Message #61 received at 69602-done <at> debbugs.gnu.org (full text, mbox):

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 69602-done <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Sat, 23 Mar 2024 11:18:28 -0700
Thank you!

Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
>> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
>> Date: Sat, 23 Mar 2024 10:41:59 -0700
>>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>
>> >   In image-tests--map-equal:
>> >   lisp/image-tests.el:192:17: Warning: Unused lexical variable `i'
>> >
>> > Can you fix this, please?
>>
>> Oops!  I just re-read the dotimes docstring to discover that the RESULT
>> arg is deprecated.  Fixed.  Thank you!
>
> Thanks, installed on master, and closing the bug.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Sat, 23 Mar 2024 20:34:02 GMT) Full text and rfc822 format available.

Message #64 received at 69602-done <at> debbugs.gnu.org (full text, mbox):

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 69602-done <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Sat, 23 Mar 2024 13:32:05 -0700
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
>> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
>> Date: Sat, 23 Mar 2024 10:41:59 -0700
>>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>
>> >   In image-tests--map-equal:
>> >   lisp/image-tests.el:192:17: Warning: Unused lexical variable `i'
>> >
>> > Can you fix this, please?
>>
>> Oops!  I just re-read the dotimes docstring to discover that the RESULT
>> arg is deprecated.  Fixed.  Thank you!
>
> Thanks, installed on master, and closing the bug.

Another minor improvement.  Please see patch.

Joseph

[0001-copy-tree-just-image-map-not-entire-image.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69602; Package emacs. (Thu, 28 Mar 2024 10:14:01 GMT) Full text and rfc822 format available.

Message #67 received at 69602-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: 69602-done <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
Subject: Re: bug#69602: 29.1; Image :map should adjust with :scale and
 :rotation
Date: Thu, 28 Mar 2024 12:13:09 +0200
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Cc: 69602-done <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
> Date: Sat, 23 Mar 2024 13:32:05 -0700
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> >> Cc: 69602 <at> debbugs.gnu.org, stephen.berman <at> gmx.net, juri <at> linkov.net
> >> Date: Sat, 23 Mar 2024 10:41:59 -0700
> >>
> >> Eli Zaretskii <eliz <at> gnu.org> writes:
> >>
> >> >   In image-tests--map-equal:
> >> >   lisp/image-tests.el:192:17: Warning: Unused lexical variable `i'
> >> >
> >> > Can you fix this, please?
> >>
> >> Oops!  I just re-read the dotimes docstring to discover that the RESULT
> >> arg is deprecated.  Fixed.  Thank you!
> >
> > Thanks, installed on master, and closing the bug.
> 
> Another minor improvement.  Please see patch.

Thanks, installed.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 25 Apr 2024 11:24:47 GMT) Full text and rfc822 format available.

This bug report was last modified 9 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.