[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: org-capture config broken (org-protocol URI syntax)
From: |
Maxim Nikulin |
Subject: |
Re: org-capture config broken (org-protocol URI syntax) |
Date: |
Wed, 25 Aug 2021 23:16:19 +0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
On 25/08/2021 19:05, Orm Finnendahl wrote:
I use a custom script (dating back to a post from 2013) to capture my
mutt Emails using org-capture. It worked flawlessly but stopped
working some time ago (I don't exactly know, when, probably last
year).
Unfortunately you did not specify version of Org you are currently using.
I assume the code has changed and doesn't accept the syntax of the
org-protocol line any more.
emacsclient
org-protocol:/capture:/m/mutt:YSYuf6sKfSbwtIeB@example.com/mail/%20%20Subject%3A%20test%0A%20%20%20%20From%3A%20Unknown%20%3Cdummy%40example.com%3E
This the old style of Org protocol URI. See
https://orgmode.org/manual/The-capture-protocol.html for an example of
modern variant (it has typos fixed in master branch, some "?" should be
"&"). I am unsure concerning order of parameters in old-style URLs.
Older syntax should still be supported (a warning requesting update may
be issued however), unfortunately there were some issues, see e.g.
https://orgmode.org/list/s4cjck$156g$2@ciao.gmane.io
Some details: https://orgmode.org/Changes_old.html#org3da1425 (news for
version 9.0)
The emacsclient commmand above is generated with a perl script using
uri_escape for everything after /mail/. The single slashes in the
protocol line of the emacsclient command seem strange, but I couldn't
find any hint in the internet how the syntax is supposed to be for a
certain org-capture-template.
I suggest you to update perl script to generate URI with key-value
parameters in query part.
Concerning number of slashes, I suppose, the following should minimize
issues with desktop integration and intermediate bugs in various
versions of Org
org-protocol:/capture?template=X?url=URL&title=TITLE&body=BODY
namely no double slash after org-protocol otherwise in some cases slash
might be inserted before question mark or second colon might be dropped
in old-style URI. With double slash subprotocol might be interpreted as
host name causing further normalization as dropping colon that is not
followed by port number or adding path "/" before query part. Such
considerations however are not applied for direct invocation of emacsclient.
Emacsclient considers org-protocol URI as relative path, so it prepends
argument with current working directory and squashes multiple slashes
into single ones. That is why it does not matter how much consequent
slashes are used in emacsclient command, however desktop-wide handlers
may modify URI depending on number of slashes.
Latest releases should tolerate URIs with slash before question mark like
org-protocol://capture/?template=X?url=URL&title=TITLE&body=BODY