Page 1 of 1

slime repl problem

PostPosted: Tue Mar 23, 2010 11:59 am
by akoumjian
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?

Re: slime repl problem

PostPosted: Tue Mar 23, 2010 12:21 pm
by Ramarren
Create a file ~/.swank.lisp and put in there:

Code: Select all
(SETF SWANK:*GLOBALLY-REDIRECT-IO* T)

Re: slime repl problem

PostPosted: Tue Mar 23, 2010 1:02 pm
by akoumjian
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?

Re: slime repl problem

PostPosted: Tue Mar 23, 2010 1:11 pm
by Ramarren
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).

Re: slime repl problem

PostPosted: Tue Mar 23, 2010 9:35 pm
by nuntius
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.

Re: slime repl problem

PostPosted: Thu Mar 25, 2010 6:09 am
by Jasper
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..