Skip to content

introduced variable cider-clojure-cli-global-aliases #3623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

## master (unreleased)

### New features


### New features
- [#3632](https://github.com/clojure-emacs/cider/pull/3623): new configuration variable `cider-clojure-cli-global-aliases`
- [#3366](https://github.com/clojure-emacs/cider/pull/3366): Support display of error overlays with #dbg! and #break! reader macros.
- [#3622](https://github.com/clojure-emacs/cider/pull/3461): Basic support for using CIDER from [clojure-ts-mode](https://github.com/clojure-emacs/clojure-ts-mode).
- The `clojure-mode` dependency is still required for CIDER to function.
Expand Down
40 changes: 32 additions & 8 deletions cider.el
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,20 @@ then concatenated into the \"-M[your-aliases]:cider/nrepl\" form."
:safe #'stringp
:package-version '(cider . "1.1"))


(defcustom cider-clojure-cli-global-aliases
nil
"Global aliases to include when jacking in with the clojure CLI.
This value should be a string of the form \":foo:bar\", and
will be prepended to the value of `cider-clojure-cli-aliases'.
Alias names should be of the form \":foo:bar\".
Leading \"-A\" \"-M\" \"-T\" or \"-X\" are stripped from aliases
then concatenated into the \"-M[your-aliases]:cider/nrepl\" form."
:type 'string
:safe #'stringp
:package-version '(cider . "1.14"))


(defcustom cider-shadow-cljs-command
"npx shadow-cljs"
"The command used to execute shadow-cljs.
Expand Down Expand Up @@ -817,6 +831,23 @@ rules to quote it."
(utf-16le-command (encode-coding-string command 'utf-16le)))
(format "-encodedCommand %s" (base64-encode-string utf-16le-command t))))


(defun cider--combined-aliases ()
"Creates the combined ailases as stringe separated by ':'."
(let ((final-cider-clojure-cli-aliases
(cond ((and cider-clojure-cli-global-aliases cider-clojure-cli-aliases)
(concat cider-clojure-cli-global-aliases ":" cider-clojure-cli-aliases))
(cider-clojure-cli-global-aliases cider-clojure-cli-global-aliases)
(t cider-clojure-cli-aliases))))
(if final-cider-clojure-cli-aliases
;; remove exec-opts flags -A -M -T or -X from cider-clojure-cli-aliases
;; concatenated with :cider/nrepl to ensure :cider/nrepl comes last
(let ((aliases (format "%s" (replace-regexp-in-string "^-\\(A\\|M\\|T\\|X\\)" "" final-cider-clojure-cli-aliases))))
(if (string-prefix-p ":" aliases)
aliases
(concat ":" aliases)))
"")))

(defun cider-clojure-cli-jack-in-dependencies (global-options params dependencies &optional command)
"Create Clojure tools.deps jack-in dependencies.
Does so by concatenating DEPENDENCIES, PARAMS and GLOBAL-OPTIONS into a
Expand Down Expand Up @@ -850,14 +881,7 @@ your aliases contain any mains, the cider/nrepl one will be the one used."
;; TODO: global-options are deprecated and should be removed in CIDER 2.0
(if global-options (format "%s " global-options) "")
deps-quoted
(if cider-clojure-cli-aliases
;; remove exec-opts flags -A -M -T or -X from cider-clojure-cli-aliases
;; concatenated with :cider/nrepl to ensure :cider/nrepl comes last
(let ((aliases (format "%s" (replace-regexp-in-string "^-\\(A\\|M\\|T\\|X\\)" "" cider-clojure-cli-aliases))))
(if (string-prefix-p ":" aliases)
aliases
(concat ":" aliases)))
"")
(cider--combined-aliases)
(if params (format " %s" params) ""))))

(defun cider-shadow-cljs-jack-in-dependencies (global-opts params dependencies)
Expand Down
Loading