Skip to content

Commit

Permalink
Use revamped enrich-classpath plugin
Browse files Browse the repository at this point in the history
Its new functioning is described in clojure-emacs/enrich-classpath#23
  • Loading branch information
vemv committed Jul 5, 2023
1 parent dea866c commit 645d2ca
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions cider.el
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ returned by this function does not include keyword arguments."
(let ((plugins (if cider-enrich-classpath
(append cider-jack-in-lein-plugins
`(("cider/cider-nrepl" ,cider-injected-middleware-version)
("mx.cider/enrich-classpath" "1.9.0")))
("mx.cider/lein-enrich-classpath" "1.11.2")))
(append cider-jack-in-lein-plugins
`(("cider/cider-nrepl" ,cider-injected-middleware-version))))))
(thread-last
Expand Down Expand Up @@ -855,7 +855,7 @@ middleware and dependencies."
(cider-jack-in-normalized-lein-plugins)
(if cider-enrich-classpath
(append cider-jack-in-lein-middlewares
'("cider.enrich-classpath/middleware"))
'("cider.enrich-classpath.plugin-v2/middleware"))
cider-jack-in-lein-middlewares)))
('boot (cider-boot-jack-in-dependencies
global-opts
Expand Down Expand Up @@ -1575,14 +1575,26 @@ PARAMS is a plist with the following keys (non-exhaustive list)
(eq cider-allow-jack-in-without-project 'warn)
(or params-project-type
(y-or-n-p "Are you sure you want to run `cider-jack-in' without a Clojure project? "))))
(let ((cmd (format "%s %s" command-resolved
(if (cider--jack-in-cmd-powershell-p command)
(cider--powershell-encode-command cmd-params)
cmd-params))))
(plist-put params :jack-in-cmd (if (or cider-edit-jack-in-command
(plist-get params :edit-jack-in-command))
(read-string "jack-in command: " cmd 'cider--jack-in-cmd-history)
cmd))))
(let* ((cmd (format "%s %s" command-resolved
(if (cider--jack-in-cmd-powershell-p command)
(cider--powershell-encode-command cmd-params)
cmd-params)))
(edited-command (if (or cider-edit-jack-in-command
(plist-get params :edit-jack-in-command))
(read-string "jack-in command: " cmd 'cider--jack-in-cmd-history)
cmd))
(final-command (if (and cider-enrich-classpath
(eq project-type 'lein)
(eq system-type 'windows-nt))
(progn
"mkdir -p $HOME/.emacs.d"
;; -cp is the marker that indicates that we've found a `java -cp` invocation (as emitted by enrich-classpath)
(shell-command-to-string (concat edited-command " 2>$HOME/.emacs.d/cider-error.log | grep \" -cp \" | tail -n 1")))
edited-command))
(final-command (if (string-empty-p final-command)
edited-command
final-command)))
(plist-put params :jack-in-cmd final-command)))
(user-error "`cider-jack-in' is not allowed without a Clojure project"))))
(user-error "The %s executable isn't on your `exec-path'" command))))))

Expand Down

0 comments on commit 645d2ca

Please sign in to comment.