[Top][All Lists]

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

Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification

From: Jean-Christophe Helary
Subject: Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification
Date: Tue, 9 May 2017 08:15:23 +0900

> On May 9, 2017, at 7:45, Johan Bockgård <address@hidden> wrote:
> Jean-Christophe Helary <address@hidden> writes:
>>> No, the issue is whether the function should enclose the argument in a
>>> grouping constructs of any kind, or should this be the caller's
>>> responsibility when the regexp includes \|.
>> (split-string) in subr.el (line 3808) doesn't use grouping constructs
>> so why do something different than what's already the norm in an
>> official emacs lisp file? Doesn't that settle the issue?
> To me, that's nothing other than a bug:
>    (split-string "abc, ;def g,hi" nil nil "[,;]")
>    =>
>      ("abc" "def" "g,hi")
>    ;; Should be equivalent!
>    (split-string "abc, ;def g,hi" nil nil ",\\|;")
>    =>
>      ("abc" "def" "g")  ; BUG

Ok, and the way to get your result is:

(split-string "abc, ;def g,hi" nil nil "\\(,\\|;\\)")

which means that Emacs thinks it is the caller's duty to provide the grouping 
construct, which also happens to be ugly, and non-intuitive since ",\\|;" is an 
otherwise valid regexp...

So, how do we go about that? Do we report a bug? Or do we find a good reason 
for that to happen and modify the documentation for split-string ?


reply via email to

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