From 7612fb2b9aed51d0cc83fe4aee156b79e9e473e8 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 6 Sep 2016 00:08:32 +0200 Subject: [PATCH] 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. --- lisp/org-compat.el | 18 +----------------- lisp/org-footnote.el | 7 ++++--- lisp/org-macs.el | 3 +-- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index a9ade3847..2c41c50c3 100644 --- a/lisp/org-compat.el +++ b/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) diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index 40c7e1f24..820eb8b7a 100644 --- a/lisp/org-footnote.el +++ b/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." diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 7bb6d3389..6c0abcbfe 100644 --- a/lisp/org-macs.el +++ b/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)