本文介绍了如何使用特定协议(在我的情况下:txmt)与组织模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有在Mac上运行的TextMate,它有协议,我可以使用Web浏览器,如 txmt:// open /?url = file:/// Users / smcho / smcho / bin / rst2html 。我可以使用TextMate编辑rst2html。



但是,当我尝试使用Org模式的此协议作为 [txmt://打开/ ?url = file:/// Users / smcho / smcho / bin / rst2html] ,而不是打开TextMate,rst2html二进制文件正在运行。



我试过

 (setq org-link-abbrev-alist 
'(
。txmt:// open /?url = file://%s)
))

使用 ,但我得到相同的结果。



如何使用特定协议(在我的情况下是txmt)与组织模式?



ADDED



它不使用协议,但可以运行打开并使用此命令编辑一些文件。

 (编辑shell:/ usr / local / bin / mate%s)


解决方案

我认为组织模式只能处理(也可能是其他一些链接类型,例如链接到git repos,礼貌的contrib包)。我不是TextMate / Apple用户,但在我看来,txmt://协议在问题只是一个处理器TextMate为安装的浏览器设置;你不能指望这可以使用org。



真正的问题是 - 你可以设置一个链接,以便在TextMate中打开一个特定的文件。最直接的方法是发出一个shell命令,它将在TextMate中打开文件。使用org-link-abbrev-alist,您可以执行类似(edit。shell:/ path / to / textmate_binary%s&)。您还需要使用(setq org-confirm-shell-link-function nil)来禁止确认提示。



一般来说,始终可以按照 here ;这涉及到在elisp中编写处理函数。在这种情况下,这将是一个使用例如启动TextMate的调用。 启动过程。这将是一个更清洁的解决方案,但可能不值得额外的努力。在自定义组织链接处理程序中,通过 org-link-abbrev-alist 设置快捷方式通常就足够了,或者通过设置基于扩展名的处理程序org-file-apps


I have TextMate running on Mac, and it has txmt protocol, that I can use as on web browser such as txmt://open/?url=file:///Users/smcho/smcho/bin/rst2html. I can use TextMate for editing rst2html.

However, when I tried to use this protocol with Org-mode as [txmt://open/?url=file:///Users/smcho/smcho/bin/rst2html], instead of opening TextMate, the rst2html binary is running.

I tried

(setq org-link-abbrev-alist
 '(
   ("edit" . "txmt://open/?url=file://%s")
))

to use [edit:/Users/smcho/smcho/bin/rst2html], but I get the same result.

How can I use specific protocol (in my case : txmt) with Org mode?

ADDED

It's not using protocol, but one can run open and edit some file with this command.

("edit" . "shell:/usr/local/bin/mate %s")
解决方案

I believe org-mode can only handle links specified on this page (and maybe a few other link types, e.g. links to git repos, courtesy of contrib packages). I'm not a TextMate/Apple user, but it seems to me that txmt:// protocol in the question is just a handler TextMate sets up for the installed browsers; you can't expect this to work with org.

The real question is -- can you set up a link so that a particular file is opened in TextMate. The most straightforward way is to issue a shell command that will open the file in TextMate. Using org-link-abbrev-alist, you could do something like ("edit" . "shell:/path/to/textmate_binary %s &"). You'll also want to use (setq org-confirm-shell-link-function nil) to suppress the confirmation prompt.

In general, it is always possible to create custom link types as described here; this involves writing the handler function in elisp. In this case, this would be a call to start TextMate using e.g. start-process. This would be a cleaner solution, but probably not worth the extra effort. In customizing org link handlers, it is usually sufficient to set up shortcuts via org-link-abbrev-alist, or set up handlers based on extension via org-file-apps.

这篇关于如何使用特定协议(在我的情况下:txmt)与组织模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 01:07