all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jakub Jankiewicz <jcubic@onet.pl>
To: Po Lu <luangruo@yahoo.com>
Cc: emacs-devel@gnu.org
Subject: Re: Scheme Interpreter in Emacs and Readline
Date: Sun, 19 Apr 2020 09:14:00 +0200	[thread overview]
Message-ID: <20200419091400.1d260c3a@jcubic> (raw)
In-Reply-To: <873690737p.fsf@yahoo.com>



On Sun, 19 Apr 2020 08:02:02 +0800
Po Lu <luangruo@yahoo.com> wrote:

> Jakub Jankiewicz <jcubic@onet.pl> 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	other threads:[~2020-04-19  7:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-18 10:51 Scheme Interpreter in Emacs and Readline Jakub Jankiewicz
     [not found] ` <87imhx6ocz.fsf@yahoo.com>
2020-04-18 12:29   ` Jakub Jankiewicz
2020-04-19  0:02     ` Po Lu
2020-04-19  7:14       ` Jakub Jankiewicz [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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200419091400.1d260c3a@jcubic \
    --to=jcubic@onet.pl \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.