slime repl problem

Discussion of Common Lisp
Post Reply
akoumjian
Posts: 2
Joined: Tue Mar 23, 2010 11:53 am

slime repl problem

Post by akoumjian » Tue Mar 23, 2010 11:59 am

Forgive my ignorance.

I am using slime along with clisp.

When I try out the following loop, I get NIL results in the *slime-repl clisp* buffer:

Code: Select all

CL-USER> (loop for i in '(1 2 3) do (print i))
NIL           


However, if I look over at the *inferior lisp* events buffer I see the expected:

Code: Select all

1
2
3
Is this normal? If I should expect the output to print to my slime repl, any ideas how to fix this?

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: slime repl problem

Post by ramarren » Tue Mar 23, 2010 12:21 pm

Create a file ~/.swank.lisp and put in there:

Code: Select all

(SETF SWANK:*GLOBALLY-REDIRECT-IO* T)

akoumjian
Posts: 2
Joined: Tue Mar 23, 2010 11:53 am

Re: slime repl problem

Post by akoumjian » Tue Mar 23, 2010 1:02 pm

That worked wonderfully.

Would it make sense to include this somehow in my .emacs.d directory for the purposes of tidiness?

Would there be good reason for that not to be the default value?

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: slime repl problem

Post by ramarren » Tue Mar 23, 2010 1:11 pm

akoumjian wrote:Would it make sense to include this somehow in my .emacs.d directory for the purposes of tidiness?
THe file .swank.lisp is not an Emacs file, but a Swank file, which is a Common Lisp server component of Slime. I suppose you could patch swank-loader.lisp source file to load it from some other patch.
akoumjian wrote: Would there be good reason for that not to be the default value?
I believe there are some design issues which means that this doesn't work in certain situations and configurations, and Slime defaults are usually very conservative (for example, for some time there is no REPL by default).

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: slime repl problem

Post by nuntius » Tue Mar 23, 2010 9:35 pm

Slime's refactoring often results in commonly-used settings not loading by default... Here is an excerpt from my ~/.emacs config file; it works with slime from 2010-01-30. In particular, note the call to slime-setup.

Code: Select all

;; swap [] with ()
(keyboard-translate ?\( ?\[)
(keyboard-translate ?\[ ?\()
(keyboard-translate ?\) ?\])
(keyboard-translate ?\] ?\))

(setq slime-lisp-implementations ;; pick one with "M-- M-x slime ecl"
      '((sbcl ("/usr/local/bin/sbcl"))
        (ecl  ("/usr/local/bin/ecl"))
        (clisp ("/usr/bin/clisp"))

(setq common-lisp-hyperspec-root "file:///home/nuntius/lisp/HyperSpec/")

(add-to-list 'load-path "/home/nuntius/lisp/slime")
(require 'slime-autoloads)
(require 'slime)
(slime-setup '(slime-fancy slime-scratch slime-editing-commands))

(add-hook 'lisp-mode-hook
          (lambda ()
            (slime-mode t)
            (local-set-key "\r" 'newline-and-indent)
            (setq lisp-indent-function 'common-lisp-indent-function)
            (setq indent-tabs-mode nil)))
(define-key slime-mode-map
  (kbd "TAB") 'slime-indent-and-complete-symbol)
P.S. I do not have a ~/.swank.lisp file, and it works just fine.

Jasper
Posts: 209
Joined: Fri Oct 10, 2008 8:22 am
Location: Eindhoven, The Netherlands
Contact:

Re: slime repl problem

Post by Jasper » Thu Mar 25, 2010 6:09 am

Thanks, those keyword-translates are really useful!

Tbh haven't really looked into emacs lisp stuff a lot, despite being annoyed by the bookmarks a lot. Trying this i guess..

Post Reply