如何在Openbox上使用组织协议? [英] How can I make org-protocol work on Openbox?

查看:72
本文介绍了如何在Openbox上使用组织协议?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了说明-我在< a href = https://en.wikipedia.org/wiki/Lubuntu rel = nofollow noreferrer> Lubuntu (打开框)。但我收到错误消息

I tried the instructions - I am using Firefox on Lubuntu (Openbox). But I get the error


Firefox不知道如何打开该地址,因为协议(组织协议)与任何程序。

"Firefox doesn't know how to open this address, because the protocol (org-protocol) isn't associated with any program".

我该如何解决?

推荐答案

以下用于设置 org-protocol 的步骤 Ubuntu 16.04 (Xenial Xerus)和更高版本。假定已经设置了组织模式(并已使用 apt-get install org-mode 或通过 ELPA存储库)。

The following steps for setting up org-protocol work with Ubuntu 16.04 (Xenial Xerus) and presumably later versions. Org-mode is assumed to have already been set-up (and installed using apt-get install org-mode or via the ELPA repository).


  1. 添加.desktop文件




创建并保存一个名为 org-protocol.desktop的文件到包含以下内容的〜/ .local / share / applications:


Create and save a file called org-protocol.desktop to ~/.local/share/applications containing:

[Desktop Entry]
Name=org-protocol
Exec=emacsclient %u
Type=Application
Terminal=false
Categories=System;
MimeType=x-scheme-handler/org-protocol;

然后运行:

$ update-desktop-database ~/.local/share/applications/

此步骤使Firefox知道 org-protocol是有效的方案处理程序或协议(通过更新〜/ .local / share / applications / mimeinfo.cache ),并导致Firefox在打开时提示使用程序这类链接。

This step makes Firefox aware that "org-protocol" is a valid scheme-handler or protocol (by updating ~/.local/share/applications/mimeinfo.cache), and causes Firefox to prompt for a program to use when opening these kinds of links.


  1. 将配置设置添加到〜/ .emacs.d / init.el(或〜/ .emacs)文件中




在Emacs配置文件中具有以下设置:


Have the following settings in your Emacs configuration file:

(server-start)
(require 'org-protocol)

配置文件的一些模板定义,例如:

Also add some template definitions to the configuration file, for example:

(setq org-protocol-default-template-key "l")
(setq org-capture-templates
 '(("t" "Todo" entry (file+headline "/path/to/notes.org" "Tasks")
        "* TODO %?\n  %i\n  %a")
   ("l" "Link" entry (file+olp "/path/to/notes.org" "Web Links")
        "* %a\n %?\n %i")
   ("j" "Journal" entry (file+datetree "/path/to/journal.org")
        "* %?\nEntered on %U\n  %i\n  %a")))

现在运行Emacs。


  1. 创建您的 notes.org 文件

  1. Create your notes.org file




假定您使用捕获模板在第2步中定义,您需要在第2步中指定的位置准备一个 notes.org 文件。您必须创建此文件- -如果未与第2步中指定的标题一起创建,则在尝试捕获网页时,org-mode只会发出警告。因此,给定步骤2中的捕获模板, notes.org 应包含以下内容:


Assuming you use the capture templates defined in step 2, you will need to prepare a notes.org file at the location you specified in step 2. You must create this file -- if it is not created along with the headlines specified in step 2, org-mode will just give a warning when you try to capture web-pages. So, given the capture templates from step 2, notes.org should contain the following:

* Tasks
* Web Links



  1. 添加书签( s)到Firefox




将书签保存到包含以下内容的工具栏:


Save bookmark to toolbar containing something like the following as the location:

javascript:location.href='org-protocol://capture?template=l&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&body='+encodeURIComponent(window.getSelection())

如果使用的是旧版的org-mode,您可能需要改用以下代码:

If you are using an older version of org-mode, you may need to use the following instead:

javascript:location.href='org-protocol://capture://l/'+encodeURIComponent(location.href)+'/'+encodeURIComponent(document.title)+'/'+encodeURIComponent(window.getSelection())

注意上述URL中的'l'(小写L)-这就是选择捕获模板的原因e(自动)-这是通过Cc c用org-mode捕获时通常必须按下的键。

Notice the 'l' (lowercase L) in the above URL -- this is what chooses the capture template (automatically) -- it is the key one would normally have to press when capturing with org-mode via C-c c.

当您单击此书签时,Firefox将询问要使用什么程序用于处理组织协议;协议。您只需选择显示的默认程序即可( org-protocol)。

When you click on this bookmarklet, Firefox will ask what program to use to handle the "org-protocol" protocol. You can simply choose the default program that appears ("org-protocol").

(可选)在您正在Firefox中查看的网页。当您单击书签时,链接和选定的文本将放置在Emacs捕获缓冲区中。转到Emacs,根据需要修改捕获缓冲区,然后按 C-c C-c 保存它。

(Optionally) select some text on a webpage you're viewing in Firefox. When you click on the bookmarklet, the link and selected text will be placed in the Emacs capture buffer. Go to Emacs, modify the capture buffer as desired, and press C-c C-c to save it.

这篇关于如何在Openbox上使用组织协议?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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