Emacs组织模式文件/查看器关联 [英] Emacs org-mode file/viewer associations

查看:180
本文介绍了Emacs组织模式文件/查看器关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Emacs组织模式文件中,当我点击PDF时,该文件将在PDF查看器中打开。同样,当我点击一个URL时,它会在网络浏览器中打开。但是当我点击图像文件的路径时,字节流在编辑器中打开为文本。如何配置Emacs /组织模式以打开具有指定应用程序的图像,例如图像编辑器或浏览器?

In an Emacs org-mode file, when I click on a PDF the file opens in a PDF viewer. Similarly, when I click on a URL it opens in a web browser. But when I click on a path to an image file, the byte stream opens as text in the editor. How do I configure Emacs/org-mode to open images with a specified application, say an image editor or a browser?

推荐答案

在组织模式下,这是组织文件应用程序,用于控制点击类似URL的文本时要执行的操作。

In org-mode, this is org-file-apps that control what to do when clicking on a URL-like text.

默认配置为:

((auto-mode . emacs)
 ("\\.mm\\'" . default)
 ("\\.x?html?\\'" . default)
 ("\\.pdf\\'" . default))

正如在org -file-apps帮助:自动模式匹配与 auto-mode-alist 中的任何条目匹配的文件,所以所有文件Emacs都知道如何处理。使用命令 emacs 将打开Emacs中的大多数文件。

As said in org-file-apps help : auto-mode matches files that are matched by any entry in auto-mode-alist, so all files Emacs knows how to handle. Using this with command emacs will open most files in Emacs.

您可能会在自动 - 模式ALIST。您可以通过在.emacs(例如png文件)中执行此操作来覆盖此异常:

You may have image file extension configured in auto-mode-alist. You could override this alist by doing something like this in your .emacs (for example, for png files) :

(add-hook 'org-mode-hook
      '(lambda ()
             (setq org-file-apps
                   (append '(
                             ("\\.png\\'" . default)
                             ) org-file-apps ))))

使用此代码,当我点击这样的链接:

With this code, when I click on a link like this :

file:///e:/jrx/emacs/image.png

它打开emacs外的文件,使用默认的操作系统程序关联到这个文件扩展名。

It opens the file outside emacs, using the default OS program associated to this file extension.

您不必更改 org-file-apps-defaults-windowsnt org-file-apps-defaults-gnu org-file-apps-defaults-macosx 使用操作系统默认与文件扩展名关联的程序。

You don't have to change org-file-apps-defaults-windowsnt, org-file-apps-defaults-gnu or org-file-apps-defaults-macosx to use the OS default program associated to the file extension.

这篇关于Emacs组织模式文件/查看器关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