GNU bug report logs - #15180
Add a way to fflush stdout in batch mode

Previous Next

Package: emacs;

Reported by: Johan Andersson <johan.rejeep <at> gmail.com>

Date: Sat, 24 Aug 2013 15:50:01 UTC

Severity: wishlist

Fixed in version 29.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 15180 in the body.
You can then email your comments to 15180 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 forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Sat, 24 Aug 2013 15:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Johan Andersson <johan.rejeep <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 24 Aug 2013 15:50:03 GMT) Full text and rfc822 format available.

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

From: Johan Andersson <johan.rejeep <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Using princ without ending newline
Date: Sat, 24 Aug 2013 17:49:12 +0200
[Message part 1 (text/plain, inline)]
Hi,

It seems that princ will not print output directly if there's no ending
newline. For example:

(princ "foo\n")
(princ "bar")
(sleep-for 3)

This will print "foo" directly, then wait three seconds and then print
"bar". Why does it not print "bar" directly?
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Sun, 25 Aug 2013 01:06:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Johan Andersson <johan.rejeep <at> gmail.com>
Cc: 15180 <at> debbugs.gnu.org
Subject: Re: bug#15180: Using princ without ending newline
Date: Sat, 24 Aug 2013 21:05:32 -0400
Johan Andersson wrote:

> It seems that princ will not print output directly if there's no ending
> newline.

I can't reproduce this. Does this happen with emacs -Q?
What version of Emacs is this (M-x report-emacs-bug includes such
information automatically)?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Sun, 25 Aug 2013 07:08:02 GMT) Full text and rfc822 format available.

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

From: Johan Andersson <johan.rejeep <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 15180 <at> debbugs.gnu.org
Subject: Re: bug#15180: Using princ without ending newline
Date: Sun, 25 Aug 2013 09:07:23 +0200
[Message part 1 (text/plain, inline)]
Sorry for the lack of information. I figured it was global since I have the
exact same problem in 23.4 and snapshot. Maybe it's a Mac bug.

In GNU Emacs 24.3.1 (x86_64-apple-darwin12.2.0, NS apple-appkit-1187.34)
 of 2013-03-14 on Johans-MacBook-Pro.local
Windowing system distributor `Apple', version 10.3.1187
Configured using:
 `configure '--prefix=/usr/local/Cellar/emacs/24.3' '--without-dbus'
 '--enable-locallisppath=/usr/local/share/emacs/site-lisp'
 '--infodir=/usr/local/Cellar/emacs/24.3/share/info/emacs' '--with-ns'
 '--disable-ns-self-contained' 'CC=cc''

Important settings:
  value of $LC_CTYPE: sv_SE.UTF-8
  value of $LANG: sv_SE.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC [ > 0 ; 9 5 ; c ESC x e m a c s TAB b u TAB ESC
C-h ESC C-h C-e DEL DEL DEL DEL DEL DEL DEL DEL DEL
DEL r e p o TAB r t TAB RET

Recent messages:
("/usr/local/Cellar/emacs/24.3/Emacs.app/Contents/MacOS/Emacs" "princ.el")
For information about GNU Emacs and the GNU system, type C-h C-a.
delete-backward-char: Text is read-only [2 times]
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils help-mode easymenu time-date tooltip ediff-hook
vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process ns multi-tty emacs)


On Sun, Aug 25, 2013 at 3:05 AM, Glenn Morris <rgm <at> gnu.org> wrote:

> Johan Andersson wrote:
>
> > It seems that princ will not print output directly if there's no ending
> > newline.
>
> I can't reproduce this. Does this happen with emacs -Q?
> What version of Emacs is this (M-x report-emacs-bug includes such
> information automatically)?
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Thu, 12 Sep 2013 06:21:02 GMT) Full text and rfc822 format available.

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

From: Johan Andersson <johan.rejeep <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 15180 <at> debbugs.gnu.org
Subject: Re: bug#15180: Using princ without ending newline
Date: Thu, 12 Sep 2013 08:20:33 +0200
[Message part 1 (text/plain, inline)]
Did anyone reproduce this?
On Aug 25, 2013 9:07 AM, "Johan Andersson" <johan.rejeep <at> gmail.com> wrote:

