emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scheme Interpreter in Emacs and Readline


From: Jakub Jankiewicz
Subject: Re: Scheme Interpreter in Emacs and Readline
Date: Sun, 19 Apr 2020 09:14:00 +0200


On Sun, 19 Apr 2020 08:02:02 +0800
Po Lu <address@hidden> wrote:

> Jakub Jankiewicz <address@hidden> writes:
> 
> >> What do you mean by "when I resize the window or frame it keep adding
> >> prompt to the prompt line"?  
> >
> > I have prompt "lips> " and when I resize Emacs window on Fedora GNU/Linux
> > (the only system I was testing this). on each resize I get new prompt so
> > when I keep resizing I have something like this:
> >  
> > lips> lips> lips> lips> lips>  
> >
> > and they are all prompt because I can't delete it. Unless something wierd
> > is happening.
> >  
> >> It would also probbaly be helpful if you could post the source of your
> >> Scheme interpreter.  
> >
> > Sorry about that, my Scheme Interpreter is here:
> >
> > https://github.com/jcubic/lips/tree/devel
> >
> > Please use devel branch since it's most up to date, I still try to make it
> > compatible with R5RS, before I release new version, it will 1.0.
> >
> > The executable is in bin directry (there are not much code, but it would
> > be easier to have link that you can run insead of send this to the
> > mailing list.
> >
> > https://github.com/jcubic/lips/blob/devel/bin/lips.js
> >
> > Just run:
> >
> >     git clone https://github.com/jcubic/lips.git
> >     cd lips
> >     git checkout devel
> >
> > and run in GUI Emacs:
> >
> >     (run-scheme "<PATH>/lips/bin/lips.js")
> >
> > and resize the Frame or buffer's window if you have multiple windows.
> >
> >
> > And I need to add that I was looking at Node.js source code, there is lot
> > of code but it also use Readline and Node.js works in run-js (I'm not
> > sure if it use something else for --interactive option that was suggested
> > when I've search how to run node in Emacs).
> >
> > I've tested my interpeter with same run-js and I have same issue with
> > duplicated prompt.
> >
> > --
> > Jakub Jankiewicz, Web Developer
> > https://jcubic.pl/me  
> 
> I'm not sure about run-js, but I turned off Readline in your
> interpreter, and it now works flawlessly inside comint.  Since Readline
> is pretty much useless anyways there, it might be worth it to turn it
> off inside Emacs. (ie check the EMACS and INSIDE_EMACS variables, or add
> something like CMU's `-emacs' flag.)
> 
> Bash does the same thing too;
> https://lists.gnu.org/archive/html/bug-bash/2015-03/msg00179.html
> 

I've used this:

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: prompt,
    terminal: !!process.stdin.isTTY && !(process.env.EMACS ||
                                         process.env.INSIDE_EMACS)
});

Thanks, it works perfetly, this will be required for any Readline Node.js
interpreter or REPL that runs in GNU Emacs.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]