浏览代码

Remove compatibility code for subr-x.el defsubsts

* lisp/org-compat.el: Remove compatibility code for subr-x.el defsubsts.
* lisp/org-footnote.el (org-footnote-normalize-label):
* lisp/org-macs.el (org-unbracket-string): Avoid using subr-x.el
  functions.
Nicolas Goaziou 8 年之前
父节点
当前提交
7612fb2b9a
共有 3 个文件被更改,包括 6 次插入22 次删除
  1. 1 17
      lisp/org-compat.el
  2. 4 3
      lisp/org-footnote.el
  3. 1 2
      lisp/org-macs.el

+ 1 - 17
lisp/org-compat.el

@@ -430,23 +430,7 @@ attention to case differences."
     (let ((start-pos (- (length string) (length suffix))))
       (and (>= start-pos 0)
 	   (eq t (compare-strings suffix nil nil
-				  string start-pos nil ignore-case)))))
-
-  (defsubst string-blank-p (string)
-    "Check whether STRING is either empty or only whitespace."
-    (string-match-p "\\`[ \t\n\r]*\\'" string))
-
-  (defsubst string-remove-prefix (prefix string)
-    "Remove PREFIX from STRING if present."
-    (if (string-prefix-p prefix string)
-	(substring string (length prefix))
-      string))
-
-  (defsubst string-remove-suffix (suffix string)
-    "Remove SUFFIX from STRING if present."
-    (if (string-suffix-p suffix string)
-	(substring string 0 (- (length string) (length suffix)))
-      string)))
+				  string start-pos nil ignore-case))))))
 
 (provide 'org-compat)
 

+ 4 - 3
lisp/org-footnote.el

@@ -562,9 +562,10 @@ value if point was successfully moved."
   "Return LABEL without \"fn:\" prefix.
 If LABEL is the empty string or constituted of white spaces only,
 return nil instead."
-  (let ((label (org-trim label)))
-    (unless (equal "" label)
-      (string-remove-prefix "fn:" label))))
+  (pcase (org-trim label)
+    ("" nil)
+    ((pred (string-prefix-p "fn:")) (substring label 3))
+    (t label)))
 
 (defun org-footnote-get-definition (label)
   "Return label, boundaries and definition of the footnote LABEL."

+ 1 - 2
lisp/org-macs.el

@@ -287,12 +287,11 @@ the value in cdr."
 
 (defun org-unbracket-string (pre post string)
   "Remove PRE/POST from the beginning/end of STRING.
-
 Both PRE and POST must be pre-/suffixes of STRING, or neither is
 removed."
   (if (and (string-prefix-p pre string)
 	   (string-suffix-p post string))
-      (string-remove-prefix pre (string-remove-suffix post string))
+      (substring string (length pre) (- (length post)))
     string))
 
 (provide 'org-macs)