Commit 08aa6a05 authored by Charles A. Roelli's avatar Charles A. Roelli

Improve and make use of 'image--get-image'

* lisp/image.el (image--get-image): Add documentation, and
check overlays for images too (since function 'put-image' from
the same library uses overlays to insert images).
(image-save): Use 'image--get-image'.
parent d48f4c3b
......@@ -971,7 +971,8 @@ default is 20%."
0.8)))
(defun image--get-image ()
(let ((image (get-text-property (point) 'display)))
"Return the image at point."
(let ((image (get-char-property (point) 'display)))
(unless (eq (car-safe image) 'image)
(error "No image under point"))
image))
......@@ -1026,10 +1027,7 @@ default is 20%."
(defun image-save ()
"Save the image under point."
(interactive)
(let ((image (get-text-property (point) 'display)))
(when (or (not (consp image))
(not (eq (car image) 'image)))
(error "No image under point"))
(let ((image (image--get-image)))
(with-temp-buffer
(let ((file (plist-get (cdr image) :file)))
(if file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment