views:

376

answers:

4

Situation: I entered several functions while working with REPL in Emacs. Problem: There is junk like "; Evaluation aborted" when I'm simply saving buffer. What I want: clear descriptions of all the functions I entered in their latest revision.

Can I do that? Thanks.

+5  A: 

I don't get it. Are you entering definitions at the REPL and expecting to recover them later? Just save a source file as you would in any other language. Use C-x 2 to split your Emacs window in two. Open a source file in one of them C-x C-f foo.lisp. Use C-c C-k, C-c C-r and friends (see SLIME menu) to compile / evaluate regions of your source code in the REPL.

fizzer
+4  A: 

I've looked for something like this in the past and have been unable to find it. You're best off writing all your definitions in a separate buffer and using SLIME's extensive evaluation/compilation functions (C-c C-k loads an entire file, C-x C-e evaluates the last expression, C-c C-r evaluates a region, etc.), only directly entering into the REPL things you don't want to save.

sprintf
+2  A: 

Um, C-x o or C-x b to get to the SLIME REPL buffer, then C-x w or C-x C-s to save it to a file. All the SLIME/CL stuff is a reader comment; you can either write a reader hack to reload the file treating the prompts as comments, or you can go through the file yourself to capture the pieces you want to save.

Charlie Martin
+3  A: 

I agree that the best work flow method is to write your code in a separate buffer and evaluate in that, rather than enter the functions in the repl.

Assuming you have gone the repl way, I guess, C. Martin's solution to save the repl log and manually go through it are your only options.

If you entered the functions and vars into a separate package, you could go through the symbols in the package to help you decide what you want to keep.

E.g. to see all symbols created in the cl-user package:

(let ((p (find-package :cl-user)))
  (loop
     for s being the symbols in p
     when (eq p (symbol-package s))
     do (format t "~a~%" s)))
HD