> Sorry for the lack of information. I figured it was global since I have
> the exact same problem in 23.4 and snapshot. Maybe it's a Mac bug.
>
> In GNU Emacs 24.3.1 (x86_64-apple-darwin12.2.0, NS apple-appkit-1187.34)
>  of 2013-03-14 on Johans-MacBook-Pro.local
> Windowing system distributor `Apple', version 10.3.1187
> Configured using:
>  `configure '--prefix=/usr/local/Cellar/emacs/24.3' '--without-dbus'
>  '--enable-locallisppath=/usr/local/share/emacs/site-lisp'
>  '--infodir=/usr/local/Cellar/emacs/24.3/share/info/emacs' '--with-ns'
>  '--disable-ns-self-contained' 'CC=cc''
>
> Important settings:
>   value of $LC_CTYPE: sv_SE.UTF-8
>   value of $LANG: sv_SE.UTF-8
>   locale-coding-system: utf-8-unix
>   default enable-multibyte-characters: t
>
> Major mode: Emacs-Lisp
>
> Minor modes in effect:
>   tooltip-mode: t
>   mouse-wheel-mode: t
>   tool-bar-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>
> Recent input:
> ESC [ > 0 ; 9 5 ; c ESC x e m a c s TAB b u TAB ESC
> C-h ESC C-h C-e DEL DEL DEL DEL DEL DEL DEL DEL DEL
> DEL r e p o TAB r t TAB RET
>
> Recent messages:
> ("/usr/local/Cellar/emacs/24.3/Emacs.app/Contents/MacOS/Emacs" "princ.el")
> For information about GNU Emacs and the GNU system, type C-h C-a.
> delete-backward-char: Text is read-only [2 times]
> Making completion list...
>
> Load-path shadows:
> None found.
>
> Features:
> (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
> mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
> gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
> mail-prsvr mail-utils help-mode easymenu time-date tooltip ediff-hook
> vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset image
> regexp-opt fringe tabulated-list newcomment lisp-mode register page
> menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
> syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
> vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
> romanian slovak czech european ethiopic indian cyrillic chinese
> case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
> button faces cus-face macroexp files text-properties overlay sha1 md5
> base64 format env code-pages mule custom widget hashtable-print-readable
> backquote make-network-process ns multi-tty emacs)
>
>
> On Sun, Aug 25, 2013 at 3:05 AM, Glenn Morris <rgm <at> gnu.org> wrote:
>
>> Johan Andersson wrote:
>>
>> > It seems that princ will not print output directly if there's no ending
>> > newline.
>>
>> I can't reproduce this. Does this happen with emacs -Q?
>> What version of Emacs is this (M-x report-emacs-bug includes such
>> information automatically)?
>>
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Thu, 12 Sep 2013 08:30:03 GMT) Full text and rfc822 format available.

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

From: Jan Djärv <jan.h.d <at> swipnet.se>
To: Johan Andersson <johan.rejeep <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, "15180 <at> debbugs.gnu.org" <15180 <at> debbugs.gnu.org>
Subject: Re: bug#15180: Using princ without ending newline
Date: Thu, 12 Sep 2013 10:29:38 +0200
[Message part 1 (text/plain, inline)]
Hi. 

12 sep 2013 kl. 08:20 skrev Johan Andersson <johan.rejeep <at> gmail.com>:

> Did anyone reproduce this?
> 

No, not with 24.3 or trunk on OSX. 
You did start Emacs with -Q?

     Jan D. 
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Thu, 12 Sep 2013 08:45:01 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> suse.de>
To: Johan Andersson <johan.rejeep <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 15180 <at> debbugs.gnu.org
Subject: Re: bug#15180: Using princ without ending newline
Date: Thu, 12 Sep 2013 10:44:28 +0200
Johan Andersson <johan.rejeep <at> gmail.com> writes:

> Did anyone reproduce this?

You didn't provide a complete test case, starting from emacs -Q.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Thu, 12 Sep 2013 09:42:01 GMT) Full text and rfc822 format available.

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

From: Johan Andersson <johan.rejeep <at> gmail.com>
To: Andreas Schwab <schwab <at> suse.de>
Cc: Glenn Morris <rgm <at> gnu.org>, 15180 <at> debbugs.gnu.org
Subject: Re: bug#15180: Using princ without ending newline
Date: Thu, 12 Sep 2013 11:40:34 +0200
[Message part 1 (text/plain, inline)]
I don't think I will be able to write a test case. But here's a step to
step instruction for how to reproduce it:

Create a file called *princ.el* with this content:

(princ "foo\n")
(princ "bar")
(princ "baz")
(sleep-for 3)

Run command: emacs -Q --script princ.el

I expect this to be printed *directly*:
foo
barbaz

But what happens is that "foo" is printed directly and then after three
seconds "barbaz" is printed.


On Thu, Sep 12, 2013 at 10:44 AM, Andreas Schwab <schwab <at> suse.de> wrote:

