我想创建链接,并将文本文件发送到Firefox,有时发送到Gedit。
我如何制作一个链接来告诉Firefox打开该文件。
这个系统必须是通用的,因为有时我会向Firefox发送.jpg,有时我会使用另一个程序,但它必须作为超链接链接。
这个怎么样:
(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
。
用.el打开文件怎么样?
http://www.emacswiki.org/emacs/OpenWith