From rgm@gnu.org Sun Nov 9 13:24:26 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-10.7 required=4.0 tests=AWL,BAYES_00,HAS_PACKAGE, ONEWORD,RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_WEB,X_DEBBUGS_NO_ACK autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at quiet) by emacsbugs.donarmstrong.com; 9 Nov 2008 21:24:26 +0000 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mA9LOM8H029481 for ; Sun, 9 Nov 2008 13:24:23 -0800 Received: from rgm by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1KzHif-0000cV-69 for quiet@emacsbugs.donarmstrong.com; Sun, 09 Nov 2008 16:21:17 -0500 From: Eli Zaretskii To: quiet@debbugs.gnu.org Subject: process-lines Date: Sun, 19 Oct 2008 14:36:32 +0200 Lines: 11 X-From-Line: emacs-devel-bounces+rgm=gnu.org@gnu.org Sun Oct 19 08:34:28 2008 Received: from mx10.gnu.org ([199.232.76.166]:44335) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1KrXUK-0005lV-FH for rgm@gnu.org; Sun, 19 Oct 2008 08:34:28 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1KrXWq-00022c-Sb for rgm@gnu.org; Sun, 19 Oct 2008 08:37:05 -0400 Received: from lists.gnu.org ([199.232.76.165]:48086) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KrXWq-00022Y-O5 for rgm@gnu.org; Sun, 19 Oct 2008 08:37:04 -0400 Received: from localhost ([127.0.0.1]:39419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KrXWq-0006nx-Ib for rgm@gnu.org; Sun, 19 Oct 2008 08:37:04 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KrXWK-0006ns-8w for emacs-devel@gnu.org; Sun, 19 Oct 2008 08:36:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KrXWJ-0006ng-HZ for emacs-devel@gnu.org; Sun, 19 Oct 2008 08:36:31 -0400 Received: from [199.232.76.173] (port=60177 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KrXWJ-0006nd-DM for emacs-devel@gnu.org; Sun, 19 Oct 2008 08:36:31 -0400 Received: from mtaout4.012.net.il ([84.95.2.10]:55158) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KrXWJ-0001r1-4C for emacs-devel@gnu.org; Sun, 19 Oct 2008 08:36:31 -0400 Received: from HOME-C4E4A596F7 ([77.126.98.197]) by i_mtaout4.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0K8Z00G23KF8PJ10@i_mtaout4.012.net.il> for emacs-devel@gnu.org; Sun, 19 Oct 2008 14:37:56 +0200 (IST) X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: Solaris 9.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Eli Zaretskii List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+rgm=gnu.org@gnu.org X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Debbugs-No-Ack: yes Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: Glenn Morris Package: emacs Severity: wishlist [ resent from http://lists.gnu.org/archive/html/emacs-devel/2008-10/msg00356.html ] This function signals an error if the program it runs exits with a non-zero status. That sounds like an unfortunate limitation for a general-purpose subroutine, since some programs convey useful information through non-zero status. Diff is one example of such programs; there are others. I suggest to add an optional argument to control the behavior when the program exits "abnormally". From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 14 18:36:42 2015 Received: (at 1321) by debbugs.gnu.org; 14 Mar 2015 22:36:42 +0000 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 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 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 From: "Peder O. Klingenberg" Content-Type: multipart/mixed; boundary="Apple-Mail=_8A9137BC-F55D-4507-83DF-D90BC3B8E37E" Date: Sat, 14 Mar 2015 23:36:26 +0100 Subject: Re: process-lines To: 1321@debbugs.gnu.org Message-Id: <4055444A-BE2E-47A5-BAD1-BD174E8EDB43@klingenberg.no> Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) X-Mailer: Apple Mail (2.2070.6) X-Spam-Score: -2.9 (--) X-Spam-Score: -1.0 (-) X-Debbugs-Envelope-To: 1321 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --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-- From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 14 19:45:42 2015 Received: (at 1321) by debbugs.gnu.org; 14 Mar 2015 23:45:42 +0000 Received: from localhost ([127.0.0.1]:46886 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWvkS-00013G-Aw for submit@debbugs.gnu.org; Sat, 14 Mar 2015 19:45:41 -0400 Received: from dancol.org ([96.126.100.184]:52330) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWvkP-000137-Qb for 1321@debbugs.gnu.org; Sat, 14 Mar 2015 19:45:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:In-Reply-To:References:Subject:To:MIME-Version:From:Date:Message-ID; bh=9aVZ5NHaYKkxzFE58Pobas/XwQS8oNLjggiIWfZ+7OY=; b=OX91FGv1/d08c0DwDbJvNDazEGnPg6unDnLgtMJUc7qs6SGHYkvAHJIMd6ziPdhJNBzS44MIo+nscTYxsaJ2QqcfJUDJWg7jGqfxTcRu9vgbMYPnCxpDZ2eWLQkRzfXDcAyYAeccD3aDAoSY2dVhhuI/I6xcmD9QmvLp0lBWuhUo8jaibq90f+/R1Hn+xYvStJBdgPmflZxz+d5TrOfSDGHHDwGmez/1zMmaCp+ImRMUTDXseBUlP98KJwxnjhFAoc1pQqXg7cCuvafkJ88CS4mnE20sq4YL+dZrXsZmoGdiaMCL2Uk62kvECOpTfqJz8S5XA6BESjlqpnIwcoGHVw==; Received: from [2620:10d:c081:1100:8000::21c7] by dancol.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1YWvkN-00078l-56; Sat, 14 Mar 2015 16:45:35 -0700 Message-ID: <5504C819.80701@dancol.org> Date: Sat, 14 Mar 2015 16:45:29 -0700 From: Daniel Colascione User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "Peder O. Klingenberg" , 1321@debbugs.gnu.org Subject: Re: bug#1321: process-lines References: <4055444A-BE2E-47A5-BAD1-BD174E8EDB43@klingenberg.no> In-Reply-To: <4055444A-BE2E-47A5-BAD1-BD174E8EDB43@klingenberg.no> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="HhLjrxPSvbht3j1jr82Bq3hIjId0g1Mk9" X-Spam-Score: -1.0 (-) X-Debbugs-Envelope-To: 1321 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --HhLjrxPSvbht3j1jr82Bq3hIjId0g1Mk9 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/14/2015 03:36 PM, Peder O. Klingenberg wrote: > 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: What about defining a `process-lines-2' that takes keyword arguments and accepts a list for PROGRAM? --HhLjrxPSvbht3j1jr82Bq3hIjId0g1Mk9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJVBMgZAAoJEN4WImmbpWBltp4QAJRjEqcUthkTe6OS4HNHuM3w EXXPBy7gFZo8TH6hvDzr1Pq24rHuTemXpa+4mhQgleXAsrWjNotjdCnar9gDj0aW DK/urt/5dHQYWhYSTIkVvMD8DtIhkKA8hnE0JUnxblAZpQkLVXUWY2o5cP8k+mf5 YVCEtkqvTETyeCLpKOEVbezZ/If01/PuJoD0NwLC1ddaLLqnsgqB3AfbvDP/Yka/ QAwj7A005NSQL+O3vtXYuXJQJ9eFu057TpYdz4r4PncXdHzeD9WGNHKlUqNclwk/ fmKmsdUCHbjm/Sa+sP0AeFvgneIugY9UaC1XuH7NpIu+k3QdeamphbfMbk1esnAR SMPYBfi/sDZAbBxaXM+hZvGftgxlIxqMx6ffsVSQpx2fZjaGU9612T7AphD1K1lp AN3xfQbkT2VvYiYrqg3REmL3YrgWJKlfvYFaa6/wYbcWIFzxt63np+vfFHPECfgW Jl5PG8gFQKCdntZAiy1dRYB9BFXlqvCHKpy8KxfWGlkT8FlX2+AUmPa+ftXi4iiA cBKmVWAvV5Pu8pqkKmZbm88lh6Ci19aJ7gE47b3VdNMaBKrr0YjAbJ2IXW++RizU x/QvzEIJM3ljuaNTJ8cUNBu6qNW26Dy3BhP/eY4M+0BGH2M6/ZKqxgm5eBigckaw VPWjDtHxweoUHXQ222hK =BT/G -----END PGP SIGNATURE----- --HhLjrxPSvbht3j1jr82Bq3hIjId0g1Mk9-- From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 15 04:37:53 2015 Received: (at 1321) by debbugs.gnu.org; 15 Mar 2015 08:37:54 +0000 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 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 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 Subject: Re: bug#1321: process-lines Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_9551AED8-C0A4-4FC7-9255-210DAC2A5228" From: "Peder O. Klingenberg" In-Reply-To: <5504C819.80701@dancol.org> Date: Sun, 15 Mar 2015 09:37:38 +0100 Message-Id: References: <4055444A-BE2E-47A5-BAD1-BD174E8EDB43@klingenberg.no> <5504C819.80701@dancol.org> To: Daniel Colascione X-Mailer: Apple Mail (2.2070.6) X-Spam-Score: -2.9 (--) X-Spam-Score: -1.0 (-) X-Debbugs-Envelope-To: 1321 Cc: 1321@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --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-- From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 15 16:43:59 2015 Received: (at 1321) by debbugs.gnu.org; 15 Mar 2015 20:44:00 +0000 Received: from localhost ([127.0.0.1]:47433 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YXFOB-00028Q-MD for submit@debbugs.gnu.org; Sun, 15 Mar 2015 16:43:59 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:64541) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YXFOA-00028H-K5 for 1321@debbugs.gnu.org; Sun, 15 Mar 2015 16:43:58 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArsTAPOG1lQXW5EB/2dsb2JhbABbgwaDX4VTwGUEAgKBDUQBAQEBAQF8hA0BBAFWIwULCzQSFBgNJIg4CM4jAQEBAQYBAQEBHo94B4QqBas3IoQKIoJzAQEB X-IPAS-Result: ArsTAPOG1lQXW5EB/2dsb2JhbABbgwaDX4VTwGUEAgKBDUQBAQEBAQF8hA0BBAFWIwULCzQSFBgNJIg4CM4jAQEBAQYBAQEBHo94B4QqBas3IoQKIoJzAQEB X-IronPort-AV: E=Sophos;i="5.09,536,1418101200"; d="scan'208";a="113626482" Received: from 23-91-145-1.cpe.pppoe.ca (HELO pastel.home) ([23.91.145.1]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 15 Mar 2015 16:43:58 -0400 Received: by pastel.home (Postfix, from userid 20848) id CF9A911C3; Sun, 15 Mar 2015 16:43:57 -0400 (EDT) From: Stefan Monnier To: "Peder O. Klingenberg" Subject: Re: bug#1321: process-lines Message-ID: References: <4055444A-BE2E-47A5-BAD1-BD174E8EDB43@klingenberg.no> Date: Sun, 15 Mar 2015 16:43:57 -0400 In-Reply-To: <4055444A-BE2E-47A5-BAD1-BD174E8EDB43@klingenberg.no> (Peder O. Klingenberg's message of "Sat, 14 Mar 2015 23:36:26 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 1321 Cc: 1321@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > 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: FWIW, I don't really like process-lines at all. It's used rather rarely, so most uses would be just as happy with something like (with-temp-buffer (call-process nil t nil ) (get-buffer-lines)) -- Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 19 18:20:31 2020 Received: (at 1321) by debbugs.gnu.org; 19 Sep 2020 22:20:31 +0000 Received: from localhost ([127.0.0.1]:48350 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJlDb-0004y0-7R for submit@debbugs.gnu.org; Sat, 19 Sep 2020 18:20:31 -0400 Received: from quimby.gnus.org ([95.216.78.240]:52806) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJlDX-0004xi-Oj for 1321@debbugs.gnu.org; Sat, 19 Sep 2020 18:20:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=FTzkZCcqxaRaiCBtGsJJR7MH5O3yB5QFx5MuIi8t8Qs=; b=p1V5SMxzzOdpf60ZSv3JQN/XhQ nYxOjzO0IL3NSG/PXf79+O+W8c1Kf9xy23LUig6Vo0Cfm2dkqLAIgOicVSGbHgEM1qEsrlRrqIt/8 VVU0oKZXlozoZQ17UFu/g+LKzsQPUKpXIyzOcCu7izy0DVR9Ju3Ui0vJlXtShWM+/U00=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJlDM-0007En-Id; Sun, 20 Sep 2020 00:20:19 +0200 From: Lars Ingebrigtsen To: "Peder O. Klingenberg" Subject: Re: bug#1321: process-lines References: <4055444A-BE2E-47A5-BAD1-BD174E8EDB43@klingenberg.no> <5504C819.80701@dancol.org> X-Now-Playing: Anne Pigalle's _Everything Could Be So Perfect..._: "Why does it have to be this way..." Date: Sun, 20 Sep 2020 00:20:14 +0200 In-Reply-To: (Peder O. Klingenberg's message of "Sun, 15 Mar 2015 09:37:38 +0100") Message-ID: <87k0wpjtnl.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: "Peder O. Klingenberg" writes: > That’s 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. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 1321 Cc: 1321@debbugs.gnu.org, Daniel Colascione , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) "Peder O. Klingenberg" writes: > That=E2=80=99s another possibility, of course. But in my opinion, the &r= est > is usually a more convenient API for the callers, saving them the > trouble of consing up a new list. Yup, makes sense to me. Stefan raises the excellent objection that `process-lines' is pretty trivial, and that it's not much used. The former is definitely true, but I wonder whether the reason it's not used much is because of the very awkward interface. Peder's patch fixes this by introducing a -ignore-status version of the function (which is how it should have been all along), so perhaps this version will get more usage. So I've applied Peder's patch to Emacs 28. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 19 18:20:34 2020 Received: (at control) by debbugs.gnu.org; 19 Sep 2020 22:20:34 +0000 Received: from localhost ([127.0.0.1]:48353 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJlDd-0004yG-G1 for submit@debbugs.gnu.org; Sat, 19 Sep 2020 18:20:34 -0400 Received: from quimby.gnus.org ([95.216.78.240]:52818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJlDc-0004xp-BS for control@debbugs.gnu.org; Sat, 19 Sep 2020 18:20:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=aBTuuNymxu/tgwmG2sgcrJ8Uil0snvopwIk63/kp+4g=; b=ZdXIrUYpHv2awbESW39NSPOZUk YvWMP2akbZ/dkUuyEPoTfKOXyZ5R7dPtgp7iCXYo7hjmUY3M3yBJspbmx8ksuzDZOLq4L2X3JcaVi r+2h2pSD5t4cxI2jVIlt3BAI0emwgV6KA2uhtUU4HfR9gklBG/fL3h9nPmIiry2uMBV4=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJlDU-0007Eu-LX for control@debbugs.gnu.org; Sun, 20 Sep 2020 00:20:26 +0200 Date: Sun, 20 Sep 2020 00:20:23 +0200 Message-Id: <87imc9jtnc.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #1321 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 1321 fixed close 1321 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 1321 fixed close 1321 28.1 quit From unknown Fri Sep 05 15:36:50 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 18 Oct 2020 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator