ob-clojure-literate: Don't enable ob-clojure-literate-mode by default.

* contrib/lisp/ob-clojure-literate.el (ob-clojure-literate-auto-jackin):
Handle the case that detect cider-jack-in is executed but not connected,
and ob-clojure-literate-mode is enabled already.

* contrib/lisp/ob-clojure-literate.el (ob-clojure-literate-mode): Don't
  enable ob-clojure-literate-mode by default.
This commit is contained in:
stardiviner 2018-05-03 10:20:41 +08:00 committed by Nicolas Goaziou
parent ee336b8cf7
commit 4bd7df57d0
1 changed files with 7 additions and 8 deletions

View File

@ -67,6 +67,7 @@ If it is a directory, `ob-clojure-literate' will try to create Clojure project a
;; get global value instead of buffer local.
(default-value 'cider-connections)))
;;; Do not allow "ob-clojure" project session name.
(defun ob-clojure-literate-set-session ()
"Set session name for buffer local."
;; if default session is the only one in connections list.
@ -80,8 +81,8 @@ If it is a directory, `ob-clojure-literate' will try to create Clojure project a
(ob-clojure-literate-get-session-list)))
;; if none, set to default session name to fix `ob-clojure-literate-mode'
;; is enabled before `cider-jack-in' generated connections.
(setq-local ob-clojure-literate-session ob-clojure-literate-default-session))
))
(setq-local ob-clojure-literate-session
ob-clojure-literate-default-session))))
;;;###autoload
(defun ob-clojure-literate-specify-session ()
@ -124,15 +125,14 @@ If it is a directory, `ob-clojure-literate' will try to create Clojure project a
(if (not (null ob-clojure-literate-session))
(seq-contains cider-connections (get-buffer ob-clojure-literate-session))))
cider-connections
(not (null ob-clojure-literate-session)))
(ob-clojure-literate-any-connection-p))
;; return back to original file.
(if (not (and (= (length (ob-clojure-literate-get-session-list)) 1)
(member ob-clojure-literate-default-session (ob-clojure-literate-get-session-list))))
(save-window-excursion
(find-file (expand-file-name (concat ob-clojure-literate-project-location "ob-clojure/src/ob_clojure/core.clj")))
(with-current-buffer "core.clj"
(cider-jack-in))))))
))
(cider-jack-in))))))))
(defun ob-clojure-literate-set-local-cider-connections (toggle?)
"Set buffer local `cider-connections' for `ob-clojure-literate-mode' `TOGGLE?'."
@ -182,8 +182,7 @@ If it is a directory, `ob-clojure-literate' will try to create Clojure project a
(delq t
(mapcar
(lambda (cons) (if (eq (car cons) :session) t cons))
org-babel-default-header-args:clojure)))
))
org-babel-default-header-args:clojure)))))
;;; Support `org-babel-initiate-session' / [C-c C-v z] to initialize Clojure session.
@ -334,7 +333,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