From: "Jose A. Ortega Ruiz" <jao-mXXj517/zsQ@public.gmane.org>
To: Mark H Weaver <mhw-StlzRsPvAncdnm+yROfE0A@public.gmane.org>
Cc: geiser-users-qX2TKyscuCcdnm+yROfE0A@public.gmane.org,
emacs-orgmode-mXXj517/zsQ@public.gmane.org,
33403-ubl+/3LiMTaZdePnXv/OxA@public.gmane.org
Subject: Re: bug#33403: Data length limit in Guile/Geiser/Scheme evaluation
Date: Sat, 17 Nov 2018 14:59:24 +0000 [thread overview]
Message-ID: <87ftvzwy0j.fsf@imladris> (raw)
In-Reply-To: <87zhu8w55u.fsf-StlzRsPvAncdnm+yROfE0A@public.gmane.org> (Mark H. Weaver's message of "Sat, 17 Nov 2018 02:09:54 -0500")
On Sat, Nov 17 2018, Mark H Weaver wrote:
[...]
>> Ah, system* is a scheme call! So yeah, maybe we could add that call to
>> Geiser's guile initialization... i don't really see how that would cause
>> any problem elsewhere.
>
> I think something like this should be done, not only in the Guile
> initialization, but ideally in the generic Geiser code that connects to
> inferior processes via pseudo-tty. After the pseudo-tty is allocated
> but before launching the inferior Scheme process, something like "stty
> --file=/dev/pts/N -icanon" should be run.
>
> However, before doing this, some warnings are in order:
>
> When in noncanonical mode, the normal processing of ERASE (usually DEL
> or Ctrl-H) and KILL (usually Ctrl-U) characters are disabled, and input
> characters are delivered to the subprocess immediately as they are
> typed, rather than waiting for the newline as normally happens in
> canonical mode.
>
> At least in the case of the Guile REPL, one notable side effect of
> running in noncanonical mode is that when a list is entered at the REPL,
> the 'read' returns as soon as the final close parenthesis is entered.
> Nothing after that is read, not even the usual newline. The final
> newline is only read if the reader is not yet sure that it has finished
> reading the token, e.g. if a number or symbol is entered. In those
> cases, typically any delimiter may be typed to terminate the read,
> e.g. space.
>
> To see this, you can try running Guile from a traditional terminal
> program (e.g. xterm or GNOME Terminal), and type:
>
> (system* "stty" "-icanon")
>
> and then:
>
> (display "hello")
>
> You will see that as soon as you type that close paren, "hello" is
> immediately printed, followed by another REPL prompt, all on the same
> line.
I think this is not an actual problem in Geiser. In comint mode, the
stdin of the Guile process doesn't receive any input bytes until higher
level elisp functions send them, and that's totally under our control.
Repeating that experiment in a Geiser REPL, nothing is printed before a
RET (and, in fact, we might not even send the RET to Guile).
>
> You might also try (use-modules (ice-9 rdelim)) and then:
>
> (read-line)
>
> and you'll see that the newline you type at the end of that line is read
> by 'read-line', which then immediately returns the empty string. The
> input that you wish for 'read-line' to see must be typed on the same
> line, immediately after the close parenthesis.
Again, a comint/geiser REPL doesn't have this problem.
> So, it might be that Geiser needs to be adjusted somewhat to deal with
> these differences.
Seems we're lucky enough to be already adjusted :)
> Finally, you might consider the possibility that 'stty' might not be
> available in PATH, or fails for some reason, and ideally this case
> should be handled as well.
Yes, that's a real concern. We should at least provide some kind of
warning.
> It might be simpler to always use REPL servers over a socket, than to
> deal with these headaches, although I don't know if that will be an
> option for the other Scheme implementations.
Not for all of them. For Guile it's doable, but definitely not
"simpler", it requires some work and solving some unrelated corner
cases; but it might be worth the effort, because it's a cleaner
interaction mode (for instance, behaves much better in the presence of
multiple threads).
Cheers,
jao
--
Beware of the stories you read or tell; subtly, at night, beneath the
waters of consciousness, they are altering your world.
-Ben Okri, poet and novelist
prev parent reply other threads:[~2018-11-17 14:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-15 14:21 Data length limit in Guile/Geiser/Scheme evaluation Neil Jerram
2018-11-15 14:26 ` Neil Jerram
2018-11-15 15:20 ` Nicolas Goaziou
2018-11-15 16:04 ` Neil Jerram
[not found] ` <87h8gi1g5g.fsf-mq78CtbEgnGjF4gvJNWmbtHuzzzSOjJt@public.gmane.org>
2018-11-15 17:01 ` Jose A. Ortega Ruiz
2018-11-15 17:32 ` [Geiser-users] " Neil Jerram
[not found] ` <87bm6q1c33.fsf-mq78CtbEgnGjF4gvJNWmbtHuzzzSOjJt@public.gmane.org>
2018-11-15 23:17 ` Jose A. Ortega Ruiz
[not found] ` <87o9aq55tl.fsf@ossau.homelinux.net>
[not found] ` <87d0r5349t.fsf@netris.org>
[not found] ` <87y39t1olc.fsf@netris.org>
[not found] ` <878t1t1ety.fsf@ossau.homelinux.net>
2018-11-16 11:16 ` bug#33403: [Geiser-users] " Neil Jerram
[not found] ` <875zwx1dcn.fsf-mq78CtbEgnGjF4gvJNWmbtHuzzzSOjJt@public.gmane.org>
2018-11-16 23:12 ` bug#33403: " Jose A. Ortega Ruiz
2018-11-17 7:09 ` Mark H Weaver
[not found] ` <87zhu8w55u.fsf-StlzRsPvAncdnm+yROfE0A@public.gmane.org>
2018-11-17 7:31 ` Mark H Weaver
2018-11-17 14:59 ` Jose A. Ortega Ruiz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ftvzwy0j.fsf@imladris \
--to=jao-mxxj517/zsq@public.gmane.org \
--cc=33403-ubl+/3LiMTaZdePnXv/OxA@public.gmane.org \
--cc=emacs-orgmode-mXXj517/zsQ@public.gmane.org \
--cc=geiser-users-qX2TKyscuCcdnm+yROfE0A@public.gmane.org \
--cc=mhw-StlzRsPvAncdnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.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).