From 2d2cefcfd13f6fbb155821fb8f8f590ae089d919 Mon Sep 17 00:00:00 2001 From: shishini Date: Mon, 27 Nov 2023 22:27:03 -0500 Subject: [PATCH 1/3] Fix pwsh compatibility bug The command line needs a different formatting for pwsh compared to powershell --- cider.el | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/cider.el b/cider.el index 601bc0399..cbba12056 100644 --- a/cider.el +++ b/cider.el @@ -791,21 +791,19 @@ removed, LEIN-PLUGINS, LEIN-MIDDLEWARES and finally PARAMS." "Removes the duplicates in DEPS." (cl-delete-duplicates deps :test 'equal)) +(defun cider--jack-in-cmd-pwsh-p (command) + "Returns whether COMMAND is pwsh." + (string-equal command "pwsh")) + (defun cider--jack-in-cmd-powershell-p (command) - "Returns whether COMMAND is PowerShell." - (or (string-equal command "powershell") - (string-equal command "pwsh"))) + "Returns whether COMMAND is Powershell." + (string-equal command "powershell")) (defun cider--shell-quote-argument (argument &optional command) - "Quotes ARGUMENT like `shell-quote-argument', suitable for use with COMMAND. - -Uses `shell-quote-argument' to quote the ARGUMENT, unless COMMAND is given -and refers to PowerShell, in which case it uses (some limited) PowerShell -rules to quote it." - (if (cider--jack-in-cmd-powershell-p command) - ;; please add more PowerShell quoting rules as necessary. - (format "'%s'" (replace-regexp-in-string "\"" "\"\"" argument)) - (shell-quote-argument argument))) + "Patch to skip the quoting on windows" + (cond ((cider--jack-in-cmd-pwsh-p command) (format "'%s'" argument)) + ((cider--jack-in-cmd-powershell-p command) (format "'%s'" (replace-regexp-in-string "\"" "\"\"" argument))) + (t (shell-quote-argument argument)))) (defun cider--powershell-encode-command (cmd-params) "Base64 encode the powershell command and jack-in CMD-PARAMS for clojure-cli." @@ -1625,7 +1623,7 @@ Params is a plist with the following keys (non-exhaustive) (defun cider--format-cmd (command-resolved command cmd-params) "Format COMMAND-RESOLVED or COMMAND followed by CMD-PARAMS." (format "%s %s" command-resolved - (if (cider--jack-in-cmd-powershell-p command) + (if (or (cider--jack-in-cmd-pwsh-p command) (cider--jack-in-cmd-powershell-p command)) (cider--powershell-encode-command cmd-params) cmd-params))) From c97f5aa13368e12ac2318ffe8adeaa30b2b38234 Mon Sep 17 00:00:00 2001 From: shishini Date: Mon, 27 Nov 2023 23:48:32 -0500 Subject: [PATCH 2/3] Fix issues flagged by ci/circleci: test-lint --- cider.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cider.el b/cider.el index cbba12056..89836cb54 100644 --- a/cider.el +++ b/cider.el @@ -800,10 +800,14 @@ removed, LEIN-PLUGINS, LEIN-MIDDLEWARES and finally PARAMS." (string-equal command "powershell")) (defun cider--shell-quote-argument (argument &optional command) - "Patch to skip the quoting on windows" + "Quotes ARGUMENT like `shell-quote-argument', suitable for use with COMMAND. + +Uses `shell-quote-argument' to quote the ARGUMENT, unless COMMAND is given +and refers to PowerShell, in which case it uses (some limited) PowerShell +rules to quote it." (cond ((cider--jack-in-cmd-pwsh-p command) (format "'%s'" argument)) - ((cider--jack-in-cmd-powershell-p command) (format "'%s'" (replace-regexp-in-string "\"" "\"\"" argument))) - (t (shell-quote-argument argument)))) + ((cider--jack-in-cmd-powershell-p command) (format "'%s'" (replace-regexp-in-string "\"" "\"\"" argument))) + (t (shell-quote-argument argument)))) (defun cider--powershell-encode-command (cmd-params) "Base64 encode the powershell command and jack-in CMD-PARAMS for clojure-cli." From 136ab35ceeb72dbafc480cab8e27c3a7ce37051d Mon Sep 17 00:00:00 2001 From: shishini Date: Mon, 27 Nov 2023 23:52:30 -0500 Subject: [PATCH 3/3] Fix issue flagged by ci/circleci: test-lint --- cider.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cider.el b/cider.el index 89836cb54..873583c4c 100644 --- a/cider.el +++ b/cider.el @@ -800,7 +800,7 @@ removed, LEIN-PLUGINS, LEIN-MIDDLEWARES and finally PARAMS." (string-equal command "powershell")) (defun cider--shell-quote-argument (argument &optional command) - "Quotes ARGUMENT like `shell-quote-argument', suitable for use with COMMAND. + "Quotes ARGUMENT like `shell-quote-argument', suitable for use with COMMAND. Uses `shell-quote-argument' to quote the ARGUMENT, unless COMMAND is given and refers to PowerShell, in which case it uses (some limited) PowerShell