ob-clojure-litterate: Fix trigger functions.

* ob-clojure-literate.el (ob-clojure-literate-enable,
  ob-clojure-literate-disable): Put advice into
  ob-clojure-literate-mode trigger functions.
This commit is contained in:
stardiviner 2018-03-14 16:13:05 +08:00 committed by Nicolas Goaziou
parent 0edf344e2a
commit 6cf5fc0fc1
1 changed files with 4 additions and 4 deletions

View File

@ -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)