* bug#15180: Using princ without ending newline
@ 2013-08-24 15:49 Johan Andersson
2013-08-25 1:05 ` Glenn Morris
2013-09-15 16:42 ` Barry OReilly
0 siblings, 2 replies; 17+ messages in thread
From: Johan Andersson @ 2013-08-24 15:49 UTC (permalink / raw)
To: 15180
[-- Attachment #1: Type: text/plain, Size: 261 bytes --]
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?
[-- Attachment #2: Type: text/html, Size: 577 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Using princ without ending newline
2013-08-24 15:49 bug#15180: Using princ without ending newline Johan Andersson
@ 2013-08-25 1:05 ` Glenn Morris
2013-08-25 7:07 ` Johan Andersson
2013-09-15 16:42 ` Barry OReilly
1 sibling, 1 reply; 17+ messages in thread
From: Glenn Morris @ 2013-08-25 1:05 UTC (permalink / raw)
To: Johan Andersson; +Cc: 15180
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)?
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Using princ without ending newline
2013-08-25 1:05 ` Glenn Morris
@ 2013-08-25 7:07 ` Johan Andersson
2013-09-12 6:20 ` Johan Andersson
0 siblings, 1 reply; 17+ messages in thread
From: Johan Andersson @ 2013-08-25 7:07 UTC (permalink / raw)
To: Glenn Morris; +Cc: 15180
[-- Attachment #1: Type: text/plain, Size: 2772 bytes --]
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@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)?
>
[-- Attachment #2: Type: text/html, Size: 3923 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Using princ without ending newline
2013-08-25 7:07 ` Johan Andersson
@ 2013-09-12 6:20 ` Johan Andersson
2013-09-12 8:29 ` Jan Djärv
2013-09-12 8:44 ` Andreas Schwab
0 siblings, 2 replies; 17+ messages in thread
From: Johan Andersson @ 2013-09-12 6:20 UTC (permalink / raw)
To: Glenn Morris; +Cc: 15180
[-- Attachment #1: Type: text/plain, Size: 3011 bytes --]
Did anyone reproduce this?
On Aug 25, 2013 9:07 AM, "Johan Andersson" <johan.rejeep@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@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)?
>>
>
>
[-- Attachment #2: Type: text/html, Size: 4265 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Using princ without ending newline
2013-09-12 6:20 ` Johan Andersson
@ 2013-09-12 8:29 ` Jan Djärv
2013-09-12 8:44 ` Andreas Schwab
1 sibling, 0 replies; 17+ messages in thread
From: Jan Djärv @ 2013-09-12 8:29 UTC (permalink / raw)
To: Johan Andersson; +Cc: 15180@debbugs.gnu.org
[-- Attachment #1: Type: text/plain, Size: 188 bytes --]
Hi.
12 sep 2013 kl. 08:20 skrev Johan Andersson <johan.rejeep@gmail.com>:
> Did anyone reproduce this?
>
No, not with 24.3 or trunk on OSX.
You did start Emacs with -Q?
Jan D.
[-- Attachment #2: Type: text/html, Size: 845 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Using princ without ending newline
2013-09-12 6:20 ` Johan Andersson
2013-09-12 8:29 ` Jan Djärv
@ 2013-09-12 8:44 ` Andreas Schwab
2013-09-12 9:40 ` Johan Andersson
1 sibling, 1 reply; 17+ messages in thread
From: Andreas Schwab @ 2013-09-12 8:44 UTC (permalink / raw)
To: Johan Andersson; +Cc: 15180
Johan Andersson <johan.rejeep@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@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Using princ without ending newline
2013-09-12 8:44 ` Andreas Schwab
@ 2013-09-12 9:40 ` Johan Andersson
2013-09-12 10:02 ` Andreas Schwab
0 siblings, 1 reply; 17+ messages in thread
From: Johan Andersson @ 2013-09-12 9:40 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 15180
[-- Attachment #1: Type: text/plain, Size: 838 bytes --]
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@suse.de> wrote:
> Johan Andersson <johan.rejeep@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@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
>
[-- Attachment #2: Type: text/html, Size: 1769 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Using princ without ending newline
2013-09-12 9:40 ` Johan Andersson
@ 2013-09-12 10:02 ` Andreas Schwab
2013-09-12 10:27 ` Johan Andersson
0 siblings, 1 reply; 17+ messages in thread
From: Andreas Schwab @ 2013-09-12 10:02 UTC (permalink / raw)
To: Johan Andersson; +Cc: 15180
Johan Andersson <johan.rejeep@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@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Using princ without ending newline
2013-09-12 10:02 ` Andreas Schwab
@ 2013-09-12 10:27 ` Johan Andersson
2013-09-12 10:35 ` Andreas Schwab
0 siblings, 1 reply; 17+ messages in thread
From: Johan Andersson @ 2013-09-12 10:27 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 15180
[-- Attachment #1: Type: text/plain, Size: 807 bytes --]
And what is "Non-interactive output"?
On Thu, Sep 12, 2013 at 12:02 PM, Andreas Schwab <schwab@suse.de> wrote:
> Johan Andersson <johan.rejeep@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@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
>
[-- Attachment #2: Type: text/html, Size: 1544 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Using princ without ending newline
2013-09-12 10:27 ` Johan Andersson
@ 2013-09-12 10:35 ` Andreas Schwab
2013-09-12 10:40 ` Johan Andersson
0 siblings, 1 reply; 17+ messages in thread
From: Andreas Schwab @ 2013-09-12 10:35 UTC (permalink / raw)
To: Johan Andersson; +Cc: 15180
Johan Andersson <johan.rejeep@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@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Using princ without ending newline
2013-09-12 10:35 ` Andreas Schwab
@ 2013-09-12 10:40 ` Johan Andersson
2013-09-12 10:45 ` Andreas Schwab
0 siblings, 1 reply; 17+ messages in thread
From: Johan Andersson @ 2013-09-12 10:40 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 15180
[-- Attachment #1: Type: text/plain, Size: 471 bytes --]
Is the buffer flushed on newline?
On Thu, Sep 12, 2013 at 12:35 PM, Andreas Schwab <schwab@suse.de> wrote:
> Johan Andersson <johan.rejeep@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@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
>
[-- Attachment #2: Type: text/html, Size: 986 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Using princ without ending newline
2013-09-12 10:40 ` Johan Andersson
@ 2013-09-12 10:45 ` Andreas Schwab
2013-09-12 11:47 ` Johan Andersson
0 siblings, 1 reply; 17+ messages in thread
From: Andreas Schwab @ 2013-09-12 10:45 UTC (permalink / raw)
To: Johan Andersson; +Cc: 15180
Johan Andersson <johan.rejeep@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@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Using princ without ending newline
2013-08-24 15:49 bug#15180: Using princ without ending newline Johan Andersson
2013-08-25 1:05 ` Glenn Morris
@ 2013-09-15 16:42 ` Barry OReilly
2013-09-18 19:49 ` Johan Andersson
1 sibling, 1 reply; 17+ messages in thread
From: Barry OReilly @ 2013-09-15 16:42 UTC (permalink / raw)
To: johan.rejeep, schwab; +Cc: 15180
[-- Attachment #1: Type: text/plain, Size: 232 bytes --]
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.
[-- Attachment #2: Type: text/html, Size: 268 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Using princ without ending newline
2013-09-15 16:42 ` Barry OReilly
@ 2013-09-18 19:49 ` Johan Andersson
2013-09-19 13:46 ` Stefan Monnier
0 siblings, 1 reply; 17+ messages in thread
From: Johan Andersson @ 2013-09-18 19:49 UTC (permalink / raw)
To: Barry OReilly; +Cc: Andreas Schwab, 15180
[-- Attachment #1: Type: text/plain, Size: 410 bytes --]
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@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.
>
>
[-- Attachment #2: Type: text/html, Size: 743 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Using princ without ending newline
2013-09-18 19:49 ` Johan Andersson
@ 2013-09-19 13:46 ` Stefan Monnier
2022-04-17 12:05 ` bug#15180: Add a way to fflush stdout in batch mode Lars Ingebrigtsen
0 siblings, 1 reply; 17+ messages in thread
From: Stefan Monnier @ 2013-09-19 13:46 UTC (permalink / raw)
To: Johan Andersson; +Cc: Andreas Schwab, Barry OReilly, 15180
>> 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#15180: Add a way to fflush stdout in batch mode
2013-09-19 13:46 ` Stefan Monnier
@ 2022-04-17 12:05 ` Lars Ingebrigtsen
0 siblings, 0 replies; 17+ messages in thread
From: Lars Ingebrigtsen @ 2022-04-17 12:05 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Andreas Schwab, Barry OReilly, 15180, Johan Andersson
Stefan Monnier <monnier@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
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2022-04-17 12:05 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-24 15:49 bug#15180: Using princ without ending newline Johan Andersson
2013-08-25 1:05 ` Glenn Morris
2013-08-25 7:07 ` Johan Andersson
2013-09-12 6:20 ` Johan Andersson
2013-09-12 8:29 ` Jan Djärv
2013-09-12 8:44 ` Andreas Schwab
2013-09-12 9:40 ` Johan Andersson
2013-09-12 10:02 ` Andreas Schwab
2013-09-12 10:27 ` Johan Andersson
2013-09-12 10:35 ` Andreas Schwab
2013-09-12 10:40 ` Johan Andersson
2013-09-12 10:45 ` Andreas Schwab
2013-09-12 11:47 ` Johan Andersson
2013-09-15 16:42 ` Barry OReilly
2013-09-18 19:49 ` Johan Andersson
2013-09-19 13:46 ` Stefan Monnier
2022-04-17 12:05 ` bug#15180: Add a way to fflush stdout in batch mode Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).