Dirvish: 基于 Dired 的极简、一站式文件管理器

一些在 Windows 上使用 Dirvish 的心得:

图片预览
在 Windows 下,之所以默认的图片预览会有问题,是因为 Windows 自带一个叫 convert.exe 的程序,与 ImageMagick 的 convert 冲突,系统默认会调用 Windows 自带的 convert。
在 Emacs 中将 ImageMagick 的路径排到最前面解决问题:

  (setenv "PATH" (concat "d:/Env/media/imagemagick/;" (getenv "PATH")))
  (add-to-list 'exec-path "d:\\Env\\media\\imagemagick")

图片 MediaInfo
多重原因导致图片的 MediaInfo 无法显示。
首先 Dirvish 里,判断是否进行图片 MediaInfo 时,有这样一行:

(defcustom dirvish-show-media-properties
  (and (executable-find "mediainfo") (executable-find "pdfinfo") t)
  "Show media properties automatically in preview window."
  :group 'dirvish :type 'boolean)

也就是说不仅要安装 MediaInfo,还得同时安装 poppler(pdfinfo)才行

然后就是 Windows 的路径问题,如果不使用 utf8-beta 选项,运行时传给 MediaInfo 的文件路径会是一坨乱码。解决方式也很简单,可以找找站内关于 Windows UTF8 设置的帖子。

  (setq default-process-coding-system '(utf-8 . gbk))

视频预览
Dirvish 默认使用 ffmpegthumbnailer 来进行视频缩略图生成。
这玩意并不支持 Windows。试着在 msys2 环境编译,但失败了。于是我选择换一个程序。
目前用的是 mtn: movie thumbnailer 3.4.2 Free Download - VideoHelp
preview-dispatcher 如下:

    (dirvish-define-preview mtn (file ext preview-window)
      "Preview video files.
  Require: `mtn' (executable)"
      :require ("mtn")
      (when (member ext dirvish-video-exts)
        (let* ((width (dirvish-media--img-size preview-window))
               (height (dirvish-media--img-size preview-window 'height))
               (cache (dirvish-media--cache-path file (format "images/%s" width) ".jpg"))
               (path (dirvish--get-parent-path cache)))
          (if (file-exists-p cache)
              `(img . ,(create-image cache nil nil :max-width width :max-height height))
            `(cache . ("mtn" "-P" "-i" "-c" "1" "-r" "1" "-O" ,path ,file "-o"
                       ,(format ".%s.jpg" ext) "-w"
                       ,(number-to-string width)))))))
    (add-to-list 'dirvish-preview-dispatchers 'mtn)
4 个赞