Move `org-trim' in "org-macs.el"

* lisp/org.el (org-trim): Move function...
* lisp/org-macs.el: ... here.
This commit is contained in:
Nicolas Goaziou 2017-09-18 21:07:13 +02:00
parent 44c46176ec
commit 442a2b430d
2 changed files with 8 additions and 8 deletions

View File

@ -38,6 +38,14 @@
symbols)
,@body))
(defsubst org-trim (s &optional keep-lead)
"Remove whitespace at the beginning and the end of string S.
When optional argument KEEP-LEAD is non-nil, removing blank lines
at the beginning of the string does not affect leading indentation."
(replace-regexp-in-string
(if keep-lead "\\`\\([ \t]*\n\\)+" "\\`[ \t\n\r]+") ""
(replace-regexp-in-string "[ \t\n\r]+\\'" "" s)))
(defun org-string-nw-p (s)
"Return S if S is a string containing a non-blank character.
Otherwise, return nil."

View File

@ -194,14 +194,6 @@ Stars are put in group 1 and the trimmed body in group 2.")
"Get text property PROPERTY at the beginning of line."
(get-text-property (point-at-bol) property))
(defsubst org-trim (s &optional keep-lead)
"Remove whitespace at the beginning and the end of string S.
When optional argument KEEP-LEAD is non-nil, removing blank lines
at the beginning of the string does not affect leading indentation."
(replace-regexp-in-string
(if keep-lead "\\`\\([ \t]*\n\\)+" "\\`[ \t\n\r]+") ""
(replace-regexp-in-string "[ \t\n\r]+\\'" "" s)))
;; load languages based on value of `org-babel-load-languages'
(defvar org-babel-load-languages)