|
(defun maybe-cygwinize-drive-letter (file) |
|
"Return FILE in a Cygwin-friendly format. |
|
For example, given \"c:/foo/bar\" return \"/foo/bar\", or given |
|
\"e:/foo/bar\" return \"/e/foo/bar\"." |
|
(cond ((string-match "\\`[Cc]:/" file) |
|
(replace-match "/" t t file)) |
|
((string-match "\\`\\([A-Za-z]\\):/" file) |
|
(replace-match (concat "/" (match-string 1 file) "/") |
|
t t file)) |
|
(t file))) |
|
|
|
(defun my-projectile-regenerate-tags () |
|
"Patched version of `projectile-regenerate-tags' for use on Cygwin. |
|
Identical to the original `projectile-regenerate-tags' (at the |
|
time I copied it) except for the call to |
|
`maybe-cygwinize-drive-letter'." |
|
(interactive) |
|
(let* ((project-root (projectile-project-root)) |
|
(tags-exclude (projectile-tags-exclude-patterns)) |
|
(default-directory project-root) |
|
(tags-file (expand-file-name projectile-tags-file-name)) |
|
;; Make `tags-file' into something the Cygwin ctags.exe can work with |
|
(tags-file (maybe-cygwinize-drive-letter tags-file)) |
|
(command (format projectile-tags-command tags-file tags-exclude)) |
|
shell-output exit-code) |
|
(with-temp-buffer |
|
(setq exit-code |
|
(call-process-shell-command command nil (current-buffer)) |
|
shell-output (projectile-trim-string |
|
(buffer-substring (point-min) (point-max))))) |
|
(unless (zerop exit-code) |
|
(error shell-output)) |
|
(visit-tags-table tags-file))) |
|
|
|
(with-eval-after-load 'projectile |
|
(when (eq system-type 'windows-nt) |
|
(fset 'projectile-regenerate-tags #'my-projectile-regenerate-tags))) |