Fix `org-{w3m|eww}-copy-for-org-mode' on blank links

* lisp/org-w3m.el (org-w3m-copy-for-org-mode):
* lisp/org-eww.el (org-eww-copy-for-org-mode): Do not error when
  called on blank links.

Reported-by: Bob Newell <bobnewell@bobnewell.net>
<http://lists.gnu.org/r/emacs-orgmode/2018-04/msg00255.html>
This commit is contained in:
Nicolas Goaziou 2018-04-14 19:30:17 +02:00
parent 1976c02af0
commit 1a1e47198f
2 changed files with 13 additions and 12 deletions

View File

@ -140,13 +140,13 @@ the structure of the Org file."
;; concat `org-mode' style url to `return-content'.
(setq return-content
(concat return-content
(if (stringp link-location)
;; hint: link-location is different for form-elements.
(if (org-string-nw-p link-location)
;; Hint: link-location is different
;; for form-elements.
(org-make-link-string link-location link-title)
link-title))))
(goto-char temp-position) ; reset point before jump next anchor
(setq out-bound t) ; for break out `while' loop
))
(setq out-bound t))) ; for break out `while' loop
;; Add the rest until end of the region to be copied.
(when (< (point) transform-end)
(setq return-content

View File

@ -95,12 +95,13 @@ so that it can be yanked into an Org buffer with links working correctly."
(setq link-title (buffer-substring (point)
(org-w3m-get-anchor-end)))
;; concat Org style url to `return-content'.
(setq return-content (concat return-content
(org-make-link-string
link-location link-title))))
(setq return-content
(concat return-content
(if (org-string-nw-p link-location)
(org-make-link-string link-location link-title)
link-title))))
(goto-char temp-position) ; reset point before jump next anchor
(setq out-bound t) ; for break out `while' loop
))
(setq out-bound t))) ; for break out `while' loop
;; add the rest until end of the region to be copied
(if (< (point) transform-end)
(setq return-content