diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-09-06 00:08:32 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-09-06 00:08:32 +0200 |
commit | 7612fb2b9aed51d0cc83fe4aee156b79e9e473e8 (patch) | |
tree | 562772fbcff98fdeeaddaefd2fd953ba9497cbaa | |
parent | 5b5f9a874c3d9f57f6a58bd0b8e67d13b45c88fb (diff) | |
download | org-mode-7612fb2b9aed51d0cc83fe4aee156b79e9e473e8.tar.gz |
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.
-rw-r--r-- | lisp/org-compat.el | 18 | ||||
-rw-r--r-- | lisp/org-footnote.el | 7 | ||||
-rw-r--r-- | 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 a9ade38..2c41c50 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 40c7e1f..820eb8b 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 7bb6d33..6c0abcb 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) |