On Sun, Feb 20, 2011 at 9:09 AM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
On Sat, Feb 19, 2011 at 10:39 AM, Helmut Eller heller@common-lisp.net wrote:
- Mirko Vukovic [2011-02-19 14:30] writes:
Are there any packages that can help me accomplish this?
I've used org-babel[1] a bit but only with gnuplot. A lisp program generates the data file, org-mode calls gnuplot to generates the graphs and combines them into single html document. I think there is also some Slime integration for org-babel available but I have no experience with that.
Helmut
I would like to use both.
Generate the files with dribble. I can easily input text into repl.
Then switch to org-mode to edit the text and prepare for printing.
However, I got a problem with dribble & slime on my windows xp: - running clisp on cygwin, dribble works fine - running clisp from slime on emacs-nt, dribble does not work.
This is not the first time I am having issues running cygwin's clisp via slime on emacs-nt. I hope in the near future to get a laptop where I can run both windows and linux, and do lisp work on the linux side.
Enough dribbling :-)
Mirko
Regarding dribble:
The issue was not clisp & cywgin, but slime, as (I am guessing here), it is sending the input and output via streams that are not captured by dribble.
However, that is not a big problem. After some thought, I realized that dribbling in slime is staring back at me:
*slime-repl ...* buffer is a dribble :-)
Regarding org-babel:
I started using org's babel feature. It works very nicely with slime. Actually, that is an understatement. I love it!
For example, to set-up my analysis session, my org file has the following snippet: #+begin_src lisp :session (in-package :cl-user) (load-asdf-system :thermo) (load-asdf-system :thermo-user) (in-package :thermo-user) #+end_src
One can edit the code in lisp mode by typing C-c ', and execute it by typing C-c C-c. Org-babel captures the lisp output into the file.
org-babel uses ob-lisp.el to set-up communication with slime.
I had to modify the following function in ob-lisp.el slightly to make it more friendly. See comments in the function below
(defun org-babel-execute:lisp (body params) "Execute a block of Lisp code with org-babel. This function is called by `org-babel-execute-src-block'" (require 'slime) (message "executing Lisp source code block") (let* ((session (org-babel-lisp-initiate-session (cdr (assoc :session params)))) (result-type (cdr (assoc :result-type params))) ;; enclose body into progn -- mv (full-body (format "(progn\n%s)\n" (org-babel-expand-body:lisp body params)))) (progn ;;read -- commented out by mv so as not to error on unreadable return values (if session ;; session evaluation (save-window-excursion (cadr (slime-eval `(swank:eval-and-grab-output ,full-body)))) ;; external evaluation (let ((script-file (org-babel-temp-file "lisp-script-"))) (with-temp-file script-file (insert ;; return the value or the output (if (string= result-type "value") (format "(print %s)" full-body) full-body))) (org-babel-eval (format "%s %s" org-babel-lisp-cmd (org-babel-process-file-name script-file)) ""))))))
Mirko