From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification Date: Tue, 2 May 2017 11:41:42 -0400 Message-ID: <95dd877e-8c5d-533a-7680-8782dcdad88a@gmail.com> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1493739785 2660 195.159.176.226 (2 May 2017 15:43:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 2 May 2017 15:43:05 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 To: Jean-Christophe Helary , emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 02 17:42:58 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 1d5Zx3-0000UI-VG for ged-emacs-devel@m.gmane.org; Tue, 02 May 2017 17:42:58 +0200 Original-Received: from localhost ([::1]:59636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5Zx9-00048J-Ls for ged-emacs-devel@m.gmane.org; Tue, 02 May 2017 11:43:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5Zvv-0003go-SU for emacs-devel@gnu.org; Tue, 02 May 2017 11:41:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5Zvs-0003ln-QM for emacs-devel@gnu.org; Tue, 02 May 2017 11:41:47 -0400 Original-Received: from mail-it0-x22f.google.com ([2607:f8b0:4001:c0b::22f]:35234) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d5Zvs-0003lI-Lu for emacs-devel@gnu.org; Tue, 02 May 2017 11:41:44 -0400 Original-Received: by mail-it0-x22f.google.com with SMTP id c15so44462140ith.0 for ; Tue, 02 May 2017 08:41:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=PmLa2Uj6498vl4ZotQ9+K5FzCcSzKBQ32hV+iyqEEeY=; b=gd4exivPJVtM6hUcXb/BIadaWELtNJNZFsETW1YMWHZNLABxsrdCrZjRlj+buSHFCQ 80E7nGETVH4Lb5+OzLCUdkLk83awHnBs6y6LpkFNNbi5kqS9H59xlYYkb4KluOO1wJ7z yjp5enMjIk6G8JT3dnY8EUGOtKzIluq8RxWJqsl/kUIHPGDH3rxFW3SyTyheBayaMGS9 6s+7KCHyB/Hys1E1XP25YNsRzgzQL/DuktUa0wQtRgN40k3R5wTe59eUx81IxOhz4BtK P3tJo79p7rASv24LJPjYXsbHFeiiIMMnlWQE2XPdxMfe0+SpCoNKouttiAr6A68tH92m mLJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=PmLa2Uj6498vl4ZotQ9+K5FzCcSzKBQ32hV+iyqEEeY=; b=OoZFIVTVK9N8RHFoQcTgZD9aZOhVr0uzlkZtWC6Hehht5/6gvmVGwKRL/JP/tPOCSd Jqj0GAF2fLf9NROIKuqctyoxqelMtOckDlnSKfUAYKG/DL1zwhpxgaeDGYgDSuEzDkuo JTow3K8rqofHLR6NBhR2yntZqbKxR3FZ9JTsAeEoFhUoMHFTtdI+c4EGIIXNvnwTLEex H3KEn5F0fkPQSSzkUJIXdFaQYSpR+04iV0VcOYBlU5SFFNT93XlNn6ey/o2s4loyCxnV T3hnzI+Bd7wCTqjuiKxkmoHyZS9Tp//zUmTgWK9Vx2DjQPcm1TB6z78nBQOxCpjmzxVc n2nA== X-Gm-Message-State: AN3rC/7AUR0gtOFBLVyH1GDzxXy1V67Ke1DCmCcDbtWtPjAeUCiSrxB4 hR3RbFeYJUGE5Q== X-Received: by 10.36.250.4 with SMTP id v4mr13021847ith.116.1493739703872; Tue, 02 May 2017 08:41:43 -0700 (PDT) Original-Received: from [128.30.9.43] (30-9-43.wireless.csail.mit.edu. [128.30.9.43]) by smtp.gmail.com with ESMTPSA id f19sm1027626itf.19.2017.05.02.08.41.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 May 2017 08:41:43 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::22f 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:214519 Archived-At: Looks good. The stirng could be called string-trim-regexp (no need for default), though, I think. On 2017-05-02 05:34, Jean-Christophe Helary wrote: > Following the discussion about how trimming in subr-x.el did not allow for non-default regex, I have this small modification to the 3 trimming functions found therein. > > Basically: > 1) I extracted the default regex and assigned it to string-trim-default-regex > 2) I declared optional "trim-left" and "trim-right" arguments respectively for the string-trim-left and string-trim-right functions, and declared both optional for the general string-trim function > > The documentation strings are pretty much taken from subr.el so maybe the wording is not the best.