diff options
author | Charles A. Roelli <charles@aurox.ch> | 2018-03-11 11:13:47 +0100 |
---|---|---|
committer | Charles A. Roelli <charles@aurox.ch> | 2018-03-11 11:13:47 +0100 |
commit | 08aa6a0533c44771fb8c43771d806d3bf6ac3776 (patch) | |
tree | fe2088040acda5b7403e9ca4cea51668b984b6f8 /lisp/image.el | |
parent | d48f4c3be13f8894964dad160f98ff8a7c7c3561 (diff) | |
download | emacs-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.el | 8 |
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 |