From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Roehler Newsgroups: gmane.emacs.devel Subject: Re: string-strip Date: Fri, 29 Sep 2006 09:41:48 +0200 Message-ID: <451CCE3C.8080709@easy-emacs.de> References: <449266B2.7030500@easy-emacs.de> <4496E618.8090401@soem.dk> <32964.128.165.123.239.1150741470.squirrel@webmail.lanl.gov> <449796E7.9090808@soem.dk> <44984C66.8090006@easy-emacs.de> <17560.20884.675268.166167@kahikatea.snap.net.nz> <4499782D.4020408@soem.dk> <44A26D7E.1030000@soem.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1159515282 22212 80.91.229.2 (29 Sep 2006 07:34:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 29 Sep 2006 07:34:42 +0000 (UTC) Cc: Juri Linkov , emacs-devel , Richard Stallman , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 29 09:34:38 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GTCtD-00051E-K0 for ged-emacs-devel@m.gmane.org; Fri, 29 Sep 2006 09:34:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GTCtC-0001l2-PK for ged-emacs-devel@m.gmane.org; Fri, 29 Sep 2006 03:34:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GTCsu-0001h4-9d for emacs-devel@gnu.org; Fri, 29 Sep 2006 03:34:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GTCss-0001dJ-1P for emacs-devel@gnu.org; Fri, 29 Sep 2006 03:34:11 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GTCsr-0001cm-S3 for emacs-devel@gnu.org; Fri, 29 Sep 2006 03:34:09 -0400 Original-Received: from [212.227.126.177] (helo=moutng.kundenserver.de) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GTCy7-0001u6-2K; Fri, 29 Sep 2006 03:39:35 -0400 Original-Received: from [84.190.203.59] (helo=[192.168.178.23]) by mrelayeu.kundenserver.de (node=mrelayeu2) with ESMTP (Nemesis), id 0MKwtQ-1GTCsl2RjS-0003OT; Fri, 29 Sep 2006 09:34:05 +0200 User-Agent: Thunderbird 1.5.0.4 (X11/20060516) Original-To: Lars Hansen In-Reply-To: <44A26D7E.1030000@soem.dk> X-Provags-ID: kundenserver.de abuse@kundenserver.de login:62d13292e0fce6aaed56aaadcb96352d X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:60303 Archived-At: Lars Hansen schrieb: > Kim F. Storm wrote: > > >> Looks good to me. >> >> But I think examples belong in the manual, not in the doc string. >> >> >> > It seems that there are no more objections. Can I install? > > ------------------------------------------------------------------------ > > *** /home/lh/cvsroot/emacs/lisp/subr.el 2006-06-13 12:37:24.000000000 +0200 > --- subr.el 2006-06-28 13:44:50.916887229 +0200 > *************** > *** 2615,2620 **** > --- 2615,2636 ---- > > ;;;; Replacement in strings. > > + (defconst string-strip-default-white-space "[ \f\t\n\r\v]*" > + "The default value of white-space for `string-strip'. > + A regexp matching strings of white space.") > + > + (defun string-strip (string &optional white-space) > + "Remove leading and trailing WHITE-SPACE from STRING. > + If WHITE-SPACE is non-nil, it should be a regular expression matching white > + space. If nil it defaults to `string-strip-default-white-space', normally > + \"[ \\f\\t\\n\\r\\v]*\"." > + (let ((ws (or white-space string-strip-default-white-space))) > + (save-match-data > + (string-match > + (concat "\\`\\(?:" ws "\\)\\(\\(?:.\\|\n\\)*?\\)\\(?:" ws "\\)\\'") > + string) > + (match-string 1 string)))) > + > (defun subst-char-in-string (fromchar tochar string &optional inplace) > "Replace FROMCHAR with TOCHAR in STRING each time it occurs. > Unless optional argument INPLACE is non-nil, return a new string." > Conceive this as the result of the discussion. Will it be installed? Thanks. __ Andreas Roehler