Hi,
Can anybody help me out here, I am stuck as I don't know what SLIME does with the I/O once it is running.
I am writing a data-entry application, console based, and it must be able to perform read-char without having to press return. To effect this I have had to resort to the following development methodology :-
(a) open a new xterm or Terminal.app (OS X 10.4.8) window (b) $ stty cbreak (c) $ sbcl (d) load my code (e) start my application
It works just fine, my functions getting a date etc all respond to the correct number of keystrokes but the problem is that it doesn't seem to work from SLIME mode ie the "stty cbreak" doesn't seem to be in force if I execute it from within Emacs.
So, does anybody know what I have to do to make it such that a single key press is all I need to get read-char to come back with the keypress inside SLIME+EMACS... it's a bit of a pain having to test it from the shell every time I do something major to the application. is there an even Lispier way of doing this, am I missing something, unaware of something... I have only been using Lisp for about four months now and the size of that HyperSpec still makes my brain hurt ;-)
Many thanks,
Sean Charles
* Sean Charles [2006-12-08 17:44+0100] writes:
So, does anybody know what I have to do to make it such that a single key press is all I need to get read-char to come back with the keypress inside SLIME+EMACS... it's a bit of a pain having to test it from the shell every time I do something major to the application. is there an even Lispier way of doing this, am I missing something, unaware of something... I have only been using Lisp for about four months now and the size of that HyperSpec still makes my brain hurt ;-)
A quit hack would be something like this:
(defun slime-raw-insert () (interactive) (let ((char last-command-char)) (goto-char slime-repl-input-end-mark) (insert char) (slime-repl-send-input nil)))
(dolist (key (where-is-internal 'self-insert-command slime-repl-read-mode-map)) (define-key slime-repl-read-mode-map key 'slime-raw-insert))
but then you can't no longer edit the input. Properly emulating a terminal with raw mode would be quite a bit more work.
I think, that on SBCL/MacOS it should work if you start SBCL in the terminal, load and start the Swank server from there, and connect to it from Emacs with `M-x slime-connect'. SB-SYS:*TTY* should then hold the stream to the terminal in raw mode. This way you still need to switch windows, but at least you get proper terminal emulation.
Helmut.
Helmut Eller wrote:
A quit hack would be something like this:
:-) LOL! a 'quit' hack!!!! I have had a few of those in 21 years swearing at computers. HA HA HA
[snip]
As for the rest of your reply Helmut, truly will I have achieved Lisp enlightenment if I could but understand a single word of your no doubt accurate reply! Your previous advice about OpenGL and SLIME was (and still is) very useful but I fear this one might take me a bit longer to digest.
Thanks, Now where are those aspirins.....
I think, that on SBCL/MacOS it should work if you start SBCL in the terminal, load and start the Swank server from there, and connect to it from Emacs with `M-x slime-connect'. SB-SYS:*TTY* should then hold the stream to the terminal in raw mode. This way you still need to switch windows, but at least you get proper terminal emulation.
Helmut.
Helmut, great advice again! I am still a relative newbie with Lisp and SLIME, and it never ocurred to me that I could manually start the swank backend from a terminal, having become lazy thanks to the wonderful state-of-the-art GU called Emacs. LOL ;-)
So, my procedure is now:
1. open an xterm, issue 'stty cbreak' 2. $ sbcl 3. * (load "swank-loader.lisp") 4. * (swank:create-server) 5. Start Emacs+SLIME 6. M-x slime-connect, accepting the defaults.
and away I go... now I have all the benfits of SLIME+Emacs and I can test the actual application in the console window by calling the entry point there. It's a great way to be working, I knew there was room for improvement.
Thanks again guys, Great list! :-) Sean Charles
Sean Charles sean.charles@objitsu.com writes:
I think, that on SBCL/MacOS it should work if you start SBCL in the terminal, load and start the Swank server from there, and connect to it from Emacs with `M-x slime-connect'. SB-SYS:*TTY* should then hold the stream to the terminal in raw mode. This way you still need to switch windows, but at least you get proper terminal emulation.
So, my procedure is now:
Since you're now using SB-SYS:*TTY*, please be aware that it is not a supported interface, but a private one, and may go away or change in the future.
(Though now that we have a use-case out in the open, it is more likely to be replaced with something explicitly supported then go away, of course.)
Cheers,
-- Nikodemus Schemer: "Buddha is small, clean, and serious." Lispnik: "Buddha is big, has hairy armpits, and laughs."