Subject: bug#78690: 31.0.50; split string: args out of range with TRIM

From: Michael Heerdegen <[email-masked]>
Date: Mon, 09 Jun 2025 03:22:16 +0200

Eli Zaretskii <[email-masked]> writes:

> The patch below seems to fix the problem, and passes all the tests.
> Does it look reasonable?

Thank you very much.  I did not look at the details of your change yet;
however, I see that a string starting with whitespace still makes the
function error:

#+begin_src emacs-lisp
(let ((text " -*- lexical-binding: t; -*-")
      ;;    ^^^ see here
      (seps "-\\*-")
      (trim "[ \t\n\r-]+"))
  (split-string text seps nil trim))
#+end_src

  ~~> split-string: Args out of range: " -*- lexical-binding: t; -*-", 2, 1

Could you please have a look?

Michael.