> Johan Andersson <johan.rejeep <at> gmail.com> writes:
>
> > Did anyone reproduce this?
>
> You didn't provide a complete test case, starting from emacs -Q.
>
> Andreas.
>
> --
> Andreas Schwab, SUSE Labs, schwab <at> suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Thu, 12 Sep 2013 10:03:02 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> suse.de>
To: Johan Andersson <johan.rejeep <at> gmail.com>
Cc: 15180 <at> debbugs.gnu.org
Subject: Re: bug#15180: Using princ without ending newline
Date: Thu, 12 Sep 2013 12:02:41 +0200
Johan Andersson <johan.rejeep <at> gmail.com> writes:

> Create a file called *princ.el* with this content:
>
> (princ "foo\n")
> (princ "bar")
> (princ "baz")
> (sleep-for 3)
>
> Run command: emacs -Q --script princ.el
>
> I expect this to be printed *directly*:
> foo
> barbaz
>
> But what happens is that "foo" is printed directly and then after three
> seconds "barbaz" is printed.

This is not a bug.  Non-interactive output is subject to the usual stdio
buffering.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Thu, 12 Sep 2013 10:28:01 GMT) Full text and rfc822 format available.

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

From: Johan Andersson <johan.rejeep <at> gmail.com>
To: Andreas Schwab <schwab <at> suse.de>
Cc: 15180 <at> debbugs.gnu.org
Subject: Re: bug#15180: Using princ without ending newline
Date: Thu, 12 Sep 2013 12:27:06 +0200
[Message part 1 (text/plain, inline)]
And what is "Non-interactive output"?


On Thu, Sep 12, 2013 at 12:02 PM, Andreas Schwab <schwab <at> suse.de> wrote:

> Johan Andersson <johan.rejeep <at> gmail.com> writes:
>
> > Create a file called *princ.el* with this content:
> >
> > (princ "foo\n")
> > (princ "bar")
> > (princ "baz")
> > (sleep-for 3)
> >
> > Run command: emacs -Q --script princ.el
> >
> > I expect this to be printed *directly*:
> > foo
> > barbaz
> >
> > But what happens is that "foo" is printed directly and then after three
> > seconds "barbaz" is printed.
>
> This is not a bug.  Non-interactive output is subject to the usual stdio
> buffering.
>
> Andreas.
>
> --
> Andreas Schwab, SUSE Labs, schwab <at> suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Thu, 12 Sep 2013 10:36:01 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> suse.de>
To: Johan Andersson <johan.rejeep <at> gmail.com>
Cc: 15180 <at> debbugs.gnu.org
Subject: Re: bug#15180: Using princ without ending newline
Date: Thu, 12 Sep 2013 12:35:07 +0200
Johan Andersson <johan.rejeep <at> gmail.com> writes:

> And what is "Non-interactive output"?

Anything that is printed in batch mode, where noninteractive is non-nil.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Thu, 12 Sep 2013 10:42:01 GMT) Full text and rfc822 format available.

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

From: Johan Andersson <johan.rejeep <at> gmail.com>
To: Andreas Schwab <schwab <at> suse.de>
Cc: 15180 <at> debbugs.gnu.org
Subject: Re: bug#15180: Using princ without ending newline
Date: Thu, 12 Sep 2013 12:40:46 +0200
[Message part 1 (text/plain, inline)]
Is the buffer flushed on newline?


On Thu, Sep 12, 2013 at 12:35 PM, Andreas Schwab <schwab <at> suse.de> wrote:

> Johan Andersson <johan.rejeep <at> gmail.com> writes:
>
> > And what is "Non-interactive output"?
>
> Anything that is printed in batch mode, where noninteractive is non-nil.
>
> Andreas.
>
> --
> Andreas Schwab, SUSE Labs, schwab <at> suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Thu, 12 Sep 2013 10:46:01 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> suse.de>
To: Johan Andersson <johan.rejeep <at> gmail.com>
Cc: 15180 <at> debbugs.gnu.org
Subject: Re: bug#15180: Using princ without ending newline
Date: Thu, 12 Sep 2013 12:45:11 +0200
Johan Andersson <johan.rejeep <at> gmail.com> writes:

> Is the buffer flushed on newline?

Depends on whether output goes to a terminal (in which case stdio is
line buffered) or not (in which case stdio is fully buffered).

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Thu, 12 Sep 2013 11:48:02 GMT) Full text and rfc822 format available.

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

From: Johan Andersson <johan.rejeep <at> gmail.com>
To: Andreas Schwab <schwab <at> suse.de>
Cc: 15180 <at> debbugs.gnu.org
Subject: Re: bug#15180: Using princ without ending newline
Date: Thu, 12 Sep 2013 13:47:03 +0200
[Message part 1 (text/plain, inline)]
Ok, is there any way to disable the buffering?


