Skip to content

Commit

Permalink
[wip] undo enrich_ prefix, adapt regex
Browse files Browse the repository at this point in the history
  • Loading branch information
adrech committed Nov 14, 2023
1 parent 03f50de commit f656504
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion cider-util.el
Expand Up @@ -524,9 +524,11 @@ Any other value is just returned."
(file-executable-p file)))
file)))

(defconst cider--temp-name-prefix ".cider__")

(defun cider--make-temp-name (file)
(make-temp-name
(concat ".cider__" (file-name-nondirectory file) "__")))
(concat cider--temp-name-prefix (file-name-nondirectory file) "__")))

(defun cider--make-nearby-temp-copy (file)
(let* ((default-directory (or (clojure-project-dir) default-directory))
Expand Down
9 changes: 6 additions & 3 deletions cider.el
Expand Up @@ -412,14 +412,17 @@ without interfering with classloaders."
:safe #'booleanp)

(defvar cider--enrich-classpath-script-names
'((lein . "enrich_lein.sh")
(clojure-cli . "enrich_clojure.sh")))
'((lein . "lein.sh")
(clojure-cli . "clojure.sh")))

(defun cider--enriched-cmd-p (cmd)
"Test if the shell-quoted CMD contains the name of an enrich-classpath script.
Returns the local path to the script or nil."
(let* ((script-names (map-values cider--enrich-classpath-script-names))
(any-name (rx-to-string `(or ,@script-names)))
(temp-prefix cider--temp-name-prefix)
(any-name (rx-to-string
`(or (: (or bos "/") (or ,@script-names) (or eos space))
(: ,temp-prefix (or ,@script-names)))))
(script (thread-last
(split-string-shell-command cmd)
(seq-filter (lambda (part) (string-match any-name part)))
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit f656504

Please sign in to comment.