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:
@@ -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")))
|
||||
|
||||
Reference in New Issue
Block a user