Skip to content

Commit c663ee9

Browse files
committed
Don't try to get the script path in cider--enriched-cmd-p
We don't need it (yet) and Emacs 26 does not support `split-string-shell-command`. Don't want to fiddle with shell-quoting unless really necessary.
1 parent 881df67 commit c663ee9

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

cider.el

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -416,19 +416,13 @@ without interfering with classloaders."
416416
(clojure-cli . "clojure.sh")))
417417

418418
(defun cider--enriched-cmd-p (cmd)
419-
"Test if the shell-quoted CMD contains the name of an enrich-classpath script.
420-
Returns the local path to the script or nil."
419+
"Test if the shell-quoted CMD contains the name of an enrich-classpath script."
421420
(let* ((script-names (map-values cider--enrich-classpath-script-names))
422421
(temp-prefix cider--temp-name-prefix)
423422
(any-name (rx-to-string
424423
`(or (: (or bos "/") (or ,@script-names) (or eos space))
425-
(: ,temp-prefix (or ,@script-names)))))
426-
(script (thread-last
427-
(split-string-shell-command cmd)
428-
(seq-filter (lambda (part) (string-match any-name part)))
429-
(seq-first))))
430-
(when script
431-
(shell-quote-argument script))))
424+
(: ,temp-prefix (or ,@script-names))))))
425+
(string-match any-name cmd)))
432426

433427
(defun cider--get-enrich-classpath-script (project-type)
434428
"Get or create an executable enrich-classpath script for PROJECT-TYPE.

test/cider-tests.el

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,16 @@
126126
for name in all-names do
127127
(describe (format "cider--enriched-cmd-p with script: %s" (concat path name))
128128
:var ((script (concat path name)))
129-
(it "returns the script path in basic cases "
129+
(it "is true in basic cases "
130130
(expect (cider--enriched-cmd-p (concat "bash " script " /usr/bin/lein"))
131-
:to-equal script)
131+
:to-be-truthy)
132132
(expect (cider--enriched-cmd-p (concat "TEST=1 bash " script " /usr/bin/env lein"))
133-
:to-equal script))
133+
:to-be-truthy))
134134
(it "handles a fully constructed jack-in-cmd."
135135
;; TODO is it worth generating this?
136136
(let ((cmd (concat "bash " script " /usr/local/bin/lein update-in :dependencies conj \[nrepl/nrepl\ \"1.0.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.43.0\"\] -- update-in :plugins conj \[mx.cider/lein-enrich-classpath\ \"1.18.2\"\] -- update-in :middleware conj cider.enrich-classpath.plugin-v2/middleware -- repl :headless :host localhost")))
137137
(expect (cider--enriched-cmd-p cmd)
138-
:to-equal script))))))))
138+
:to-be-truthy))))))))
139139

140140
;;; cider-jack-in tests
141141
(describe "cider--gradle-dependency-notation"

0 commit comments

Comments
 (0)