emacs-devel
[Top][All Lists]
Advanced

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

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


From: Johan Bockgård
Subject: Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification
Date: Sun, 07 May 2017 18:23:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: Johan Bockgård <address@hidden>
>> Cc: address@hidden, address@hidden,
>> address@hidden, address@hidden
>> Date: Sat, 06 May 2017 21:55:52 +0200
>> 
>> Eli Zaretskii <address@hidden> writes:
>> 
>> >> From: Johan Bockgård <address@hidden>
>> >> Cc: Eli Zaretskii <address@hidden>, address@hidden,
>> >> address@hidden, address@hidden
>> >> Date: Sat, 06 May 2017 19:51:33 +0200
>> >> 
>> >> > +  (if (string-match (concat "\\`" (or  regexp "[ \t\n\r]+")) string)
>> >> 
>> >> I think regexp should be surrounded by a grouping construct, like:
>> >> 
>> >>    (concat "\\`\\(?:" (or  regexp "[ \t\n\r]+") "\\)")
>> >> 
>> >> And similarly for string-trim-right.
>> >
>> > Rationale?
>> 
>> regexp can contain \|
>
> Shouldn't such a regexp be surrounded by "\\(..\\)"?

This code performs string concatenation on a perfectly valid regexp
provided by the caller. IMO, it is this code's responsibility that the
result is sensible after the concatenation.

Are you saying this should be the caller's duty?



reply via email to

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