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: Sat, 14 Mar 2015 23:36:26 +0100 Message-ID: <4055444A-BE2E-47A5-BAD1-BD174E8EDB43@klingenberg.no> References: 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=_8A9137BC-F55D-4507-83DF-D90BC3B8E37E" X-Trace: ger.gmane.org 1426372647 19517 80.91.229.3 (14 Mar 2015 22:37:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 14 Mar 2015 22:37:27 +0000 (UTC) To: 1321@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 14 23:37:13 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 1YWugB-0005Ud-5I for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Mar 2015 23:37:11 +0100 Original-Received: from localhost ([::1]:42021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWugA-0000mB-Ii for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Mar 2015 18:37:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWug6-0000lv-8b for bug-gnu-emacs@gnu.org; Sat, 14 Mar 2015 18:37:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWug3-00041I-3o for bug-gnu-emacs@gnu.org; Sat, 14 Mar 2015 18:37:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48311) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWug2-00041A-Vx for bug-gnu-emacs@gnu.org; Sat, 14 Mar 2015 18:37:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YWug2-0007tS-Il for bug-gnu-emacs@gnu.org; Sat, 14 Mar 2015 18:37:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: "Peder O. Klingenberg" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Mar 2015 22:37:02 +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.142637260230310 (code B ref 1321); Sat, 14 Mar 2015 22:37:02 +0000 Original-Received: (at 1321) by debbugs.gnu.org; 14 Mar 2015 22:36:42 +0000 Original-Received: from localhost ([127.0.0.1]:46879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWufi-0007so-Eq for submit@debbugs.gnu.org; Sat, 14 Mar 2015 18:36:42 -0400 Original-Received: from tarrant.klingenberg.no ([80.91.231.253]:43574) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWuff-0007sa-KF for 1321@debbugs.gnu.org; Sat, 14 Mar 2015 18:36:40 -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 1YWufY-0002o8-G4; Sat, 14 Mar 2015 23:36:38 +0100 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:100488 Archived-At: --Apple-Mail=_8A9137BC-F55D-4507-83DF-D90BC3B8E37E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Just adding an optional argument to process-lines is difficult without = breaking the API, due to its use of &rest. I suggest something along = the lines of the following patch: ...Peder... --=20 Sl=C3=B8v uten dop --Apple-Mail=_8A9137BC-F55D-4507-83DF-D90BC3B8E37E Content-Disposition: attachment; filename=0001-Extend-process-lines-to-allow-exit-status-handling.patch Content-Type: application/octet-stream; name="0001-Extend-process-lines-to-allow-exit-status-handling.patch" Content-Transfer-Encoding: quoted-printable =46rom=2036387738fa6dc45db5a0ea4bbcc7ad982ba95da3=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..45b23dc=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(apply=20#'status-handler=20program=20args=20= status)=0A+=09(unless=20(eq=20status=200)=0A+=09=20=20(error=20"%s=20= exited=20with=20status=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=20= error=20if=20the=20program=20returns=20with=20a=20non-zero=20exit=20= status."=0A=20=09=20=20(forward-line=201))=0A=20=09(nreverse=20= lines)))))=0A=20=0A+(defun=20process-lines=20(program=20&rest=20args)=0A= +=20=20"Execute=20PROGRAM=20with=20ARGS,=20returning=20its=20output=20as=20= a=20list=20of=20lines.=0A+Signal=20an=20error=20if=20the=20program=20= returns=20with=20a=20non-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=_8A9137BC-F55D-4507-83DF-D90BC3B8E37E--