From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Error handling in org-make-link-string Date: Sat, 14 Apr 2018 15:17:17 +0200 Message-ID: <87sh7ynd0i.fsf@nicolasgoaziou.fr> References: <87o9imh5mv.fsf@bobnewell.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f7L3V-0002pk-BN for emacs-orgmode@gnu.org; Sat, 14 Apr 2018 09:17:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f7L3R-0004HQ-9C for emacs-orgmode@gnu.org; Sat, 14 Apr 2018 09:17:25 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:41077) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f7L3R-0004FQ-2O for emacs-orgmode@gnu.org; Sat, 14 Apr 2018 09:17:21 -0400 In-Reply-To: <87o9imh5mv.fsf@bobnewell.net> (Bob Newell's message of "Fri, 13 Apr 2018 16:40:56 -1000") 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: Bob Newell Cc: emacs-orgmode@gnu.org Hello, Bob Newell 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