在Org模式下的Emacs,如何将文件发送到特定程序

时间:2013-07-08 02:05:01

标签: emacs org-mode

我想制作链接,例如有时将文本文件发送到Firefox,有时发送给Gedit。

如何建立链接以告知Firefox打开该文件。

系统必须是多功能的,因为有时我会向Firefox发送一个.jpg,有时我会使用另一个程序,但它必须作为超链接链接。

2 个答案:

答案 0 :(得分:1)

openwith.el文件怎么样?

http://www.emacswiki.org/emacs/OpenWith

答案 1 :(得分:1)

这个怎么样:

(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