在图像上放置 :map 属性



我正在尝试在emacs中插入一个图像,如下所示:

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

这种工作,并且似乎在右上角创建了一个区域(也适用于鼠标点击)。但是我对:map属性有两个问题:

  1. (如何)我可以指定多个矩形?
  2. 额外属性 :help-echo:pointer 中的值似乎没有影响。语法有误吗?

我认为相关的信息节点在这里:info:elisp#Image Descriptors(= http://www.gnu.org/software/emacs/manual/html_node/elisp/Image-Descriptors.html)

  1. 正如它所说,图像:map值是无形的。 您的示例使用单个元素。

  2. 正确的属性是help-echopointer(无冒号)

    (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 "icons/hicolor/128x128/apps/emacs.png"
                  :map (((rect . ((0 . 0) . (50 . 50)))
                     area1
                     (pointer hourglass
                      help-echo "You found the first area!"))
                    ((rect . ((50 . 50) . (100 . 100)))
                     area2
                     (pointer hand
                      help-echo "You found the second area!")))
                  :margin (2 . 2)
                  :pointer arrow)))))))
    

最新更新