From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification Date: Sat, 06 May 2017 17:24:32 +0300 Message-ID: <83y3uadpwf.fsf@gnu.org> References: <87vapij1l7.fsf@holos> <6870A2B6-F685-4955-9C0A-256601DB47BC@gmail.com> <51D5E92C-F125-4ADE-8C55-E3513C00ECDC@gmail.com> <8F6958D6-3E13-4C31-B1F8-AF10A8FC8FC6@gmail.com> <838tmafigi.fsf@gnu.org> <7C79DA34-96F2-4D9F-9E9C-01574AE00F12@gmail.com> <8360hefepp.fsf@gnu.org> <0E129E02-FA64-4664-825B-8854A66CA9C6@gmail.com> <3D0BA0E6-02E2-4E90-8A59-121065547E1C@gmail.com> <87o9v614bl.fsf@calancha-pc> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1494080709 3275 195.159.176.226 (6 May 2017 14:25:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 6 May 2017 14:25:09 +0000 (UTC) Cc: mvoteiza@udel.edu, jean.christophe.helary@gmail.com, emacs-devel@gnu.org To: Tino Calancha Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 06 16:25:05 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d70ds-0000kr-Sv for ged-emacs-devel@m.gmane.org; Sat, 06 May 2017 16:25:04 +0200 Original-Received: from localhost ([::1]:51633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d70dy-0002Gy-Hf for ged-emacs-devel@m.gmane.org; Sat, 06 May 2017 10:25:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d70dp-0002Fb-11 for emacs-devel@gnu.org; Sat, 06 May 2017 10:25:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d70dk-0004hI-Jl for emacs-devel@gnu.org; Sat, 06 May 2017 10:25:01 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d70dk-0004hE-GW; Sat, 06 May 2017 10:24:56 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3027 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d70dj-0005A9-KA; Sat, 06 May 2017 10:24:56 -0400 In-reply-to: <87o9v614bl.fsf@calancha-pc> (message from Tino Calancha on Sat, 06 May 2017 22:51:26 +0900) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:214624 Archived-At: > From: Tino Calancha > Cc: Eli Zaretskii , mvoteiza@udel.edu, emacs-devel@gnu.org > 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.