From: stardiviner <numbchild@gmail.com>
To: org-mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] ob-clojure.el support :ns header argument
Date: Mon, 26 Mar 2018 12:38:54 +0800 [thread overview]
Message-ID: <2e8bf589-83e4-4b95-0df5-874c92c18d28@gmail.com> (raw)
In-Reply-To: <7ab04864-666d-b84b-b9ea-6a26868f5cdd@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 712 bytes --]
Previous `ob-clojure.el` patch implement method is not good enough. Here
is a better implementation.
Sorry for this over posting.
On 03/26/2018 09:59 AM, stardiviner wrote:
>
> - support :ns header (as discussed at here
> https://github.com/clojure-emacs/clojure-mode/pull/465#discussion_r158009538)
>
> - supoort inject CIDER outside of project
>
> - support :varinitialization when :session initialization prepare.
>
>
> On 03/22/2018 01:49 AM, stardiviner wrote:
>>
>> Two patches
>>
>> One is to support ob-clojure.el future coming header argument :ns.
>>
>> The second is to support jack-in CIDER outside of Clojure project by
>> default. Not no need to ob-clojure project to be created anymore.
>>
>
[-- Attachment #1.2: Type: text/html, Size: 2576 bytes --]
[-- Attachment #2: 0001-ob-clojure.el-org-babel-execute-clojure-support-ns-h.patch --]
[-- Type: text/x-patch, Size: 1435 bytes --]
From 8315773aaee24d49996aa26c543cc56f9adc8414 Mon Sep 17 00:00:00 2001
From: Bastien <bzg@gnu.org>
Date: Mon, 26 Mar 2018 11:35:21 +0800
Subject: [PATCH] * ob-clojure.el (org-babel-execute:clojure) support :ns
header argument.
---
lisp/ob-clojure.el | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index 890f60ada..5989a254b 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -83,16 +83,21 @@ If the value is nil, timeout is disabled."
(defun org-babel-expand-body:clojure (body params)
"Expand BODY according to PARAMS, return the expanded body."
(let* ((vars (org-babel--get-vars params))
+ (ns (cdr (assq :ns params)))
(result-params (cdr (assq :result-params params)))
(print-level nil) (print-length nil)
(body (org-trim
(if (null vars) (org-trim body)
- (concat "(let ["
- (mapconcat
- (lambda (var)
- (format "%S (quote %S)" (car var) (cdr var)))
- vars "\n ")
- "]\n" body ")")))))
+ (concat
+ ;; src block specified namespace :ns
+ "(ns " ns ")"
+ ;; variables binding
+ "(let ["
+ (mapconcat
+ (lambda (var)
+ (format "%S (quote %S)" (car var) (cdr var)))
+ vars "\n ")
+ "]\n" body ")")))))
(if (or (member "code" result-params)
(member "pp" result-params))
(format "(clojure.pprint/pprint (do %s))" body)
--
2.16.2
next prev parent reply other threads:[~2018-03-26 4:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-21 17:49 [PATCH] ob-clojure-literate.el support :ns header and inject CIDER outside of project stardiviner
2018-03-26 1:59 ` [PATCH] ob-clojure-literate.el add some new functions stardiviner
2018-03-26 4:05 ` [PATCH] ob-clojure.el support :ns header argument stardiviner
2018-03-26 4:38 ` stardiviner [this message]
2018-03-27 3:02 ` [PATCH] ob-clojure and ob-clojure-literate support :ns header argument [V1] stardiviner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2e8bf589-83e4-4b95-0df5-874c92c18d28@gmail.com \
--to=numbchild@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.