* lisp/subr.el (string-lines): Change the semantics slightly --
don't return an empty string for a trailing newline.
\f
* Incompatible changes in Emacs 29.1
+---
+** 'string-lines' handles trailing newlines differently.
+It no longer returns an empty final string if the string ends with a
+newline.
+
---
** 'TAB' and '<backtab>' are now bound in 'button-map'.
This means that if you're standing on a button, 'TAB' will take you to
(when (not (and keep-newlines omit-nulls
(equal line "\n")))
(push line lines))))
- (setq start (1+ newline))
- ;; Include the final newline.
- (when (and (= start (length string))
- (not omit-nulls)
- (not keep-newlines))
- (push "" lines)))
+ (setq start (1+ newline)))
;; No newline in the remaining part.
(if (zerop start)
;; Avoid a string copy if there are no newlines at all.
(ert-deftest test-string-lines ()
(should (equal (string-lines "foo") '("foo")))
- (should (equal (string-lines "foo\n") '("foo" "")))
+ (should (equal (string-lines "foo\n") '("foo")))
(should (equal (string-lines "foo\nbar") '("foo" "bar")))
(should (equal (string-lines "foo" t) '("foo")))