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: Eli Zaretskii
Subject: Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification
Date: Sat, 06 May 2017 17:24:32 +0300

> From: Tino Calancha <address@hidden>
> Cc: Eli Zaretskii <address@hidden>,  address@hidden,  address@hidden
> Date: Sat, 06 May 2017 22:51:26 +0900
> 
> >Add optional regexp for subr-x.el trimming functions
> I would say something like:
> Allow user regexp in string trimming functions.

FWIW, I don't see much difference between these two.  And the option
is not really for "users", it's for Lisp programs, right?

> >+(defsubst string-trim-left (string &optional regexp)
> >+  "Trim STRING of leading string matching REGEXP.
> >+
> >+REGEXP defaults to \"[ \\t\\n\\r]+\"."
> We don't need a empty line inside such short docstrings.

A matter of personal style, IMO.

> I feel like too much 'trim', 'left' and 'right' around.  It's distracting.
> I suggest something like:
> (defsubst string-trim (string &optional regexp-beg regexp-end)
> or
> (defsubst string-trim (string &optional regexp-l regexp-r)

I wouldn't make comments like this so late in the review process.

> I find it more legible written as:
> (string-trim-left
>  (string-trim-right string regexp-end)
>  regexp-beg)
> 
> than as:
> (string-trim-left (string-trim-right string regexp-end) regexp-beg)

Again, personal style issue, IMO.



reply via email to

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