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

From: Eli Zaretskii <[email-masked]>
Date: Tue, 05 May 2015 22:14:31 +0300

> Date: Tue, 5 May 2015 19:27:54 +0200
> From: patrick mc allister <[email-masked]>
> Cc: [email-masked]
> 
> 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)'." 

This variant works as you expect:

(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 (list
						((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)))))))

(Figuring out why you need that explicit call to 'list' is left as an
exercise ;-)