all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] ob-clojure-literate.el need to improve the toggle way
@ 2018-03-14  8:22 stardiviner
  2018-03-14 16:04 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: stardiviner @ 2018-03-14  8:22 UTC (permalink / raw)
  To: org-mode


[-- Attachment #1.1: Type: text/plain, Size: 63 bytes --]

I need to updated my ob-clojure-literate.el toggle functions.


[-- Attachment #1.2: Type: text/html, Size: 324 bytes --]

[-- Attachment #2: 0001-ob-clojure-literate.el-ob-clojure-literate-enable-ob.patch --]
[-- Type: text/x-patch, Size: 2511 bytes --]

From fa02d9ceb892626aa37a911d85d9074353b56bdf Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Wed, 14 Mar 2018 16:13:05 +0800
Subject: [PATCH 1/2] * ob-clojure-literate.el (ob-clojure-literate-enable,
 ob-clojure-literate-disable)

put advice into ob-clojure-literate-mode trigger functions.
---
 contrib/lisp/ob-clojure-literate.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/lisp/ob-clojure-literate.el b/contrib/lisp/ob-clojure-literate.el
index b6fedee7a..a7ab1894d 100644
--- a/contrib/lisp/ob-clojure-literate.el
+++ b/contrib/lisp/ob-clojure-literate.el
@@ -264,8 +264,6 @@ Then you need to assign image variable to this :file value like:
     (list body params) ; return modified argument list
     ))
 
-(advice-add 'org-babel-expand-body:clojure :filter-args #'ob-clojure-literate-inject-code)
-
 ;;; support :results graphics :dir "data/image" :file "incanter-plot.png"
 (defun ob-clojure-literate-support-graphics-result (result)
   "Support :results graphics :dir \"data/images\" :file \"incanter-plot.png\"
@@ -276,8 +274,6 @@ reset `RESULT' to `nil'."
 	(setq result nil))
     result))
 
-(advice-add 'org-babel-execute:clojure :filter-return #'ob-clojure-literate-support-graphics-result)
-
 
 (defvar ob-clojure-literate-mode-map
   (let ((map (make-sparse-keymap)))
@@ -297,12 +293,16 @@ reset `RESULT' to `nil'."
     (ob-clojure-literate-set-local-cider-connections ob-clojure-literate-mode)
     (ob-clojure-literate-set-local-session ob-clojure-literate-mode)
     (advice-add 'org-babel-execute:clojure :before #'ob-clojure-literate-cider-do-not-find-ns)
+    (advice-add 'org-babel-expand-body:clojure :filter-args #'ob-clojure-literate-inject-code)
+    (advice-add 'org-babel-execute:clojure :filter-return #'ob-clojure-literate-support-graphics-result)
     (message "ob-clojure-literate minor mode enabled.")))
 
 ;;;###autoload
 (defun ob-clojure-literate-disable ()
   "Disable Org-mode buffer locally for `ob-clojure-literate'."
   (advice-remove 'org-babel-execute:clojure #'ob-clojure-literate-cider-do-not-find-ns)
+  (advice-remove 'org-babel-expand-body:clojure #'ob-clojure-literate-inject-code)
+  (advice-remove 'org-babel-execute:clojure #'ob-clojure-literate-support-graphics-result)
   (setq-local cider-buffer-ns ob-clojure-literate-original-ns)
   (ob-clojure-literate-set-local-cider-connections ob-clojure-literate-mode)
   (ob-clojure-literate-set-local-session ob-clojure-literate-mode)
-- 
2.16.2


[-- Attachment #3: 0002-ob-clojure-literate.el-ob-clojure-literate-mode-disa.patch --]
[-- Type: text/x-patch, Size: 914 bytes --]

From c4c9868ffd08a6d8f9672b1e5706b7630fc8c48b Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Wed, 14 Mar 2018 16:17:06 +0800
Subject: [PATCH 2/2] * ob-clojure-literate.el (ob-clojure-literate-mode):
 disable by default.

Don't enable `ob-clojure-literate-mode' by default.
---
 contrib/lisp/ob-clojure-literate.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/lisp/ob-clojure-literate.el b/contrib/lisp/ob-clojure-literate.el
index a7ab1894d..ee3c39dfb 100644
--- a/contrib/lisp/ob-clojure-literate.el
+++ b/contrib/lisp/ob-clojure-literate.el
@@ -315,7 +315,7 @@ reset `RESULT' to `nil'."
 (define-minor-mode ob-clojure-literate-mode
   "A minor mode to toggle `ob-clojure-literate'."
   :require 'ob-clojure-literate
-  :init-value t
+  :init-value nil
   :lighter " clj-lp"
   :group 'ob-clojure-literate
   :keymap ob-clojure-literate-mode-map
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ob-clojure-literate.el need to improve the toggle way
  2018-03-14  8:22 [PATCH] ob-clojure-literate.el need to improve the toggle way stardiviner
@ 2018-03-14 16:04 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2018-03-14 16:04 UTC (permalink / raw)
  To: stardiviner; +Cc: org-mode

Hello,

stardiviner <numbchild@gmail.com> writes:

> I need to updated my ob-clojure-literate.el toggle functions.
>
> From fa02d9ceb892626aa37a911d85d9074353b56bdf Mon Sep 17 00:00:00 2001
> From: stardiviner <numbchild@gmail.com>
> Date: Wed, 14 Mar 2018 16:13:05 +0800
> Subject: [PATCH 1/2] * ob-clojure-literate.el (ob-clojure-literate-enable,
>  ob-clojure-literate-disable)
>
> put advice into ob-clojure-literate-mode trigger functions.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-14 16:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-14  8:22 [PATCH] ob-clojure-literate.el need to improve the toggle way stardiviner
2018-03-14 16:04 ` Nicolas Goaziou

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.