LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-19-2010, 02:16 AM   #1
Spyes
LQ Newbie
 
Registered: Jan 2010
Distribution: Gentoo
Posts: 18

Rep: Reputation: 0
cl-ncurses and emacs...


Hi everyone,

I am trying to develop some ncurses code with Lisp, but I'm having some trouble... I currently run emacs with slime and sbcl, and it's working great for "conventional" lisp. However, I cannot get cl-ncurses to work properly.
I am able to do:
Code:
(asdf:operate 'asdf:load-op 'cl-ncurses) 
(in-package :cl-ncurses)
(defun start ()
(initscr)
and after that is somemore ncurses-specific code (mvaddstr etc.)
Now, I get absolutely no errors, and everything seems fine, but when I run the start function, all I get is... well, nothing! Screen doesn't clear, none of the text from mvaddstr is displayed etc. it just sorta hangs in an infinite loop.
I understand that Emacs is not very good with curses, but I couldn't find anything online that would help me fix that... maybe I was looking in the right place? I don't know.. but it'd be great to get this working!

Thanks in advanced,
Lewis
 
Old 02-19-2010, 12:19 PM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Does the code work from the terminal?

Some output may have ended up in the *inferior-lisp* buffer instead of the REPL buffer.
 
Old 02-19-2010, 01:38 PM   #3
Spyes
LQ Newbie
 
Registered: Jan 2010
Distribution: Gentoo
Posts: 18

Original Poster
Rep: Reputation: 0
Well, when I run some cl-ncurses code in sbcl (without slime+emacs, so yeah, in term) it works fine.
I tried running the same code and looking at the *inferior-lisp* buffer, however.. the printed message did not appear, but it did wait for a key press (cl-ncurses:getch), and when I pressed a key in *inferior-lisp*, it exited the ncurses program... so it kinda works, but kinda doesn't hehe

Edit: I just noticed that whenever I run the function in slime, and then go to *inferior-lisp*, it has a whole bunch of white-space... still no message, but it's interesting I suppose..

Any ideas?

Last edited by Spyes; 02-19-2010 at 01:42 PM.
 
Old 02-19-2010, 02:07 PM   #4
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
I found Can I use Curses on Lisp?

The equivalent for ext:saveinitmem on sbcl would be sb-ext:save-lisp-and-die.
 
Old 02-20-2010, 03:01 AM   #5
Spyes
LQ Newbie
 
Registered: Jan 2010
Distribution: Gentoo
Posts: 18

Original Poster
Rep: Reputation: 0
Yeah, I remember doing that with clisp I think and it didn't work... so now I gave the sbcl version a try, and the command I did in SBCL was:
Code:
(load "/usr/share/common-lisp/source/asdf/asdf.lisp")
(load "/usr/share/common-lisp/source/swank/swank.asd")
(asdf:oos 'asdf:load-op :swank)
(sb-ext:save-lisp-and-die "sbclswank" :executable t :toplevel #'swank:create-server)
which gave me no errors, and it create the "sbclswank" executable just fine. But when I run ./sbclswank it says ";; Swank started at port: 4005" but then it just exits, and when I try to do slime-connect via emacs, it gives me an error...
 
Old 02-26-2010, 02:15 PM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Sorry for the delay, I had to reconnect an older box to try this out.

Quote:
which gave me no errors, and it create the "sbclswank" executable just fine. But when I run ./sbclswank it says ";; Swank started at port: 4005" but then it just exits,
Yes, is seems the :toplevel options wants a function that is equivalent to the REPL, but swank:create-server returns after creating the server. Leaving out the the :toplevel argument and running ./sbclwank --eval '(swank:create-server)' works fine.
 
1 members found this post helpful.
Old 02-27-2010, 04:16 AM   #7
Spyes
LQ Newbie
 
Registered: Jan 2010
Distribution: Gentoo
Posts: 18

Original Poster
Rep: Reputation: 0
Awesome! That worked perfectly!
Thanks, ntubski
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Emacs editing, Pt.5: Shape your Emacs view LXer Syndicated Linux News 0 08-09-2007 07:46 AM
Alt no longer META key when using in-terminal option of Emacs (emacs -nw) frznchckn Linux - Software 1 06-02-2007 02:41 AM
how to print text in color by ncurses without opening a ncurses window Greatrebel Programming 0 12-20-2006 09:15 AM
edb (emacs database) won't open file - emacs 20 & 21 tip184 Linux - Software 0 04-03-2004 07:31 AM
ncurses-5.2-28 conflicts with file from package ncurses-5.2-12 tubby Linux - Software 4 06-16-2002 12:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration