emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Maxim Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: org-capture config broken (org-protocol URI syntax)
Date: Wed, 25 Aug 2021 23:16:19 +0700	[thread overview]
Message-ID: <sg5qcl$p8v$1@ciao.gmane.io> (raw)
In-Reply-To: <YSYx+xyu0irTaW3z@t14s-orm.localdomain>

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



  reply	other threads:[~2021-08-25 16:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-25 12:05 org-capture config broken Orm Finnendahl
2021-08-25 16:16 ` Maxim Nikulin [this message]
2021-08-26  9:48 ` Orm Finnendahl
2021-08-26 14:09   ` Maxim Nikulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='sg5qcl$p8v$1@ciao.gmane.io' \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).