emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Allen Li <darkfeline@felesatra.moe>
To: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: Bug: protocol capture without url corrupts org-stored-links [9.1.14 (9.1.14-1059-gadec50-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20181211/)]
Date: Wed, 12 Dec 2018 14:59:40 -0800	[thread overview]
Message-ID: <CADbSrJxEgzegRDBEFSp-C6Rmzvq9yirK0KG38VsQBT5MrTN1AA@mail.gmail.com> (raw)
In-Reply-To: <87tvjiittr.fsf@nicolasgoaziou.fr>

On Wed, Dec 12, 2018 at 9:59 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
> Could you give more context about the bug you're encountering? What does
> mean "function correctly if a URL was not provided"? What is the use
> case? What result did you expect, besides not encountering an error
> message?

The issue occurs when org protocol capture is invoked without a url param, e.g.

emacsclient 'org-protocol://capture?url=percent-encoded-url&body=some-text'

vs

emacsclient 'org-protocol://capture?body=some-text'

By "function correctly", I mean make the latter not break
org-insert-link by not corrupting the value of org-stored-links.

The use case is capturing some text without an associated URL.

The result I expect is the latter not breaking org-insert-link.

Note that invoking the latter otherwise behaves correctly/as expected.
It starts the capture process with the provided body text/initial
contents.  The only thing that breaks is org-insert-link when the user
calls org-insert-link later.

> There are multiple ways to solve this. In particular, if a URL is not
> provided, it seems natural to store nil instead, as
> `org-protocol-capture' currently does. If we do not support missing URL,
> then it should raise an error instead of letting it slip into
> `org-insert-link'. If we do, then `org-insert-link' should handle it
> gracefully.

Except storing nil is not supported by org-insert-link, breaking it
until the savvy user manually fixes org-stored-links.  I don't see
what meaning storing and inserting a nil link could have.

We could change org-insert-link to fix or ignore the invalid value in
org-stored-links, but why not stop inserting the invalid value into
org-stored-links in the first place?

>
> So, again, more context could help understanding what is the best
> solution.
>
> Regards,
>
> --
> Nicolas Goaziou

  reply	other threads:[~2018-12-12 22:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-12  3:18 Bug: protocol capture without url corrupts org-stored-links [9.1.14 (9.1.14-1059-gadec50-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20181211/)] Allen Li
2018-12-12  3:38 ` Allen Li
2018-12-12 16:38   ` Nicolas Goaziou
2018-12-12 22:59     ` Allen Li [this message]
2018-12-18  8:34       ` Nicolas Goaziou

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=CADbSrJxEgzegRDBEFSp-C6Rmzvq9yirK0KG38VsQBT5MrTN1AA@mail.gmail.com \
    --to=darkfeline@felesatra.moe \
    --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).