forked from mirrors/org-mode
org.el (org-link-escape): Don't escape characters in internal links
* org.el (org-link-escape): Don't escape characters in internal links. Thanks to Alan Schmitt for raising this issue.
This commit is contained in:
parent
687a65de70
commit
956c00cce3
40
lisp/org.el
40
lisp/org.el
|
@ -9936,24 +9936,28 @@ Optional argument TABLE is a list with characters that should be
|
|||
escaped. When nil, `org-link-escape-chars' is used.
|
||||
If optional argument MERGE is set, merge TABLE into
|
||||
`org-link-escape-chars'."
|
||||
(cond
|
||||
((and table merge)
|
||||
(mapc (lambda (defchr)
|
||||
(unless (member defchr table)
|
||||
(setq table (cons defchr table)))) org-link-escape-chars))
|
||||
((null table)
|
||||
(setq table org-link-escape-chars)))
|
||||
(mapconcat
|
||||
(lambda (char)
|
||||
(if (or (member char table)
|
||||
(and (or (< char 32) (= char ?\%) (> char 126))
|
||||
org-url-hexify-p))
|
||||
(mapconcat (lambda (sequence-element)
|
||||
(format "%%%.2X" sequence-element))
|
||||
(or (encode-coding-char char 'utf-8)
|
||||
(error "Unable to percent escape character: %s"
|
||||
(char-to-string char))) "")
|
||||
(char-to-string char))) text ""))
|
||||
;; Don't escape chars in internal links
|
||||
(if (string-match "^\\*[[:alnum:]]+" text)
|
||||
text
|
||||
(cond
|
||||
((and table merge)
|
||||
(mapc (lambda (defchr)
|
||||
(unless (member defchr table)
|
||||
(setq table (cons defchr table))))
|
||||
org-link-escape-chars))
|
||||
((null table)
|
||||
(setq table org-link-escape-chars)))
|
||||
(mapconcat
|
||||
(lambda (char)
|
||||
(if (or (member char table)
|
||||
(and (or (< char 32) (= char ?\%) (> char 126))
|
||||
org-url-hexify-p))
|
||||
(mapconcat (lambda (sequence-element)
|
||||
(format "%%%.2X" sequence-element))
|
||||
(or (encode-coding-char char 'utf-8)
|
||||
(error "Unable to percent escape character: %s"
|
||||
(char-to-string char))) "")
|
||||
(char-to-string char))) text "")))
|
||||
|
||||
(defun org-link-escape-browser (text)
|
||||
"Escape some characters before handing over to the browser.
|
||||
|
|
Loading…
Reference in New Issue