]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve image-dired-thumbnail-display-external
authorStefan Kangas <stefankangas@gmail.com>
Sat, 24 Sep 2022 09:06:51 +0000 (11:06 +0200)
committerStefan Kangas <stefankangas@gmail.com>
Sat, 24 Sep 2022 09:26:06 +0000 (11:26 +0200)
* lisp/image/image-dired.el: (image-dired-external-viewer): Add more
image viewers and slightly re-arrange.
(image-dired-thumbnail-display-external): Correctly handle
external viewers with spaces or flags.

lisp/image/image-dired.el

index 1b7ec740f0f02906f98f2db8cd6430f267be2216..1fe0ffb838c5386b2a53bfb0d8d16aa7c6d6706b 100644 (file)
@@ -316,14 +316,16 @@ displaying:
 (defcustom image-dired-external-viewer
   ;; TODO: Use mailcap, dired-guess-shell-alist-default,
   ;; dired-view-command-alist.
-  (cond ((executable-find "display"))
-        ((executable-find "xli"))
+  (cond ((executable-find "display") "display")
+        ((executable-find "feh") "feh")
+        ((executable-find "gm") "gm display")
+        ((executable-find "xli") "xli")
         ((executable-find "qiv") "qiv -t")
-        ((executable-find "feh") "feh"))
+        ((executable-find "xloadimage") "xloadimage"))
   "Name of external viewer.
 Including parameters.  Used when displaying original image from
 `image-dired-thumbnail-mode'."
-  :version "28.1"
+  :version "29.1"
   :type '(choice string
                  (const :tag "Not Set" nil)))
 
@@ -1119,8 +1121,9 @@ Ask user how many thumbnails should be displayed per row."
         (message "No thumbnail at point")
       (if (not file)
           (message "No original file name found")
-        (start-process "image-dired-thumb-external" nil
-                       image-dired-external-viewer file)))))
+        (apply #'start-process "image-dired-thumb-external" nil
+               (append (string-split image-dired-external-viewer " ")
+                       (list file)))))))
 
 (defun image-dired-display-image (file &optional _ignored)
   "Display image FILE in the image buffer window.