Skip to content

Commit

Permalink
Turn off clojure-mode advising convolute-sexp
Browse files Browse the repository at this point in the history
for expand let

Additionally remove unnecessary require and cask dependency on cl-lib
  • Loading branch information
benedekfazekas committed Nov 27, 2016
1 parent 02cb754 commit 45cd166
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions Cask
Expand Up @@ -8,5 +8,4 @@
(depends-on "espuds")
(depends-on "cider")
(depends-on "edn")
(depends-on "clojure-mode")
(depends-on "cl-lib"))
(depends-on "clojure-mode"))
10 changes: 8 additions & 2 deletions clj-refactor.el
Expand Up @@ -40,7 +40,6 @@
(require 'sgml-mode)
(require 'inflections)
(require 'hydra)
(require 'cl-lib)

(defcustom cljr-add-ns-to-blank-clj-files t
"If t, automatically add a ns form to new .clj files."
Expand Down Expand Up @@ -1656,6 +1655,13 @@ See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-introduce-let"
(define-key map (kbd key) command)
map) t))

(defun cljr--paredit-convolute-no-advice ()
(if (not (advice-member-p #'clojure--replace-let-bindings-and-indent 'paredit-convolute-sexp))
(paredit-convolute-sexp)
(advice-remove 'paredit-convolute-sexp #'clojure--replace-let-bindings-and-indent)
(paredit-convolute-sexp)
(advice-add 'paredit-convolute-sexp :after #'clojure--replace-let-bindings-and-indent)))

;;;###autoload
(defun cljr-expand-let ()
"Expand the let form above point by one level.
Expand All @@ -1667,7 +1673,7 @@ See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-expand-let"
(paredit-forward-down 2)
(paredit-forward-up)
(cljr--skip-past-whitespace-and-comments)
(paredit-convolute-sexp)
(cljr--paredit-convolute-no-advice)
(-each (cljr--get-let-bindings) 'cljr--replace-sexp-with-binding)
(cljr--one-shot-keybinding "l" 'cljr-expand-let))

Expand Down

0 comments on commit 45cd166

Please sign in to comment.