让组织协议在 Firefox Quantum 上工作——“没有服务器缓冲区需要编辑”错误

getting org-protocol to work on Firefox Quantum -- `No server buffers remain to edit` error

所以我试图让 org-protocol 第一次在 Firefox Quantum 上工作。我浏览了各种博客 post 和文档,但仍然无法克服这个特定错误

Greedy org-protocol handler.  Killing client. 
No server buffers remain to edit.

所以我在 Ubuntu Linux x64 16.04 和新发布的 Firefox Quantum 上使用 emacs 25.3。

我尝试通过两种方式做到这一点。

  1. 通过创建桌面条目然后在 Firefox 中设置小书签来设置 org-protocol 的传统方法。

  2. 在 Firefox 中使用 org-capture 附加组件。

两者都给我同样的错误。

对于方法 1,我遵循了 documentation 以及非常有用的 stackexchange post:

How to make org-protocol work?

还有这个有用的博客 post

这是我所做的:

一个。我创建了一个桌面条目:

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

乙。将配置添加到 .spacemacs 文件。

我添加了以下行:

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

然后我在 .spacemacs 文件中设置捕获模板:

(setq org-capture-templates
      (quote 
              ("p" "org-protocol" entry (file+headline "~/Dropbox/config/org/refile/refile.org")
                "* %^{Title}\nSource: %u, %c\n #+BEGIN_QUOTE\n%:initial\n#+END_QUOTE\n\n\n%?")
              ("l" "org-protocol link" entry (file "~/Dropbox/config/org/refile/refile.org")
                "* %? [[%:link][%:description]] \nCaptured On: %U")
... Additional templates.
))

C。然后我用以下位置创建了小书签:

javascript:location.href='org-protocol://store-link://l/'+encodeURIComponent(location.href)

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

所有这些之后,我仍然收到上面提到的错误消息。

其次,我尝试了 Firefox 中的 org-capture 附加组件。但它也没有用。

不确定错误的原因是什么。感谢您的帮助。

在其他阅读中,当 org-capture 模板中存在问题时,人们会收到此 Greedy 错误,但我没有发现任何错误。

我过去也遇到过一些麻烦。

现在我使用的解决方案是 firefox add-on -> 您可以直接从 Firefox 安装它。这真的很容易,就我而言,它开箱即用(Debian 发行版,Firefox 52.5.0)。我不知道它是否适用于 Firefox Quantum。

org-protocol 照常配置。就我而言:

cat > "${HOME}/.local/share/applications/org-protocol.desktop" << EOF
[Desktop Entry]
Name=org-protocol
Exec=emacsclient %u
Type=Application
Terminal=false
Categories=System;
MimeType=x-scheme-handler/org-protocol;
EOF

然后

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

在您的 Emacs init.el 文件中:

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

(setq org-capture-templates `(
    ("p" "Protocol" entry (file+headline ,(concat org-directory "notes.org") "Inbox")
        "* %^{Title}\nSource: %u, %c\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?")
    ("L" "Protocol Link" entry (file+headline ,(concat org-directory "notes.org") "Inbox")
        "* %? [[%:link][%:description]] \nCaptured On: %U")
))

就是这样。在我的配置下它可以工作,我希望这对你来说也是一样的。


Extra: 前段时间,我提出了一个小的模板改进来处理 ArXiv.org 标题,详情在这里:https://github.com/sprig/org-capture-extension/issues/37

好的,这是一个棘手的解决方案。该问题是由 use-package emacs 包中最近的一些更改引起的。该问题记录在 github.

https://github.com/jwiegley/use-package/issues/557

让我告诉你我是如何发现这个问题的,以防你让其他人注册类似的问题。

我按照您在 README 中的建议设置了 org-capture-extension,但是我在 emacs 消息缓冲区中不断收到以下错误(在下面发布)。我在 Ubuntu 16.04x64 和新的 Firefox Quantum 浏览器以及 Chrome.

上使用 Emacs 25.3

所以我尝试使用以下命令通过 emacsclient 手动传递一个 link

emacsclient -n "org-protocol:///capture?url=http%3a%2f%2fduckduckgo%2ecom&title=DuckDuckGo"

但是我一直在消息缓冲区中收到这种奇怪的响应,其中警告 349 和警告 931 之间存在循环行为。

condition-case: Symbol’s value as variable is void: use-package--warning349
condition-case: Symbol’s value as variable is void: use-package--warning931
condition-case: Symbol’s value as variable is void: use-package--warning349
condition-case: Symbol’s value as variable is void: use-package--warning931
condition-case: Symbol’s value as variable is void: use-package--warning349

解决方案记录在 github 问题中,但我认为用户不应该手动实施修复。相反,我认为作者会进行更改并将其合并到 master 中——届时用户可以重新下载并安装 use-package 包。