forked from mirrors/org-mode
compat: Add compatibility wrapper for string-clean-whitespace
* lisp/org-compat.el (org-string-clean-whitespace): New compatibility function. * lisp/ox.el (org-export-resolve-radio-link): Use org-string-clean-whitespace. This is a follow-up to the port of Emacs's 70341cab3.
This commit is contained in:
parent
0e0fe76ae4
commit
98e168b489
|
@ -148,6 +148,18 @@ inserted before contatenating."
|
||||||
(and (file-directory-p dir)
|
(and (file-directory-p dir)
|
||||||
(null (directory-files dir nil directory-files-no-dot-files-regexp t)))))
|
(null (directory-files dir nil directory-files-no-dot-files-regexp t)))))
|
||||||
|
|
||||||
|
(if (fboundp 'string-clean-whitespace)
|
||||||
|
(defalias 'org-string-clean-whitespace #'string-clean-whitespace)
|
||||||
|
;; From Emacs subr-x.el.
|
||||||
|
(defun org-string-clean-whitespace (string)
|
||||||
|
"Clean up whitespace in STRING.
|
||||||
|
All sequences of whitespaces in STRING are collapsed into a
|
||||||
|
single space character, and leading/trailing whitespace is
|
||||||
|
removed."
|
||||||
|
(let ((blank "[[:blank:]\r\n]+"))
|
||||||
|
(string-trim (replace-regexp-in-string blank " " string t t)
|
||||||
|
blank blank))))
|
||||||
|
|
||||||
|
|
||||||
;;; Emacs < 27.1 compatibility
|
;;; Emacs < 27.1 compatibility
|
||||||
|
|
||||||
|
|
|
@ -4454,11 +4454,11 @@ INFO is a plist used as a communication channel.
|
||||||
|
|
||||||
Return value can be a radio-target object or nil. Assume LINK
|
Return value can be a radio-target object or nil. Assume LINK
|
||||||
has type \"radio\"."
|
has type \"radio\"."
|
||||||
(let ((path (string-clean-whitespace (org-element-property :path link))))
|
(let ((path (org-string-clean-whitespace (org-element-property :path link))))
|
||||||
(org-element-map (plist-get info :parse-tree) 'radio-target
|
(org-element-map (plist-get info :parse-tree) 'radio-target
|
||||||
(lambda (radio)
|
(lambda (radio)
|
||||||
(and (string-equal-ignore-case
|
(and (string-equal-ignore-case
|
||||||
(string-clean-whitespace (org-element-property :value radio))
|
(org-string-clean-whitespace (org-element-property :value radio))
|
||||||
path)
|
path)
|
||||||
radio))
|
radio))
|
||||||
info 'first-match)))
|
info 'first-match)))
|
||||||
|
|
Loading…
Reference in a new issue