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

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

[elpa] externals/org e614a763ca 27/50: Backport commit 70341cab3 from Em


From: ELPA Syncer
Subject: [elpa] externals/org e614a763ca 27/50: Backport commit 70341cab3 from Emacs
Date: Tue, 4 Oct 2022 21:58:00 -0400 (EDT)

branch: externals/org
commit e614a763ca1cb766f57ab507050629bf2d92b348
Author: Sam Steingold <sds@gnu.org>
Commit: Kyle Meyer <kyle@kyleam.com>

    Backport commit 70341cab3 from Emacs
    
    * lisp/ob-core.el (org-babel-results-keyword):
      Use `string-equal-ignore-case' instead of explicit `compare-strings'.
    (org-babel-insert-result): Likewise.
    * lisp/org-compat.el (string-equal-ignore-case):
      Define unless defined already.
    (org-mode-flyspell-verify): Use `string-equal-ignore-case'.
    * lisp/org-lint.el (org-lint-duplicate-custom-id): Likewise.
    * lisp/ox.el (org-export-resolve-radio-link): Use
      `string-equal-ignore-case' and `string-clean-whitespace'.
    
    string-equal-ignore-case: new function
    70341cab3eb26e2f49bbc13d6bca247ab9403abc
    Sam Steingold
    Tue Jul 26 13:49:28 2022 -0400
    
    [ km: Note that string-clean-whitespace also requires a compatibility
      kludge and the string-equal-ignore-case kludge was added to the
      wrong org-compat section.  These will be addressed in a follow-up
      commit. ]
---
 lisp/ob-core.el    |  9 ++++-----
 lisp/org-compat.el | 14 ++++++++++----
 lisp/org-lint.el   |  6 ++----
 lisp/ox.el         | 12 +++++-------
 4 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 04af84d2e4..3d159ed38a 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -136,8 +136,7 @@ used."
   :type 'string
   :safe (lambda (v)
          (and (stringp v)
-              (eq (compare-strings "RESULTS" nil nil v nil nil t)
-                  t))))
+              (string-equal-ignore-case "RESULTS" v))))
 
 (defcustom org-babel-noweb-wrap-start "<<"
   "String used to begin a noweb reference in a code block.
@@ -2435,7 +2434,7 @@ INFO may provide the values of these header arguments (in 
the
                       ;; Escape contents from "export" wrap.  Wrap
                       ;; inline results within an export snippet with
                       ;; appropriate value.
-                      ((eq t (compare-strings type nil nil "export" nil nil t))
+                      ((string-equal-ignore-case type "export")
                        (let ((backend (pcase split
                                         (`(,_) "none")
                                         (`(,_ ,b . ,_) b))))
@@ -2446,14 +2445,14 @@ INFO may provide the values of these header arguments 
(in the
                                           backend) "@@)}}}")))
                       ;; Escape contents from "example" wrap.  Mark
                       ;; inline results as verbatim.
-                      ((eq t (compare-strings type nil nil "example" nil nil 
t))
+                      ((string-equal-ignore-case type "example")
                        (funcall wrap
                                 opening-line closing-line
                                 nil nil
                                 "{{{results(=" "=)}}}"))
                       ;; Escape contents from "src" wrap.  Mark
                       ;; inline results as inline source code.
-                      ((eq t (compare-strings type nil nil "src" nil nil t))
+                      ((string-equal-ignore-case type "src")
                        (let ((inline-open
                               (pcase split
                                 (`(,_)
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index a65bf6f677..085e32d677 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -934,6 +934,14 @@ Implements `define-error' for older emacsen."
     (put name 'error-conditions
          (copy-sequence (cons name (get 'error 'error-conditions))))))
 
+(unless (fboundp 'string-equal-ignore-case)
+  ;; From Emacs subr.el.
+  (defun string-equal-ignore-case (string1 string2)
+    "Like `string-equal', but case-insensitive.
+Upper-case and lower-case letters are treated as equal.
+Unibyte strings are converted to multibyte for comparison."
+    (eq t (compare-strings string1 0 nil string2 0 nil t))))
+
 (unless (fboundp 'string-suffix-p)
   ;; From Emacs subr.el.
   (defun string-suffix-p (suffix string  &optional ignore-case)
@@ -1125,10 +1133,8 @@ ELEMENT is the element at point."
          (and log
               (let ((drawer (org-element-lineage element '(drawer))))
                 (and drawer
-                     (eq (compare-strings
-                          log nil nil
-                          (org-element-property :drawer-name drawer) nil nil t)
-                         t)))))
+                     (string-equal-ignore-case
+                      log (org-element-property :drawer-name drawer))))))
        nil)
        (t
        (cl-case (org-element-type element)
diff --git a/lisp/org-lint.el b/lisp/org-lint.el
index 83c2d08a90..6d8cf3f237 100644
--- a/lisp/org-lint.el
+++ b/lisp/org-lint.el
@@ -334,10 +334,8 @@ called with one argument, the key used for comparison."
    ast
    'node-property
    (lambda (property)
-     (and (eq (compare-strings "CUSTOM_ID" nil nil
-                              (org-element-property :key property) nil nil
-                              t)
-             t)
+     (and (string-equal-ignore-case
+           "CUSTOM_ID" (org-element-property :key property))
          (org-element-property :value property)))
    (lambda (property _) (org-element-property :begin property))
    (lambda (key) (format "Duplicate CUSTOM_ID property \"%s\"" key))))
diff --git a/lisp/ox.el b/lisp/ox.el
index e977a26417..1daa1a333a 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -80,6 +80,7 @@
 (require 'org-element)
 (require 'org-macro)
 (require 'tabulated-list)
+(require 'subr-x)
 
 (declare-function org-src-coderef-format "org-src" (&optional element))
 (declare-function org-src-coderef-regexp "org-src" (fmt &optional label))
@@ -4436,15 +4437,12 @@ 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 (replace-regexp-in-string
-              "[ \r\t\n]+" " " (org-element-property :path link))))
+  (let ((path (string-clean-whitespace (org-element-property :path link))))
     (org-element-map (plist-get info :parse-tree) 'radio-target
       (lambda (radio)
-       (and (eq (compare-strings
-                 (replace-regexp-in-string
-                  "[ \r\t\n]+" " " (org-element-property :value radio))
-                 nil nil path nil nil t)
-                t)
+       (and (string-equal-ignore-case
+             (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]