问题描述
我有在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)
来禁止确认提示。
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)与组织模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!