From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Peder O. Klingenberg" Newsgroups: gmane.emacs.bugs Subject: bug#1321: process-lines Date: Sun, 15 Mar 2015 09:37:38 +0100 Message-ID: References: <4055444A-BE2E-47A5-BAD1-BD174E8EDB43@klingenberg.no> <5504C819.80701@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_9551AED8-C0A4-4FC7-9255-210DAC2A5228" X-Trace: ger.gmane.org 1426408707 25362 80.91.229.3 (15 Mar 2015 08:38:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 15 Mar 2015 08:38:27 +0000 (UTC) Cc: 1321@debbugs.gnu.org To: Daniel Colascione Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 15 09:38:15 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YX43n-00052R-OU for geb-bug-gnu-emacs@m.gmane.org; Sun, 15 Mar 2015 09:38:12 +0100 Original-Received: from localhost ([::1]:42751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YX43n-0006Cb-1j for geb-bug-gnu-emacs@m.gmane.org; Sun, 15 Mar 2015 04:38:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YX43j-0006CU-AA for bug-gnu-emacs@gnu.org; Sun, 15 Mar 2015 04:38:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YX43e-0001UO-An for bug-gnu-emacs@gnu.org; Sun, 15 Mar 2015 04:38:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48381) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YX43e-0001UE-70 for bug-gnu-emacs@gnu.org; Sun, 15 Mar 2015 04:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YX43d-0007Tm-K1 for bug-gnu-emacs@gnu.org; Sun, 15 Mar 2015 04:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Peder O. Klingenberg" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Mar 2015 08:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 1321 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 1321-submit@debbugs.gnu.org id=B1321.142640867428733 (code B ref 1321); Sun, 15 Mar 2015 08:38:01 +0000 Original-Received: (at 1321) by debbugs.gnu.org; 15 Mar 2015 08:37:54 +0000 Original-Received: from localhost ([127.0.0.1]:46949 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YX43V-0007TM-Ih for submit@debbugs.gnu.org; Sun, 15 Mar 2015 04:37:53 -0400 Original-Received: from tarrant.klingenberg.no ([80.91.231.253]:44814) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YX43T-0007TE-CY for 1321@debbugs.gnu.org; Sun, 15 Mar 2015 04:37:52 -0400 Original-Received: from 59.123.202.84.customer.cdi.no ([84.202.123.59] helo=[10.13.0.74]) by tarrant.klingenberg.no with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1YX43L-0000fD-UL; Sun, 15 Mar 2015 09:37:49 +0100 In-Reply-To: <5504C819.80701@dancol.org> X-Mailer: Apple Mail (2.2070.6) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:100491 Archived-At: --Apple-Mail=_9551AED8-C0A4-4FC7-9255-210DAC2A5228 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On 15 Mar, 2015, at 0:45, Daniel Colascione wrote: >=20 > What about defining a `process-lines-2' that takes keyword arguments = and > accepts a list for PROGRAM? That=E2=80=99s another possibility, of course. But in my opinion, the = &rest is usually a more convenient API for the callers, saving them the = trouble of consing up a new list. Also, I find functions with -N = suffixes to be less descriptive names than they should be. In my haste to send a patch last night, I managed to send the wrong = version, one that didn=E2=80=99t work as advertised. Sorry. Please = ignore my previous patch and consider this one instead: ...Peder... --=20 Sl=C3=B8v uten dop --Apple-Mail=_9551AED8-C0A4-4FC7-9255-210DAC2A5228 Content-Disposition: attachment; filename=0001-Extend-process-lines-to-allow-exit-status-handling-v2.patch Content-Type: application/octet-stream; name="0001-Extend-process-lines-to-allow-exit-status-handling-v2.patch" Content-Transfer-Encoding: quoted-printable =46rom=20a64514df4fcd00413580d16e6418223ae0eb6ae6=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20"Peder=20O.=20Klingenberg"=20= =0ADate:=20Sat,=2014=20Mar=202015=2023:00:16=20= +0100=0ASubject:=20[PATCH]=20Extend=20process-lines=20to=20allow=20exit=20= status=20handling=0A=0A*=20subr.el=20(process-lines-handling-status):=20= Extension=20of=20the=20old=0Aprocess-lines,=20with=20more=20flexible=20= handling=20of=20the=20exit=20status.=0A(process-lines):=20Old=20API=20= implemented=20using=20the=20new=20function.=0A= (process-lines-ignore-status):=20Another=20use=20of=20the=20new=20= function=20-=0Areturn=20the=20output=20lines=20regardless=20of=20the=20= exit=20status.=0A=0AFixes:=20Bug#1321=0A---=0A=20lisp/ChangeLog=20|=20=20= 8=20++++++++=0A=20lisp/subr.el=20=20=20|=2024=20++++++++++++++++++++----=0A= =202=20files=20changed,=2028=20insertions(+),=204=20deletions(-)=0A=0A= diff=20--git=20a/lisp/ChangeLog=20b/lisp/ChangeLog=0Aindex=20= d393190..a93a306=20100644=0A---=20a/lisp/ChangeLog=0A+++=20= b/lisp/ChangeLog=0A@@=20-1,3=20+1,11=20@@=0A+2015-03-14=20=20Peder=20O.=20= Klingenberg=20=20=0A+=0A+=09*=20subr.el=20= (process-lines-handling-status):=20Extension=20of=20the=20old=0A+=09= process-lines,=20with=20more=20flexible=20handling=20of=20the=20exit=20= status.=0A+=09(process-lines):=20Old=20API=20implemented=20using=20the=20= new=20function.=0A+=09(process-lines-ignore-status):=20Another=20use=20= of=20the=20new=20function=20-=0A+=09return=20the=20output=20lines=20= regardless=20of=20the=20exit=20status.=0A+=0A=202015-03-13=20=20Kevin=20= Ryde=20=20=0A=20=0A=20=09info-look=20fixes=20= for=20Texinfo=205=0Adiff=20--git=20a/lisp/subr.el=20b/lisp/subr.el=0A= index=20deadca6..ec471f0=20100644=0A---=20a/lisp/subr.el=0A+++=20= b/lisp/subr.el=0A@@=20-1901,13=20+1901,19=20@@=20and=20the=20file=20name=20= is=20displayed=20in=20the=20echo=20area."=0A=20=0C=0A=20;;;;=20Process=20= stuff.=0A=20=0A-(defun=20process-lines=20(program=20&rest=20args)=0A= +(defun=20process-lines-handling-status=20(program=20status-handler=20= &rest=20args)=0A=20=20=20"Execute=20PROGRAM=20with=20ARGS,=20returning=20= its=20output=20as=20a=20list=20of=20lines.=0A-Signal=20an=20error=20if=20= the=20program=20returns=20with=20a=20non-zero=20exit=20status."=0A+If=20= STATUS-HANDLER=20is=20non-NIL,=20it=20must=20be=20a=20function=20with=20= one=0A+argument,=20which=20will=20be=20called=20with=20the=20exit=20= status=20of=20the=0A+program=20before=20the=20output=20is=20collected.=20= =20If=20STATUS-HANDLER=20is=0A+NIL,=20an=20error=20is=20signalled=20if=20= the=20program=20returns=20with=20a=20non-zero=0A+exit=20status."=0A=20=20= =20(with-temp-buffer=0A=20=20=20=20=20(let=20((status=20(apply=20= 'call-process=20program=20nil=20(current-buffer)=20nil=20args)))=0A-=20=20= =20=20=20=20(unless=20(eq=20status=200)=0A-=09(error=20"%s=20exited=20= with=20status=20%s"=20program=20status))=0A+=20=20=20=20=20=20(if=20= status-handler=0A+=09=20=20(funcall=20status-handler=20status)=0A+=09= (unless=20(eq=20status=200)=0A+=09=20=20(error=20"%s=20exited=20with=20= status=20%s"=20program=20status)))=0A=20=20=20=20=20=20=20(goto-char=20= (point-min))=0A=20=20=20=20=20=20=20(let=20(lines)=0A=20=09(while=20(not=20= (eobp))=0A@@=20-1918,6=20+1924,16=20@@=20Signal=20an=20error=20if=20the=20= program=20returns=20with=20a=20non-zero=20exit=20status."=0A=20=09=20=20= (forward-line=201))=0A=20=09(nreverse=20lines)))))=0A=20=0A+(defun=20= process-lines=20(program=20&rest=20args)=0A+=20=20"Execute=20PROGRAM=20= with=20ARGS,=20returning=20its=20output=20as=20a=20list=20of=20lines.=0A= +Signal=20an=20error=20if=20the=20program=20returns=20with=20a=20= non-zero=20exit=20status."=0A+=20=20(apply=20= #'process-lines-handling-status=20program=20nil=20args))=0A+=0A+(defun=20= process-lines-ignore-status=20(program=20&rest=20args)=0A+=20=20"Execute=20= PROGRAM=20with=20ARGS,=20returning=20its=20output=20as=20a=20list=20of=20= lines.=0A+The=20exit=20status=20of=20the=20program=20is=20ignored."=0A+=20= =20(apply=20#'process-lines-handling-status=20program=20#'identity=20= args))=0A+=0A=20(defun=20process-live-p=20(process)=0A=20=20=20"Returns=20= non-nil=20if=20PROCESS=20is=20alive.=0A=20A=20process=20is=20considered=20= alive=20if=20its=20status=20is=20`run',=20`open',=0A--=20=0A1.9.5=20= (Apple=20Git-50.3)=0A=0A= --Apple-Mail=_9551AED8-C0A4-4FC7-9255-210DAC2A5228--