Nicolas Goaziou <[email protected]> writes:
> IMO, `org-insert-link' shouldn't hexify links in all situations (if at
> all).
Agreed.
We can first narrow the set of url-hexified links to those matching
`org-link-types-re' (http://, ftp://.)
> Anyway, I can't think of any satisfactory solution at the moment.
See patch.
Of course, there will still be some false positives, because
`org-link-types-re' comprises custom link types, but this is
a step in the right direction IMO.
diff --git a/lisp/org.el b/lisp/org.el
index f7a038e..20e6e33 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9793,11 +9793,10 @@ according to FMT (default from `org-email-link-description-format')."
(not (equal link (org-link-escape link))))
(setq description (org-extract-attributes link)))
(setq link
- (cond ((string-match (org-image-file-name-regexp) link) link)
- ((string-match org-link-types-re link)
+ (cond ((string-match org-link-types-re link)
(concat (match-string 1 link)
(org-link-escape (substring link (match-end 1)))))
- (t (org-link-escape link))))
+ (t link)))
(concat "[[" link "]"
(if description (concat "[" description "]") "")
"]"))
--
Bastien