emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lisp/term/ns-win.el modification


From: Jean-Christophe Helary
Subject: Re: lisp/term/ns-win.el modification
Date: Tue, 2 May 2017 13:00:29 +0900

> On May 1, 2017, at 20:27, Eli Zaretskii <address@hidden> wrote:
> 
>> From: Jean-Christophe Helary <address@hidden>
>> 
>> On a side note, what's the point of having string-trim in subr-x.el when a 
>> more powerful solution is provided in subr.el?
> 
> Good question.
> 
> Perhaps string-trim could be extended to allow an optional argument that 
> would replace the built-in default regexp.

I take the question back. It looks like there is no elegant way to *only* trim 
a string passed to split-string:

split-string string &optional separators omit-nulls trim

For that, "separators" should be a regex that doesn't match anything in the 
string since "nil" defaults to split-string-default-separators (instead of, for 
ex. leaving the string as is and only defaulting when the parameter is omitted).

There are a number of regex that fit the bill according to stackoverflow, like:

(split-string string "[*]" t trim-regex)

but it's not elegant.

It would have been much nicer to implement from the start a "nil" option that 
does that... So I guess improving string-trim in subr-x.el is still relevant... 
Or am I missing something?

Jean-Christophe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]