aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2024-06-01 20:50:40 +0300
committerEli Zaretskii2024-06-01 20:50:40 +0300
commit8ecf1a995fc318ea055cbc71f9223340feb2acd0 (patch)
treeef1838ac0f1037d6bd9bb02e4c6ec088cb073018
parentd98ec75d649758c9fe96a7054c0a7829d04525a0 (diff)
downloademacs-8ecf1a995fc318ea055cbc71f9223340feb2acd0.tar.gz
emacs-8ecf1a995fc318ea055cbc71f9223340feb2acd0.zip
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.
-rw-r--r--lisp/image/image-dired-external.el21
1 files changed, 13 insertions, 8 deletions
diff --git a/lisp/image/image-dired-external.el b/lisp/image/image-dired-external.el
index 1fa94e06e02..8a270bb9388 100644
--- a/lisp/image/image-dired-external.el
+++ b/lisp/image/image-dired-external.el
@@ -609,13 +609,18 @@ default value at the prompt."
609 (if (not (image-dired-image-at-point-p)) 609 (if (not (image-dired-image-at-point-p))
610 (message "No thumbnail at point") 610 (message "No thumbnail at point")
611 (let* ((file (image-dired-original-file-name)) 611 (let* ((file (image-dired-original-file-name))
612 (old-value (or (exif-field 'description (exif-parse-file file)) ""))) 612 (old-value (or (exif-field 'description (exif-parse-file file)) ""))
613 (if (eq 0 613 (defdir default-directory))
614 (image-dired-set-exif-data file "ImageDescription" 614 (with-temp-buffer
615 (read-string "Value of ImageDescription: " 615 (setq default-directory defdir)
616 old-value))) 616 (if (eq 0
617 (message "Successfully wrote ImageDescription tag") 617 (image-dired-set-exif-data file "ImageDescription"
618 (error "Could not write ImageDescription tag"))))) 618 (read-string
619 "Value of ImageDescription: "
620 old-value)))
621 (message "Successfully wrote ImageDescription tag")
622 (error "Could not write ImageDescription tag: %s"
623 (string-replace "\n" "" (buffer-string))))))))
619 624
620(defun image-dired-set-exif-data (file tag-name tag-value) 625(defun image-dired-set-exif-data (file tag-name tag-value)
621 "In FILE, set EXIF tag TAG-NAME to value TAG-VALUE." 626 "In FILE, set EXIF tag TAG-NAME to value TAG-VALUE."
@@ -627,7 +632,7 @@ default value at the prompt."
627 (cons ?u (image-dired--file-URI (expand-file-name file))) 632 (cons ?u (image-dired--file-URI (expand-file-name file)))
628 (cons ?t tag-name) 633 (cons ?t tag-name)
629 (cons ?v tag-value)))) 634 (cons ?v tag-value))))
630 (apply #'call-process image-dired-cmd-write-exif-data-program nil nil nil 635 (apply #'call-process image-dired-cmd-write-exif-data-program nil t nil
631 (mapcar (lambda (arg) (format-spec arg spec)) 636 (mapcar (lambda (arg) (format-spec arg spec))
632 image-dired-cmd-write-exif-data-options)))) 637 image-dired-cmd-write-exif-data-options))))
633 638