Fix path separator in msys2

This commit is contained in:
JerryChu 2021-01-21 14:10:14 +08:00
parent 2ad1eab6ee
commit b4fbafe451
2 changed files with 5 additions and 14 deletions

View file

@ -145,10 +145,10 @@ c) are not valid projectile projects."
projectile-project-root-files) projectile-project-root-files)
projectile-project-root-files-bottom-up nil))) projectile-project-root-files-bottom-up nil)))
;; Some utilities have issues with windows-style paths in MSYS, so emit ;; Some MSYS utilities auto expanded the `/' path separator, so we need to prevent it.
;; unix-style paths instead.
(when IS-WINDOWS (when IS-WINDOWS
(setenv "MSYS_NO_PATHCONV" "1")) (setenv "MSYS_NO_PATHCONV" "1") ; Fix path in Git Bash
(setenv "MSYS2_ARG_CONV_EXCL" "--path-separator")) ; Fix path in MSYS2
;; HACK Don't rely on VCS-specific commands to generate our file lists. That's ;; HACK Don't rely on VCS-specific commands to generate our file lists. That's
;; 7 commands to maintain, versus the more generic, reliable and ;; 7 commands to maintain, versus the more generic, reliable and
@ -185,7 +185,7 @@ And if it's a function, evaluate it."
;; Otherwise, resort to ripgrep, which is also faster than find ;; Otherwise, resort to ripgrep, which is also faster than find
((executable-find "rg" t) ((executable-find "rg" t)
(concat "rg -0 --files --follow --color=never --hidden -g!.git" (concat "rg -0 --files --follow --color=never --hidden -g!.git"
(if IS-WINDOWS " --path-separator /"))) (if IS-WINDOWS " --path-separator=/")))
("find . -type f -print0")))) ("find . -type f -print0"))))
(defadvice! doom--projectile-default-generic-command-a (orig-fn &rest args) (defadvice! doom--projectile-default-generic-command-a (orig-fn &rest args)

View file

@ -222,15 +222,6 @@ results buffer.")
(when (stringp counsel-rg-base-command) (when (stringp counsel-rg-base-command)
(setq counsel-rg-base-command (split-string counsel-rg-base-command))) (setq counsel-rg-base-command (split-string counsel-rg-base-command)))
;; REVIEW Fix #3215: prevents mingw on Windows throwing an error trying to
;; expand / to an absolute path. Remove this when it is fixed upstream
;; in counsel.
(when (and (memq system-type '(windows-nt ms-dos))
(listp counsel-rg-base-command)
(member "--path-separator" counsel-rg-base-command))
(setf (cadr (member "--path-separator" counsel-rg-base-command))
"/"))
;; Integrate with `helpful' ;; Integrate with `helpful'
(setq counsel-describe-function-function #'helpful-callable (setq counsel-describe-function-function #'helpful-callable
counsel-describe-variable-function #'helpful-variable) counsel-describe-variable-function #'helpful-variable)
@ -299,7 +290,7 @@ results buffer.")
(cl-loop for dir in projectile-globally-ignored-directories (cl-loop for dir in projectile-globally-ignored-directories
collect "--glob" collect "--glob"
collect (concat "!" dir)) collect (concat "!" dir))
(if IS-WINDOWS (list "--path-separator" "/")))) (if IS-WINDOWS '("--path-separator=/"))))
((cons find-program args))) ((cons find-program args)))
(unless (listp args) (unless (listp args)
(user-error "`counsel-file-jump-args' is a list now, please customize accordingly.")) (user-error "`counsel-file-jump-args' is a list now, please customize accordingly."))