【Emacs】dired-modeでGNU sushiを使ったファイルプレビュー機能の実装 / Implementaion of file preview function using GNU sushi in dired-mode

こうする. call-process-shell-command の活用がカギだった.

(with-eval-after-load "dired"
  (defvar dired-sushi-search-command
    "xdotool search --desktop 0 org.gnome.NautilusPreviewer windowactivate")
  (defun dired-sushi ()
    (interactive)
    (call-process-shell-command 
     (format "sushi %s; sleep 0.1; %s" (dired-get-file-for-visit)
             dired-sushi-search-command)
     nil 0))
  (define-key dired-mode-map (kbd "SPC") #'dired-sushi)
  )