summaryrefslogtreecommitdiff
path: root/lisp/image.el
diff options
context:
space:
mode:
authorCharles A. Roelli <charles@aurox.ch>2018-03-11 11:13:47 +0100
committerCharles A. Roelli <charles@aurox.ch>2018-03-11 11:13:47 +0100
commit08aa6a0533c44771fb8c43771d806d3bf6ac3776 (patch)
treefe2088040acda5b7403e9ca4cea51668b984b6f8 /lisp/image.el
parentd48f4c3be13f8894964dad160f98ff8a7c7c3561 (diff)
downloademacs-08aa6a0533c44771fb8c43771d806d3bf6ac3776.tar.gz
emacs-08aa6a0533c44771fb8c43771d806d3bf6ac3776.tar.bz2
emacs-08aa6a0533c44771fb8c43771d806d3bf6ac3776.zip
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'.
Diffstat (limited to 'lisp/image.el')
-rw-r--r--lisp/image.el8
1 files changed, 3 insertions, 5 deletions
diff --git a/lisp/image.el b/lisp/image.el
index b69bf930545..ab868f7db35 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -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