我想创建链接并有时将文本文件发送到 Firefox,有时发送到 Gedit。
如何创建链接以告诉 Firefox 打开文件。
系统必须是通用的,因为有时我会向 Firefox 发送 .jpg 文件,有时我会使用另一个程序,但它必须以超链接的形式链接。
文件 openwith.el 怎么样?
这个怎么样:
(setq reverse-org-file-apps
'(("firefox %s" . "\\.\\(?:xhtml\\|html\\|txt\\|jpg\\|png\\)")
("gedit %s" . "\\(?:txt\\|cc\\)")
("evince \"%s\"" . "\\.pdf\\'")
("okular \"%s\"" . "\\.pdf\\'")))
(defun new-org-open-at-point (program)
(interactive
(list
(completing-read "Open with: "
reverse-org-file-apps
nil t)))
(let* ((chosen-program (assoc program reverse-org-file-apps))
(org-file-apps (list (cons (cdr chosen-program)
(car chosen-program)))))
(org-open-at-point)))
(global-set-key (kbd "C-z") 'new-org-open-at-point)
每次调用new-org-open-at-point
时,它都会为您提供一个包含可能应用程序的完成小缓冲区。您可以随意扩展reverse-org-file-apps
。