This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

slime repl problem

6 posts · 4168 views

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:
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:
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

Create a file ~/.swank.lisp and put in there:
(SETF SWANK:*GLOBALLY-REDIRECT-IO* T)

Re: slime repl problem

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

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

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.
;; 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

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..