1

我想创建链接并有时将文本文件发送到 Firefox,有时发送到 Gedit。

如何创建链接以告诉 Firefox 打开文件。

系统必须是通用的,因为有时我会向 Firefox 发送 .jpg 文件,有时我会使用另一个程序,但它必须以超链接的形式链接。

4

2 回答 2

1

文件 openwith.el 怎么样?

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

于 2013-07-08T04:38:04.743 回答
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

于 2013-07-08T17:19:48.403 回答