[CM] slime printing

Tito Latini tito.01beta at gmail.com
Thu Apr 24 07:17:31 PDT 2014


On Wed, Apr 23, 2014 at 07:45:56PM +0000, James Hearon wrote:
> I was hoping to get some advice on printing from emacs-slime.  I'm trying to print output to a visible area of the emacs editor when the code is compiled and runs, such as in with-sound below.
> I'm using f20, sbcl, emacs-slime, and clm but having a devil of a time getting any contrib to load and run with my .emacs file which might support more repl such as to the echo area etc.  I'm wondering what approach you folks might use to print to std out?  Are you using a contrib package or other editor and print .el utility files?
> I've tried things like (print ), and (format t ...) and (message ...), and those evaluate the expression to the echo area but they don't work when I compile and run and it is beeping.  Or am I totally off base, and lisp doesn't do that very well at all?

hopefully I am not misunderstanding your intention, you could use the
*inferior-lisp* buffer associated with the lisp process:

  (format swank:*log-output* "After all the jacks are in their boxes~%")

  ;; idem but sbcl specific
  (format sb-sys:*stderr* "and the clowns have all gone to bed~%")

  (format sb-sys:*stdout* "~Ahe traffic lights, they turn blue tomorrow~%"
          (eq swank:*log-output* sb-sys:*stderr*))

  (let ((*standard-output* swank:*log-output*))
    (with-sound ...))


Perhaps it is enough, otherwise it is also possible to change the
process-filter (from emacs), for example

  ;; current process-filter
  (process-filter (get-buffer-process "*inferior-lisp*"))
  ; => comint-output-filter

  ;; And the wind screams Mary
  (set-process-filter (get-buffer-process "*inferior-lisp*")
                      (lambda (process string)
                        ... something with the string ...
                        (comint-output-filter process string)))

  ;; Uh will the wind ever remember the names it has blow in the past? 
  (set-process-filter (get-buffer-process "*inferior-lisp*")

Tito Latini

More information about the Cmdist mailing list