8

Imagine the dunnet.el game, the eliza doctor or the IELM mode...; This is, evaluating answers and prompting new questions on the main buffer, then making some actions according to their elisp rules.

I would to create something like an interactive assistant, BUT NOT prompting from minibuffer as (interactive) does (not doing M-x)... I need a kind of REPL loop. So the question i how to get interaction on the working buffer (the main screen), like any text conversational/adventure, but for call my defun'ed functions on this way.

So i need a basic elisp skeleton, to make a custom REPL. The target is to make an assistant with a natural language, then parsing the anwsers, and making some actions according the rules.

Thank you for your time,

Steve,

1
  • Would it be sufficient to set up a buffer in some major mode with an appropriate re-binding of the return key? Commented Dec 26, 2015 at 6:43

3 Answers 3

5

Check out ielm, which is an elisp repl included with emacs.

Sign up to request clarification or add additional context in comments.

Comments

2

Depending on what can go on in your buffer, can you just give it a major mode with an appropriate re-binding of return? (This answer vaguely inspired by Lisp-Interaction-Mode's C-j)

2 Comments

Well, that should be a major mode, an interative REPL, a return re-binding... My target is to build a textual assistant that could interpret natural language and convert it to elisp function calls. Let me put an example: Imagine a publisher that wants to integrate plain text to some kind of Tex source (LaTex, Texinfo...). First, the dialog could ask for a title, an author, a book size, an outline, the mainmatter text files... Or imagine a REPL with natural language that parses queries to a sqlite select's... Something like a textual frontend.
You'd probably want to set up your own "raw" keymap so the user cannot move around freely in the buffer. Check the source code of term-mode, it does something like that in its default "char-mode".
0

You should bind all keys that use for moving in buffer like C-p C-n, Up Down Arrows/ page up/down just bind them to (lambda ()). change function for C-b and C-f (Left Right Arrows) if cursor position is in beginning or end of the line. And bind Return key to function that read current line from end to optional prompt (you can use Regex to remove the prompt) do whatever you want with that string, and then go to the next line in the buffer and print your result.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.