GNU bug report logs - #1321
process-lines

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Sun, 9 Nov 2008 21:30:04 UTC

Severity: wishlist

Tags: fixed

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1321 in the body.
You can then email your comments to 1321 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report stored:
bug#1321; Package emacs. Full text and rfc822 format available.

Message #3 received at quiet <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: quiet <at> debbugs.gnu.org
Subject: process-lines
Date: Sun, 19 Oct 2008 14:36:32 +0200
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".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1321; Package emacs. (Sat, 14 Mar 2015 22:37:02 GMT) Full text and rfc822 format available.

Message #6 received at 1321 <at> debbugs.gnu.org (full text, mbox):

From: "Peder O. Klingenberg" <peder <at> klingenberg.no>
To: 1321 <at> debbugs.gnu.org
Subject: Re: process-lines
Date: Sat, 14 Mar 2015 23:36:26 +0100
[Message part 1 (text/plain, inline)]
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...
-- 
Sløv uten dop
[0001-Extend-process-lines-to-allow-exit-status-handling.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1321; Package emacs. (Sat, 14 Mar 2015 23:46:01 GMT) Full text and rfc822 format available.

Message #9 received at 1321 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Colascione <dancol <at> dancol.org>
To: "Peder O. Klingenberg" <peder <at> klingenberg.no>, 1321 <at> debbugs.gnu.org
Subject: Re: bug#1321: process-lines
Date: Sat, 14 Mar 2015 16:45:29 -0700
[Message part 1 (text/plain, inline)]
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?


[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1321; Package emacs. (Sun, 15 Mar 2015 08:38:01 GMT) Full text and rfc822 format available.

Message #12 received at 1321 <at> debbugs.gnu.org (full text, mbox):

From: "Peder O. Klingenberg" <peder <at> klingenberg.no>
To: Daniel Colascione <dancol <at> dancol.org>
Cc: 1321 <at> debbugs.gnu.org
Subject: Re: bug#1321: process-lines
Date: Sun, 15 Mar 2015 09:37:38 +0100
[Message part 1 (text/plain, inline)]
On 15 Mar, 2015, at 0:45, Daniel Colascione <dancol <at> dancol.org> wrote:
> 
> What about defining a `process-lines-2' that takes keyword arguments and
> accepts a list for PROGRAM?

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.  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’t work as advertised.  Sorry.  Please ignore my previous patch and consider this one instead:


...Peder...
-- 
Sløv uten dop
[0001-Extend-process-lines-to-allow-exit-status-handling-v2.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1321; Package emacs. (Sun, 15 Mar 2015 20:44:02 GMT) Full text and rfc822 format available.

Message #15 received at 1321 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Peder O. Klingenberg" <peder <at> klingenberg.no>
Cc: 1321 <at> debbugs.gnu.org
Subject: Re: bug#1321: process-lines
Date: Sun, 15 Mar 2015 16:43:57 -0400
> 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 <prog> nil t nil <args>)
      (get-buffer-lines))


-- Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1321; Package emacs. (Sat, 19 Sep 2020 22:21:01 GMT) Full text and rfc822 format available.

Message #18 received at 1321 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Peder O. Klingenberg" <peder <at> klingenberg.no>
Cc: 1321 <at> debbugs.gnu.org, Daniel Colascione <dancol <at> dancol.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#1321: process-lines
Date: Sun, 20 Sep 2020 00:20:14 +0200
"Peder O. Klingenberg" <peder <at> klingenberg.no> 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.

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.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 19 Sep 2020 22:21:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 1321 <at> debbugs.gnu.org and Eli Zaretskii <eliz <at> gnu.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 19 Sep 2020 22:21:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 18 Oct 2020 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 162 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.