From mboxrd@z Thu Jan 1 00:00:00 1970 From: Allen Li 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 Message-ID: References: <87tvjiittr.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXDTt-0007NX-QW for emacs-orgmode@gnu.org; Wed, 12 Dec 2018 17:59:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXDTs-0007qF-P7 for emacs-orgmode@gnu.org; Wed, 12 Dec 2018 17:59:53 -0500 Received: from mail-it1-x132.google.com ([2607:f8b0:4864:20::132]:40421) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXDTs-0007pL-Ff for emacs-orgmode@gnu.org; Wed, 12 Dec 2018 17:59:52 -0500 Received: by mail-it1-x132.google.com with SMTP id h193so939798ita.5 for ; Wed, 12 Dec 2018 14:59:52 -0800 (PST) In-Reply-To: <87tvjiittr.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Org Mode List On Wed, Dec 12, 2018 at 9:59 AM Nicolas Goaziou 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