emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Bug: ob-clojure.el depends on deprecated swank-clojure [7.7]


From: Eric Schulte
Subject: Re: [O] Bug: ob-clojure.el depends on deprecated swank-clojure [7.7]
Date: Fri, 13 Jan 2012 12:48:22 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Alright,

if you load ob-clojure.el and then evaluate the following to over-ride
the existing definition of `org-babel-execute:clojure' does clojure code
evaluation work?

(defun org-babel-execute:clojure (body params)
  "Execute a block of Clojure code with Babel."
  (require 'slime)
  (with-temp-buffer
    (insert (org-babel-expand-body:clojure body params))
    ((lambda (result)
       (let ((result-params (cdr (assoc :result-params params))))
         (if (or (member "scalar" result-params)
                 (member "verbatim" result-params))
             result
           (condition-case nil (org-babel-script-escape result)
             (error result)))))
     (slime-eval
      `(swank:eval-and-grab-output
        ,(buffer-substring-no-properties (point-min) (point-max)))
      (cdr (assoc :package params))))))

Thanks,

Andrew Cheng <address@hidden> writes:

> I passed the question along to Phil Hagelberg in that Clojure google
> group thread. His reply:
>
> "Yes, clojure-test-mode uses both slime-eval and slime-eval-async; he
> should pick one of these like so:
>
> (defun clojure-test-eval (string &optional handler)
>  (slime-eval-async `(swank:eval-and-grab-output ,string)
>                    (or handler #'identity)))
>
> (defun clojure-test-eval-sync (string)
>  (slime-eval `(swank:eval-and-grab-output ,string)))
>
> Actually swank:interactive-eval-region and friends are not elisp
> functions; they are Clojure functions."
>
> (... end of reply) In case it helps, Stuart Sierra says he got
> org-babel and clojure working together. His dotfiles are at
> https://github.com/stuartsierra/dotfiles
>
> On Fri, Jan 13, 2012 at 1:09 AM, Eric Schulte <address@hidden> wrote:
>> I personally no longer use Clojure (having graduated to Common Lisp :))
>> so I'm not abreast of the current Clojure environment.
>>
>> The only function ob-clojure uses from swank-clojure is
>> `swank:interactive-eval-region' (used with `slime-eval') in the
>> `org-babel-execute:clojure' function.  Which function would now be used
>> to evaluate a region of clojure code?  Would `slime-eval-region'
>> suffice?
>>
>> Andrew Cheng <address@hidden> writes:
>>
>>> ------------------------------------------------------------------------
>>>
>>> Phil Hagelberg has said that the swank-clojure elisp package has been
>>> deprecated and should not be used [1]. My version of ob-clojure.el
>>> requires swank-clojure. If I don't have the swank-clojure package, I
>>> get "org-babel-execute:clojure:Cannot open load file: swank-clojure".
>>> If I follow the instructions at [2] and get the swank-clojure package,
>>> I get past this error. Is org using a deprecated package, and is this
>>> a bug? Thanks in advance.
>>>
>>> [1] https://groups.google.com/forum/#!starred/clojure/HT8wixvD3GE
>>> [2] http://lists.gnu.org/archive/html/emacs-orgmode/2011-12/msg00629.html

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]