我正在尝试在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
属性有两个问题:
- (如何)我可以指定多个矩形?
- 额外属性
:help-echo
和:pointer
中的值似乎没有影响。语法有误吗?
我认为相关的信息节点在这里:info:elisp#Image Descriptors
(= http://www.gnu.org/software/emacs/manual/html_node/elisp/Image-Descriptors.html)
-
正如它所说,图像
:map
值是无形的。 您的示例使用单个元素。 -
正确的属性是
help-echo
和pointer
(无冒号)(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)))))))