I just put together a simple example repo on GitHub, containing a literate 
programming solution to the Potter Kata  
(http://codingdojo.org/cgi-bin/wiki.pl?KataPotter) using Emacs' org-babel 
mode. You can check it out here:

  https://github.com/lambdatronic/org-babel-example

Also be sure to take a look at the canonical online org-babel docs:

  http://orgmode.org/worg/org-contrib/babel/

In particular the intro section:

  http://orgmode.org/worg/org-contrib/babel/intro.html

And even though it's a little bit dated w.r.t. the current org-mode version 
in Emacs 24, this journal article on Org-Mode's literate programming and 
reproducible research features is really, really cool to work through (lots 
of nice code examples):

  http://www.jstatsoft.org/v46/i03

Happy hacking,
  ~Gary

On Saturday, September 8, 2012 4:24:38 AM UTC-4, Denis Labaye wrote:
>
>
>
> On Thu, Sep 6, 2012 at 6:42 PM, lambdatronic <gwjo...@uvm.edu<javascript:>
> > wrote:
>
>> For those people (like myself) who do a lot of Literate Programming in 
>> Emacs using Clojure and org-babel, migrating to nrepl and nrepl.el is 
>> somewhat non-trivial. This is because the existing Clojure support in 
>> org-babel (ob-clojure.el) relies on slime and swank-clojure when running 
>> org-babel-execute-src-block (which redirects to org-babel-execute:clojure 
>> in ob-clojure.el).
>>
>> So clearly this is actually an issue for both nrepl.el and ob-clojure.el, 
>> not simply one or the other. All the same, I've hacked together a simple 
>> workaround that fixes the problem and makes Literate Programming under 
>> nrepl possible once again. If there is some slick way this could be worked 
>> into nrepl.el's codebase that wouldn't break its existing behavior (as this 
>> does), I'd be excited to see it.
>>
>> Here we go:
>>
>> ;; Patch result table rendering bug in ob-clojure (NREPL version)
>> (defun nrepl-send-request-sync (request)
>>   "Send a request to the backend synchronously (discouraged).
>> The result is a plist with keys :value, :stderr and :stdout."
>>   (with-current-buffer "*nrepl-connection*"
>>     (setq nrepl-sync-response nil)
>>     (nrepl-send-request request (nrepl-sync-request-handler 
>> (current-buffer)))
>>     (while (not (plist-get nrepl-sync-response :done))
>>       (accept-process-output))
>>     nrepl-sync-response))
>>
>> (defun org-babel-execute:clojure (body params)
>>   "Execute a block of Clojure code with Babel."
>>   (let ((result-plist (nrepl-send-string-sync 
>> (org-babel-expand-body:clojure body params) nrepl-buffer-ns))
>>         (result-type  (cdr (assoc :result-type params))))
>>     (org-babel-script-escape
>>      (cond ((eq result-type 'value)  (plist-get result-plist :value))
>>            ((eq result-type 'output) (plist-get result-plist :value))
>>            (t                        (message "Unknown :results 
>> type!"))))))
>>
>> Have fun!
>>
>
> It seems to be very interesting, I am already using Emacs / org-mode / 
> clojure a lot, I was aware of org-babel, but never used it.
> Would you have a simple example project (on github, ...) on how to 
> bootstrap this ? 
>
> Thanks, 
>
> Denis
>
>  
>
>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to