mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Fix the OMIT-NULLS + "" case in string-lines
* lisp/subr.el (string-lines): Respect OMIT-NULLS when given an empty string.
This commit is contained in:
parent
a6a4f1d6d1
commit
e280df0e34
2 changed files with 4 additions and 1 deletions
|
|
@ -6748,7 +6748,9 @@ If OMIT-NULLS, empty lines will be removed from the results.
|
|||
If KEEP-NEWLINES, don't strip trailing newlines from the result
|
||||
lines."
|
||||
(if (equal string "")
|
||||
(list "")
|
||||
(if omit-nulls
|
||||
nil
|
||||
(list ""))
|
||||
(let ((lines nil)
|
||||
(start 0))
|
||||
(while (< start (length string))
|
||||
|
|
|
|||
|
|
@ -1030,6 +1030,7 @@ final or penultimate step during initialization."))
|
|||
|
||||
(ert-deftest test-string-lines ()
|
||||
(should (equal (string-lines "") '("")))
|
||||
(should (equal (string-lines "" t) '()))
|
||||
|
||||
(should (equal (string-lines "foo") '("foo")))
|
||||
(should (equal (string-lines "foo\n") '("foo")))
|
||||
|
|
|
|||
Loading…
Reference in a new issue