Subject: bug#20508: 24.4; image map properties not working as described

From: patrick mc allister <[email-masked]>
Date: Tue, 5 May 2015 19:27:54 +0200

On Tue, May 05, 2015 at 07:32:01PM +0300, Eli Zaretskii wrote:
>
> It's a cockpit error: you should use 'pointer', not ':pointer' in the
> first instance.  IOW, this works for me (note the underlined part):
> 
> (defun image-wipe-and-insert ()
>   (interactive)
>   (let ()
>     (with-current-buffer (get-buffer-create "*an image area test buffer*")
>       (switch-to-buffer (current-buffer))
>       (erase-buffer)
>       (insert-image (find-image '((:type png :file "/usr/share/emacs/24.4/etc/images/icons/hicolor/128x128/apps/emacs.png"
>                      :map  '((rect . ((0 . 0) . (50 . 50))) anAreaID (pointer hourglass :help-echo "You found an area!"))
>                      ;;                                               ^^^^^^^
>                      ;; :relief -20
>                      ;; :conversion laplace
>                      :margin (0 . 0)
>                      :pointer arrow)))))))
> 
> (Yes, it's confusing to have ':pointer' on the top level and 'pointer'
> inside the value for ':map'.  But the manual correctly says 'pointer'
> in the latter case, so at least the documentation is consistent with
> the code.)

Thanks a lot, indeed I missed that point!

Now, however, I have a follow-up problem (which kind-of nearly fits
the subject line): I was actually trying to get more than one of these
hotspots onto the image, something like this:

(defun image-wipe-and-insert-two-maps ()
  (interactive)
  (let ()
    (with-current-buffer (get-buffer-create "*an image area test buffer*")
      (switch-to-buffer (current-buffer))
      (erase-buffer)
      (insert-image (find-image '((:type png :file "/usr/share/emacs/24.4/etc/images/icons/hicolor/128x128/apps/emacs.png"
					 :map '(
						((rect . ((0 . 0) . (50 . 50))) anAreaID (pointer hourglass help-echo "You found an area!"))
						((rect . ((51 . 51) . (100 . 100))) aSecondAreaID (pointer hand help-echo "You found another area!")))
					 ;; :relief -20
					 ;; :conversion laplace
					 :margin (0 . 0)
					 :pointer arrow)))))))

I thought this would be in accordance to the info node, where it says:
``An image map is an alist where each element has the format `(AREA ID
PLIST)'." 

But my attempt to insert two of those elements leads to no :map
properties being shown for the image.

They are there, though:

(with-current-buffer "*an image area test buffer*"
  (pp (text-properties-at (point-min)) (current-buffer)))

gives me:

(rear-nonsticky
 (display)
 display
 (image :type png :file "/usr/share/emacs/24.4/etc/images/icons/hicolor/128x128/apps/emacs.png" :map
	'(((rect
	    (0 . 0)
	    50 . 50)
	   anAreaID
	   (pointer hourglass help-echo "You found an area!"))
	  ((rect
	    (51 . 51)
	    100 . 100)
	   aSecondAreaID
	   (pointer hand help-echo "You found another area!")))
	:margin
	(0 . 0)
	:pointer arrow))

-- 
patrick