emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Bug: protocol capture without url corrupts org-stored-links [9.1


From: Allen Li
Subject: Re: [O] 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: Tue, 11 Dec 2018 19:38:06 -0800

Attached patch

I didn't realize that org-protocol-capture is documented for URLs,
since the concept of capturing through org-protocol is useful for
non-web browser contexts.

Anyway, I'm not interested in updating the documentation for
org-protocol-capture at the moment, but even if org-protocol-capture
is documented to need a URL, it seems wrong for it to corrupt
org-stored-links but otherwise function correctly if a URL was not
provided.
On Tue, Dec 11, 2018 at 7:18 PM Allen Li <address@hidden> wrote:
>
> Using Org protocol capture without supplying a URL inserts a corrupt
> entry into org-stored-links (nil "").  The nil causes a type error later
> in org-insert-link.
>
> (defun org-protocol-do-capture (info)
>   "Perform the actual capture based on INFO."
>   (let* ((temp-parts (org-protocol-parse-parameters info))
> (parts
>   (cond
>    ((and (listp info) (symbolp (car info))) info)
>    ((= (length (car temp-parts)) 1) ;; First parameter is exactly one
> character long
>     (org-protocol-assign-parameters temp-parts '(:template :url :title 
> :body)))
>    (t
>     (org-protocol-assign-parameters temp-parts '(:url :title :body)))))
> (template (or (plist-get parts :template)
>        org-protocol-default-template-key))
> (url (and (plist-get parts :url) (org-protocol-sanitize-uri (plist-get
> parts :url))))
> (type (and url (string-match "^\\([a-z]+\\):" url) (match-string 1 url)))
> (title (or (plist-get parts :title) ""))
> (region (or (plist-get parts :body) ""))
> (orglink (if url
>       (org-make-link-string
>        url (if (string-match "[^[:space:]]" title) title url))
>     title))
> (org-capture-link-is-already-stored t)) ;; avoid call to org-store-link
>     (setq org-stored-links
>   (cons (list url title) org-stored-links))
>
>
> Emacs  : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
>  of 2018-07-05
> Package: Org mode version 9.1.14 (9.1.14-1059-gadec50-elpaplus @
> /home/ionasal/.emacs.d/elpa/org-plus-contrib-20181211/)

Attachment: 0001-org-protocol-Don-t-corrupt-org-stored-link-if-url-is.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]