Chicken Scheme interpreter arrow key not working - chicken-scheme

I have installed Chicken Scheme on WSL debain Linux.
I can run chicken Scheme interpreter from command line.
but arrow key just not work.
up arrow ^[[A
down arrow ^[[B
here is a screen shot

This is a FAQ. Basically, CHICKEN tries to be relatively minimalistic out of the box, so there's no line editing feature bundled with the core distribution.
You probably want to install the breadline egg and set up your .csirc to load it (see the example).
Alternatively, use rlwrap, which can add line editing capability to any program which lacks it.

Related

Scheme get last command in guile

Normally in a terminal (or any other command prompt I've previously used) I'll press the up key to get the last entered command. However, when doing that in the guile interpreter, I just get:
scheme#(guile-user) [1]> ^[[A
What is the easiest way to get the last entered-in command in guile?
Command-line REPLs are often feature-poor. For Guile, a better experience can be had by, for example, running under Geiser in emacs. This allows a running REPL in an emacs buffer, with much better control. As a long-term solution, I would suggest learning how to do something like this.
There is a bit of a learning curve to get productive in emacs (not as much as people often seem to fear, though). Fortunately, Guile provides a solution for those who wish to stick with the regular Guile REPL.
While it is not enabled by default, Guile can make use of the GNU Readline library. This allows navigation of the REPL expression history via the up- and down-arrow keys. To enable this feature from the REPL, enter:
scheme#(guile-user)> (use-modules (ice-9 readline))
scheme#(guile-user)> (activate-readline)
When Guile is started in interactive mode, it first loads the .guile init file from the users home directory. You can take advantage of this by adding the above two lines to the .guile file (create a new .guile file for this purpose if one does not already exist):
;;; Guile Scheme Init File
;; Activate Readline
;; allows navigation of expression history in REPL
(use-modules (ice-9 readline))
(activate-readline)
After updating the .guile file, whenever Guile is run in interactive mode, you will automatically have the Readline functionality.

Octave output buffer completely messed up on OS X. How to fix?

I have just installed Octave 3.6 version on my MacBook. It uses emacs as its default editor, but it seems some regular emacs keys (such as C-x C-c for exiting) doesn't work in Octave emacs. Also, the output buffer gets completely messed when I try to use octave. Also, it always prints the prompt even when I'm in emacs. (See picture below)
It seems it's parsing my input in the editor on the fly. But I have no idea how this could every happen.
Can anyone tell me what the problem is and how to fix it?
My guess is that you end up running the Emacs that comes bundled with Mac OS X (an old version of Emacs that only works in text mode) and you want to change that by installing a more recent version that can run in the GUI. But that's just a wild guess.

First GUI version of Emacs

The first versions of Emacs ran on text-only consoles. Currently, Emacs can be run in text-only mode with the -nw parameter. When was the first GUI version of Emacs released? Was it GNU Emacs?
For GNU Emacs, the earliest mention I can see in the NEWS files is in version 18, which appears to have included some form of X support from the outset.
That pre-dates Lucid and also Epoch (from which Lucid was derived).
Indeed, Epoch is described as:
a set of patches to Emacs 18 that gave it much better GUI support (Emacs 18 was very much a tty program, with GUI support crudely grafted on as an afterthought.)
so clearly there was some GUI functionality present already at the time that work began.
Unless there was some lesser-known fork that went down this path prior to 1986, it would certainly seem that GNU Emacs was the first to include GUI support.
This is based on Jamie Zawinski's very informative timeline and history:
http://www.jwz.org/doc/emacs-timeline.html
http://www.jwz.org/doc/lemacs.html

How can I simply "run" lisp files

Python
When I learned Python I installed it on windows with a nice gui installer and all .py files would automatically run in python, from the command line or explorer.
I found this very intuitive and easy, because I could instantly make plain text files and run them.
Lisp
I'm starting to learn lisp and have decided (from reviews) that SBCL is not a bad lisp implementation.
Is there a way to setup SBCL to run .lisp files as easily as with Python?
Are there other lisp implementations that have this?
Executables
SBCL can save executable images, as Greg Harman mentions (see the :EXECUTABLE keyword): http://www.sbcl.org/manual/index.html#Saving-a-Core-Image
Scripts
Lisp files can be executed as scripts, see: http://www.sbcl.org/manual/#Shebang-Scripts
Command Line Options
SBCL has command line options to evaluate/load lisp code on start: http://www.sbcl.org/manual/#Command-Line-Options
SLIME
SLIME is an Emacs interface for Common Lisp. One can use SBCL via SLIME from within Emacs. Many people prefer Emacs Lisp listeners over typical shell interfaces.
Most Common Lisp implementations have similar capabilities. For details consult their manual or ask here for specific implementations.
A few minutes ago someone replied with an answer nearing what I was looking for.
The reply linked to http://www.sbcl.org/manual/Shebang-Scripts.html which was a great help in figuring out my solution. Whoever it was shouldn't have removed their answer as I was about to mark it as correct ;)
My final solution was to create a batch script that is linked through normal program file association as the program to open .lisp files (Right click file->Properties->Opens With->[Change]).
#ECHO OFF
"C:\Program Files\Steel Bank Common Lisp\1.0.37\sbcl.exe" --script %1
When you double click files in explorer it executes them and when you run them in the command line it does the same.
SBCL can save an executable core image via sb-ext:save-lisp-and-die
If you have already downloaded and installed the SBCL interpreter, then in order to run your programs by simply entering them into the command line you need to add the location of the interpreter to your system PATH variable, so that your machine knows where to look.
This is true for any language. What the Python installer did was add the location of the Python interpreter to your PATH environment variable.
Depending on your platform, do a quick Google search on how to set environment variables.

How can I most effectively use Emacs as an editor alongside XCode?

There are a few tutorials online (For example) having to do with configuring emacs to work with XCode, but they all seem to be for old versions, and I haven't found one that ties neatly to XCode 3.x + Emacs 23.1 in a way that I can unpack.
So, I'm running XCode 3.1.2 and the Mac Cocoa application build of Emacs 23.1. I have a passing familiarity with elisp, so modifying configurations doesn't scare me, particularly. I'd like to be editing my Objective-C code in Emacs, because the XCode editor is painful once you've used a real text editor (snark, snark).
What should I do to make this happen?
For Emacs.app you can adopt a cleaner approach, and it doesn't require you to change configurations (unless you don't like make-frame to be called when a file is opened from XCode, but it's very easy to change).
Well, the customization should be similar to the documentation you pointed to. With Emacs 23, the server/client code has changed just a little. Namely, you can start it with the [--daemon][1] option to have Emacs start a server in the background. Then, have XCode just call Emacs using [emacsclient][2]. There are options you can use with emacsclient to force a new frame (graphical window): -c, and you can even start it off with -a to ensure you get an emacs if you forgot to start it with --daemon.

Resources