我想用 evince 而不是 DocView 模式打开一个 pdf。是否有可能使用“evince”之类的特定命令打开文件?
问问题
15848 次
7 回答
31
是的。使用!
while in dired 在文件上运行 shell 命令。
在 的情况下evince
,使用 更聪明&
,但是,它将异步运行命令,因此当您打开 PDF 时,emacs 仍然可用。
于 2011-07-27T13:24:14.043 回答
20
有不止一种方法可以做到这一点。我建议OpenWith库。您的案例的设置可能如下所示:
(add-to-list 'load-path "/path/to/downloaded/openwith.el")
(require 'openwith)
(setq openwith-associations '(("\\.pdf\\'" "evince" (file))))
(openwith-mode t)
它设置了文件处理程序,可以同时使用dired
和find-file
。
于 2011-07-27T13:50:39.867 回答
10
尝试这个。
(defun dired-open-file ()
"In dired, open the file named on this line."
(interactive)
(let* ((file (dired-get-filename nil t)))
(message "Opening %s..." file)
(call-process "gnome-open" nil 0 nil file)
(message "Opening %s done" file)))
于 2011-07-28T02:57:13.013 回答
5
您可以使用!
打开文件然后指定命令。
于 2011-07-27T13:24:36.850 回答
2
在 Windows 中,我不喜欢使用 ! 并命令“资源管理器”打开 PDF/Word/Excel...
于 2014-11-14T06:04:38.720 回答
0
(defun dired-open()
(interactive)
(setq file (dired-get-file-for-visit))
(setq ext (file-name-extension file))
(cond ((string= ext "pdf")
;; shell-quote-argument escapes white spaces on the file name
(async-shell-command (concat "zathura " (shell-quote-argument file))))
((string= ext "epub")
(async-shell-command (concat "zathura " (shell-quote-argument file))))
((string= ext "rar")
(async-shell-command (concat "file-roller " (shell-quote-argument file))))
((string= ext "zip")
(async-shell-command (concat "file-roller " (shell-quote-argument file))))
(t (dired-find-file))))
于 2020-02-21T07:19:50.047 回答