From: Charles A. Roelli Date: Sun, 11 Mar 2018 10:13:47 +0000 (+0100) Subject: Improve and make use of 'image--get-image' X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e2b6627e2ae0c2f9992c08b2129718facdebed5c;p=emacs.git 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'. --- 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