[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Error handling in org-make-link-string
From: |
Nicolas Goaziou |
Subject: |
Re: [O] Error handling in org-make-link-string |
Date: |
Sat, 14 Apr 2018 15:17:17 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) |
Hello,
Bob Newell <address@hidden> writes:
> The problem? When org-make-link-string encounters an empty link (it
> doesn't happen often but it does happen), it uses the 'error' function
> to say that the link is empty. This means that the entire call to
> org-xxx-copy-for-org-mode is aborted, and consequently nothing is
> captured.
>
> Should this be the desired behavior?
Your question is twofold.
OTOH, it seems sane to expect `org-make-link-string' to throw an error
if you try to apply it on garbage. OTOH, I agree it is not desirable to
throw away all captured information because of a bad link.
I think the problem lies in the logic of `org-eww-copy-for-org-mode' and
`org-w3m-copy-for-org-mode', which should handle better errors from
`org-make-link-string'.
For example,
(if (stringp link-location)
;; hint: link-location is different for form-elements.
(org-make-link-string link-location link-title)
link-title)
could be replaced with
(if (org-string-nw-p link-location)
...)
or even
(or (ignore-errors (org-make-link-string ...))
link-title)
WDYT?
Regards,
--
Nicolas Goaziou