GNU bug report logs - #77429
31.0.50; Image map and display slice on mode/header/tab line

Previous Next

Package: emacs;

Reported by: David Ponce <da_vid <at> orange.fr>

Date: Tue, 1 Apr 2025 13:09:02 UTC

Severity: normal

Found in version 31.0.50

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

Bug is archived. No further changes may be made.

Full log


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

From: David Ponce <da_vid <at> orange.fr>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 77429 <at> debbugs.gnu.org
Subject: Re: bug#77429: 31.0.50; Image map and display slice on
 mode/header/tab line
Date: Tue, 1 Apr 2025 19:57:14 +0200
On 2025-04-01 17:43, Eli Zaretskii wrote:
>> Date: Tue, 1 Apr 2025 15:06:49 +0200
>> From:  David Ponce via "Bug reports for GNU Emacs,
>>   the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>
>> (require 'svg)
>> (let* ((w 304)
>>          (h (frame-char-height))
>>          (svg (svg-create w h)))
>>     (svg-rectangle svg 0   0 100 h :fill "red")
>>     (svg-rectangle svg 102 0 100 h :fill "green")
>>     (svg-rectangle svg 204 0 100 h :fill "blue")
>>     (let* ((img (svg-image svg :scale 1
>>                            :map
>>                            `(
>>                              ((rect . ((0   . 0) . (100 . ,h)))
>>                               r (help-echo "RED"   pointer hand))
>>                              ((rect . ((102 . 0) . (202 . ,h)))
>>                               g (help-echo "GREEN" pointer hand))
>>                              ((rect . ((204 . 0) . (304 . ,h)))
>>                               b (help-echo "BLUE"  pointer hand))
>>                              )))
>>            (full (propertize " " 'display img))
>>            (cut  (propertize " " 'display `((slice 102 0 202 1.0) ,img)))
>>            (both (concat cut " " full)))
>>       (setq header-line-format both)
>>       (insert both "\n")))
>>
>> I'm reporting this inconsistency, at least to find out if it's a real
>> bug or a limitation that needs to be addressed by the programmer.
> 
> Bug.  And a very old one.  Should be fixed now on the master branch;
> please test.

It seems the bug is only partially fixed.  The image map behaves as
expected for the help-echo and pointer properties, but doesn't report
the correct hot spot ID.  The updated recipe below illustrates this:

(require 'svg)
(let* ((w 304)
       (h (frame-char-height))
       (svg (svg-create w h))
       (km (define-keymap
             "<r> <mouse-1>"
             (lambda () (interactive) (message "Red"))
             "<g> <mouse-1>"
             (lambda () (interactive) (message "Green"))
             "<b> <mouse-1>"
             (lambda () (interactive) (message "Blue")))))
  (svg-rectangle svg 0   0 100 h :fill "red")
  (svg-rectangle svg 102 0 100 h :fill "green")
  (svg-rectangle svg 204 0 100 h :fill "blue")
  (let* ((img (svg-image svg :scale 1
                         :map
                         `(
                           ((rect . ((0   . 0) . (100 . ,h)))
                            r (help-echo "RED"   pointer hand))
                           ((rect . ((102 . 0) . (202 . ,h)))
                            g (help-echo "GREEN" pointer hand))
                           ((rect . ((204 . 0) . (304 . ,h)))
                            b (help-echo "BLUE"  pointer hand))
                           )))
         (full (propertize " " 'display img
                           'keymap km))
         (cut  (propertize " " 'display `((slice 102 0 202 1.0) ,img)
                           'keymap km))
         (both (concat cut " " full)))
    (setq header-line-format both)
    (insert both "\n")))

Thanks!




This bug report was last modified 49 days ago.

Previous Next


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