On Thu, Sep 12, 2013 at 12:45 PM, Andreas Schwab <schwab <at> suse.de> wrote:

> Johan Andersson <johan.rejeep <at> gmail.com> writes:
>
> > Is the buffer flushed on newline?
>
> Depends on whether output goes to a terminal (in which case stdio is
> line buffered) or not (in which case stdio is fully buffered).
>
> Andreas.
>
> --
> Andreas Schwab, SUSE Labs, schwab <at> suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Sun, 15 Sep 2013 16:43:02 GMT) Full text and rfc822 format available.

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

From: Barry OReilly <gundaetiapo <at> gmail.com>
To: johan.rejeep <at> gmail.com, schwab <at> suse.de
Cc: 15180 <at> debbugs.gnu.org
Subject: Re: bug#15180: Using princ without ending newline
Date: Sun, 15 Sep 2013 12:42:18 -0400
[Message part 1 (text/plain, inline)]
What is the function to flush a stdio stream from Elisp? If it exists then
it could be called before the sleep-for.

An alternative to adding such a function is to simply have the print
functions call fflush in C if noninteractive.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Wed, 18 Sep 2013 19:51:02 GMT) Full text and rfc822 format available.

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

From: Johan Andersson <johan.rejeep <at> gmail.com>
To: Barry OReilly <gundaetiapo <at> gmail.com>
Cc: Andreas Schwab <schwab <at> suse.de>, 15180 <at> debbugs.gnu.org
Subject: Re: bug#15180: Using princ without ending newline
Date: Wed, 18 Sep 2013 21:49:37 +0200
[Message part 1 (text/plain, inline)]
That function would be awesome. Is it possible to call such a C function
from Elisp?


On Sun, Sep 15, 2013 at 6:42 PM, Barry OReilly <gundaetiapo <at> gmail.com>wrote:

> What is the function to flush a stdio stream from Elisp? If it exists then
> it could be called before the sleep-for.
>
> An alternative to adding such a function is to simply have the print
> functions call fflush in C if noninteractive.
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Thu, 19 Sep 2013 13:47:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Johan Andersson <johan.rejeep <at> gmail.com>
Cc: Andreas Schwab <schwab <at> suse.de>, Barry OReilly <gundaetiapo <at> gmail.com>,
 15180 <at> debbugs.gnu.org
Subject: Re: bug#15180: Using princ without ending newline
Date: Thu, 19 Sep 2013 09:46:26 -0400
>> What is the function to flush a stdio stream from Elisp? If it exists then
>> it could be called before the sleep-for.
>> An alternative to adding such a function is to simply have the print
>> functions call fflush in C if noninteractive.
> That function would be awesome. Is it possible to call such a C function
> from Elisp?

I guess it would make sense to call fflush in the batch equivalent
of redisplay.


        Stefan




Severity set to 'wishlist' from 'minor' Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 25 Mar 2017 05:46:01 GMT) Full text and rfc822 format available.

Changed bug title to 'Add a way to fflush stdout in batch mode' from 'Using princ without ending newline' Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 25 Mar 2017 05:46:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15180; Package emacs. (Sun, 17 Apr 2022 12:07:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Andreas Schwab <schwab <at> suse.de>, Barry OReilly <gundaetiapo <at> gmail.com>,
 15180 <at> debbugs.gnu.org, Johan Andersson <johan.rejeep <at> gmail.com>
Subject: Re: bug#15180: Add a way to fflush stdout in batch mode
Date: Sun, 17 Apr 2022 14:05:59 +0200
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

>>> What is the function to flush a stdio stream from Elisp? If it exists then
>>> it could be called before the sleep-for.
>>> An alternative to adding such a function is to simply have the print
>>> functions call fflush in C if noninteractive.
>> That function would be awesome. Is it possible to call such a C function
>> from Elisp?
>
> I guess it would make sense to call fflush in the batch equivalent
> of redisplay.

That sounds attractive, but I think there's a real possibility that that
could have unforeseen effects in older scripts -- uncomplete lines would
be output automatically, and that might break stuff.

So I've instead added a `flush-standard-output' function to Emacs 29, so
that the script writers can control this themselves.

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




bug marked as fixed in version 29.1, send any further explanations to 15180 <at> debbugs.gnu.org and Johan Andersson <johan.rejeep <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 17 Apr 2022 12:07: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. (Mon, 16 May 2022 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 338 days ago.

Previous Next


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