[slime-devel] Inserting eval results in the current buffer

Nikodemus Siivola nikodemus at random-state.net
Fri Apr 27 08:48:36 UTC 2007

I submit that the current behaviour of <prefix> C-x C-e is not very useful. It 
is probably almost ideal for <prefix> C-c : -- eg. for creating constants
with one-liners.

This is what I use in lieu of it, and what might be good for Slime proper

(defun ns:scan-forward (stop-after stop-before)
   (do ()
       ((or (eql (char-after) stop-before)
            (eql (char-before) stop-after)))

(defun ns:comment-at-eol ()
   (let ((newline (string-to-char "\n"))
         (comment (string-to-char ";")))
     (ns:scan-forward comment newline)
     (unless (eql newline (char-after))
     (unless (eql comment (char-before))
       (insert "   ;")))
   (insert " "))

(defun ns:eval-in-lisp-insert-comment ()
   (lexical-let ((current-buffer (current-buffer)))
      `(swank:interactive-eval ,(slime-last-expression))
      `(lambda (value)
         (with-current-buffer ,current-buffer
           (insert (format "%s" value)))))))


  -- Nikodemus

More information about the slime-devel mailing list