1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Improve error handling in 'image-dired-thumbnail-set-image-description'.

* lisp/image/image-dired-external.el
(image-dired-thumbnail-set-image-description): Show more detailed
error messages in case of failure.
This commit is contained in:
Eli Zaretskii 2024-06-01 20:50:40 +03:00
parent d98ec75d64
commit 8ecf1a995f

View file

@ -609,13 +609,18 @@ default value at the prompt."
(if (not (image-dired-image-at-point-p))
(message "No thumbnail at point")
(let* ((file (image-dired-original-file-name))
(old-value (or (exif-field 'description (exif-parse-file file)) "")))
(if (eq 0
(image-dired-set-exif-data file "ImageDescription"
(read-string "Value of ImageDescription: "
old-value)))
(message "Successfully wrote ImageDescription tag")
(error "Could not write ImageDescription tag")))))
(old-value (or (exif-field 'description (exif-parse-file file)) ""))
(defdir default-directory))
(with-temp-buffer
(setq default-directory defdir)
(if (eq 0
(image-dired-set-exif-data file "ImageDescription"
(read-string
"Value of ImageDescription: "
old-value)))
(message "Successfully wrote ImageDescription tag")
(error "Could not write ImageDescription tag: %s"
(string-replace "\n" "" (buffer-string))))))))
(defun image-dired-set-exif-data (file tag-name tag-value)
"In FILE, set EXIF tag TAG-NAME to value TAG-VALUE."
@ -627,7 +632,7 @@ default value at the prompt."
(cons ?u (image-dired--file-URI (expand-file-name file)))
(cons ?t tag-name)
(cons ?v tag-value))))
(apply #'call-process image-dired-cmd-write-exif-data-program nil nil nil
(apply #'call-process image-dired-cmd-write-exif-data-program nil t nil
(mapcar (lambda (arg) (format-spec arg spec))
image-dired-cmd-write-exif-data-options))))