0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 19:37:52 +00:00

org.el (org-split-string): Tiny refactoring

* org.el (org-split-string): Tiny refactoring.

Thanks to Marcin Borkowski for raising this.
This commit is contained in:
Bastien 2015-08-04 23:29:37 +02:00
parent 306f872554
commit f246576081

View file

@ -22292,13 +22292,12 @@ The return value is a list of lines, without newlines at the end."
(defun org-split-string (string &optional separators)
"Splits STRING into substrings at SEPARATORS.
SEPARATORS is a regular expression.
No empty strings are returned if there are matches at the beginning
and end of string."
(let ((rexp (or separators "[ \f\t\n\r\v]+"))
(start 0)
notfirst
(list nil))
(while (and (string-match rexp string
;; FIXME: why not use (split-string STRING SEPARATORS t)?
(let ((start 0) notfirst list)
(while (and (string-match (or separators "[ \f\t\n\r\v]+") string
(if (and notfirst
(= start (match-beginning 0))
(< start (length string)))
@ -22308,14 +22307,10 @@ and end of string."
(or (eq (match-beginning 0) 0)
(and (eq (match-beginning 0) (match-end 0))
(eq (match-beginning 0) start))
(setq list
(cons (substring string start (match-beginning 0))
list)))
(push (substring string start (match-beginning 0)) list))
(setq start (match-end 0)))
(or (eq start (length string))
(setq list
(cons (substring string start)
list)))
(push (substring string start) list))
(nreverse list)))
(defun org-quote-vert (s)