This is not a slime question, but it is about emacs & common lisp.
I use slime + clisp and sbcl for my work. I use REPL as an environement for interactive data analysis. I need to produce an annotated log of the analysis.
I am looking for a workbook type of file mode, in which I would enter into a file: - text (with markup rules such as in muse-mode or org-mode) - valid CL code
At the end of the day I could `publish' the file (as an html, pdf, latex) document which would contain - the text - The CL code (formatted appropriately) - Results of executing the CL code.
Some of my commands produce graphics via gnuplot, and there should be conventions+intelligence to dump these into a png format and insert into the published file.
Right now, I am doing it very crudely by - creating a .lisp file - Writing text in #| |# blocks in emacs' muse mode. - CL stuff in rest of the buffer - Executing C-u C-c C-x to paste CL results into the buffer - modifying things a bit by hand - and leaving it at that.
Are there any packages that can help me accomplish this?
Thanks,
Mirko
Mirko Vukovic mirko.vukovic@gmail.com writes:
This is not a slime question, but it is about emacs & common lisp.
I use slime + clisp and sbcl for my work. I use REPL as an environement for interactive data analysis. I need to produce an annotated log of the analysis.
I am looking for a workbook type of file mode, in which I would enter into a file: - text (with markup rules such as in muse-mode or org-mode) - valid CL code
At the end of the day I could `publish' the file (as an html, pdf, latex) document which would contain - the text - The CL code (formatted appropriately) - Results of executing the CL code.
Some of my commands produce graphics via gnuplot, and there should be conventions+intelligence to dump these into a png format and insert into the published file.
Right now, I am doing it very crudely by - creating a .lisp file - Writing text in #| |# blocks in emacs' muse mode. - CL stuff in rest of the buffer - Executing C-u C-c C-x to paste CL results into the buffer - modifying things a bit by hand - and leaving it at that.
Are there any packages that can help me accomplish this?
Have a look at CL:DRIBBLE.
In addition you could have a function that would print the "URL" of the picture you generate, so that it's recorded in the dribble. Then you could process automatically the dribble to publish it.
* 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
On Sat, Feb 19, 2011 at 10:39 AM, Helmut Eller heller@common-lisp.netwrote:
- 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.
1) Generate the files with dribble. I can easily input text into repl.
2) 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
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