(progn (print "Hello World!") (values 1 2)) C-u C-x C-e
inserts:
"Hello World!" 1 2
With one more C-u:
(progn (print "Hello World!") (values 1 2)) C-u C-u C-x C-e
I'd want to get:
"Hello World!" ;; --> 1 ;; 2
Hence this new version:
(defun slime-eval-print (string) "Eval STRING in Lisp; insert any output and the result at point." (message "current-prefix-arg = %S" current-prefix-arg) (let ((commentp (and (listp current-prefix-arg) (integerp (first current-prefix-arg)) (< 4 (first current-prefix-arg))))) (slime-eval-async `(swank:eval-and-grab-output ,string) `(lambda (result) (destructuring-bind (output value) result (push-mark) (if ,commentp (progn (insert output) (let ((lines (split-string value "\n"))) (insert "\n;; --> " (first lines) "\n") (dolist (line (rest lines)) (insert ";; " line "\n")))) (insert output value)))))))
(The ,commentp is icky, but it's emacs lisp).