emacs-devel
[Top][All Lists]
Advanced

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

Re: master 87e422f: Beef up the Emacs string utility set a bit


From: Mattias Engdegård
Subject: Re: master 87e422f: Beef up the Emacs string utility set a bit
Date: Tue, 22 Dec 2020 11:41:01 +0100

Thanks for the good work! I suggest that 'string-limit' be replaced with two 
separate functions, 'string-prefix' and 'string-suffix', because these are two 
different operations and it makes no sense to multiplex them onto a single 
function with an argument saying which one we are going to use.

Suggested patch attached. The names can be discussed; for example, 
'string-left' and 'string-right' would do just as well.

If someone prefers saturating semantics for negative length arguments, then 
that's an option too. Ie, in case we want

 (string-prefix "abc" -2)

to yield the empty string instead of an error. I think an error is more useful.

The new functions are now inline (defsubst) in keeping with the spirit of 
subr-x.el. (We really should inline these better!)

Attachment: 0001-Replace-string-limit-with-string-prefix-and-string-s.patch
Description: Binary data


reply via email to

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