emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Bob Newell <bobnewell@bobnewell.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: Error handling in org-make-link-string
Date: Sat, 14 Apr 2018 15:17:17 +0200	[thread overview]
Message-ID: <87sh7ynd0i.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87o9imh5mv.fsf@bobnewell.net> (Bob Newell's message of "Fri, 13 Apr 2018 16:40:56 -1000")

Hello,

Bob Newell <bobnewell@bobnewell.net> 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

  reply	other threads:[~2018-04-14 13:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-14  2:40 Error handling in org-make-link-string Bob Newell
2018-04-14 13:17 ` Nicolas Goaziou [this message]
2018-04-14 16:54   ` Bob Newell
2018-04-14 17:32     ` 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=87sh7ynd0i.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=bobnewell@bobnewell.net \
    --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).