[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master aab5d7b3f3 1/3: Add a KEEP-NEWLINES argument to string-lines
From: |
Andreas Schwab |
Subject: |
Re: master aab5d7b3f3 1/3: Add a KEEP-NEWLINES argument to string-lines |
Date: |
Sat, 30 Apr 2022 15:00:34 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) |
On Apr 30 2022, Lars Ingebrigtsen wrote:
> diff --git a/lisp/subr.el b/lisp/subr.el
> index 9623ea63b5..14cab04d42 100644
> --- a/lisp/subr.el
> +++ b/lisp/subr.el
> @@ -6646,10 +6646,36 @@ is inserted before adjusting the number of empty
> lines."
> ((< (- (point) start) lines)
> (insert (make-string (- lines (- (point) start)) ?\n))))))
>
> -(defun string-lines (string &optional omit-nulls)
> +(defun string-lines (string &optional omit-nulls keep-newlines)
> "Split STRING into a list of lines.
> -If OMIT-NULLS, empty lines will be removed from the results."
> - (split-string string "\n" omit-nulls))
> +If OMIT-NULLS, empty lines will be removed from the results.
> +If KEEP-NEWLINES, don't strip trailing newlines from the result
> +lines."
> + (let ((lines nil)
> + (start 0))
> + (while (< start (length string))
> + (if-let ((newline (string-search "\n" string start)))
That breaks bootstrap.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
- Re: master aab5d7b3f3 1/3: Add a KEEP-NEWLINES argument to string-lines,
Andreas Schwab <=