From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail
From: Jakub Jankiewicz <jcubic@onet.pl>
Newsgroups: gmane.emacs.help
Subject: Comint mode with REPL in Node.js and Readline
Date: Thu, 2 Apr 2020 13:18:06 +0200
Message-ID: <20200402131806.40916cb2@jcubic>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202";
	logging-data="100619"; mail-complaints-to="usenet@ciao.gmane.io"
To: help-gnu-emacs@gnu.org
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 02 13:28:15 2020
Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1jJy19-000Q43-0R
	for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 02 Apr 2020 13:28:15 +0200
Original-Received: from localhost ([::1]:37126 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1jJy18-0004jM-2U
	for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 02 Apr 2020 07:28:14 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50210)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <jcubic@onet.pl>) id 1jJy0n-0004j4-Rg
 for help-gnu-emacs@gnu.org; Thu, 02 Apr 2020 07:27:55 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <jcubic@onet.pl>) id 1jJy0m-0007tK-IQ
 for help-gnu-emacs@gnu.org; Thu, 02 Apr 2020 07:27:53 -0400
Original-Received: from smtpo82.poczta.onet.pl ([213.180.149.135]:51666)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <jcubic@onet.pl>) id 1jJy0m-0007sc-0E
 for help-gnu-emacs@gnu.org; Thu, 02 Apr 2020 07:27:52 -0400
Original-Received: from jcubic (unknown [185.129.113.210])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 (Authenticated sender: jcubic@onet.pl)
 by smtp.poczta.onet.pl (Onet) with ESMTPSA id 48tLCR2tZLz1bQNc6
 for <help-gnu-emacs@gnu.org>; Thu,  2 Apr 2020 13:18:10 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=onet.pl; s=2011;
 t=1585826291; bh=5nMNN+94/ni/4Sa0/DFxGqaK9j6X+kXbkOahLTdmAvg=;
 h=Date:From:To:Subject:From;
 b=RL0ECM7EWVid9se4ZQTumF5oXqc7R9GBqcoILC6ffPtJa5srFfH4MOH6i6rgq2Zw+
 jEWvfhQ2T5TlBeqTeggFTr7m1I9h1YMi7i7zRyd6q3p05vYsvG/Pmw0BJfV+L0Swtr
 c7T7cFmfnfBlgNHM9GSoe9yVu8IzL5fjqqVnCN5Y=
X-Mailer: Claws Mail 3.17.3git196 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-Received-From: 213.180.149.135
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-gnu-emacs>,
 <mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/help-gnu-emacs>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
 <mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: "help-gnu-emacs"
 <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>
Xref: news.gmane.io gmane.emacs.help:122735
Archived-At: <http://permalink.gmane.org/gmane.emacs.help/122735>

Hi,

I have issue with comint mode:

I reproduced the issue with simple Node.js code:

shell.js file:

#!/usr/bin/env node
const readline = require('readline');

var prompt = 'lips> ';
var continuePrompt = '... ';
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: prompt,
    terminal: !!process.stdin.isTTY
});
if (process.stdin.isTTY) {
    rl.prompt();
}

rl.on('line', function(line) {
    if (process.stdin.isTTY) {
        rl.prompt();
    }
});

If I run this as scheme in GNU Emacs:

(run-scheme "/path/.../shell.js")
;; this is needed otherwise I get duplicated input
(setq comint-process-echoes t)

And the issue I have is that when I resize the window I've got duplicated:

lips> lips> lips> lips>

What I did wrong with my REPL in Node.js anybody have idea if I need to setup
something in Emacs. REPL works fine in terminal emulator and ansi-term.

I've asked the same question on StackOverflow in hope I'll get some answers
how to fix this:

https://stackoverflow.com/q/60987722/387194

I have no idea if it's issue with Node.js Readline or with GNU Emacs comint
mode.

--
Jakub Jankiewicz, Web Developer
https://jcubic.pl/me