【发布时间】:2010-02-17 20:54:42
【问题描述】:
我正在尝试在 Windows XP 上的 emacs 中调整 dired-find-file 函数,以便当我从 dired 打开(例如)一个 pdf 文件时,它会启动 Acrobat Reader 的副本并用它打开该文件,而不是打开它在emacs中。但我不知道要使用shell-command/call-process 上的哪个变体。到目前为止,这是我所拥有的:
(defadvice dired-find-file (around dired-find-file-external (filename &optional wildcards))
"Open non-text files with an appropriate external program."
(if (string= ".pdf" (substring filename (- (length filename) 4))) ; obviously I'll replace this with something more general/robust
(shell-command filename) ;; what should go here?
(ad-do-it)))
(ad-activate 'dired-find-file)
我知道我可以通过为其提供 .exe 文件的位置来对其进行硬编码以启动 Acrobat Reader。但我宁愿有一些需要我进行较少搜索并且在默认应用程序移动/更改时不会中断的东西。我应该使用什么?
【问题讨论】: