emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 98e168b489 46/50: compat: Add compatibility wrapper


From: ELPA Syncer
Subject: [elpa] externals/org 98e168b489 46/50: compat: Add compatibility wrapper for string-clean-whitespace
Date: Tue, 4 Oct 2022 21:58:02 -0400 (EDT)

branch: externals/org
commit 98e168b489e4350430d1600f7ece57215de1027c
Author: Kyle Meyer <kyle@kyleam.com>
Commit: Kyle Meyer <kyle@kyleam.com>

    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.
---
 lisp/org-compat.el | 12 ++++++++++++
 lisp/ox.el         |  4 ++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 79039a4f43..90c6b40e5a 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -148,6 +148,18 @@ inserted before contatenating."
     (and (file-directory-p dir)
          (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
 
diff --git a/lisp/ox.el b/lisp/ox.el
index 3f679221be..1cb0dea06c 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -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
 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
       (lambda (radio)
        (and (string-equal-ignore-case
-             (string-clean-whitespace (org-element-property :value radio))
+             (org-string-clean-whitespace (org-element-property :value radio))
               path)
             radio))
       info 'first-match)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]