On windows I have set (setq explicit-shell-file-name "c:/Program Files/Git/bin/bash.exe") to use git-bash for e.g. M-x shell. In compilation mode however, the standard windows console still seems to be used, as far as I can tell. Can this be changed somehow?

FWIW, I'm actually using projectile-run-project to trigger compilation in this particular scenario. One possible solution is to place (projectile-project-run-cmd . "\"c:/Program Files/Git/bin/bash.exe\" build_and_run.sh") in .dir-locals.el, but then I cannot use the same dir-locals on linux. It is important that the output of build_and_run.sh is displayed in compilation-mode, because it might contain links with build errors.

  • 1
    explicit-shell-file-name is only for M-x shell. Does it work to set shell-file-name instead?
    – rpluim
    Apr 23, 2019 at 11:58
  • Seems to work fine!
    – B_old
    Apr 23, 2019 at 12:09
  • The problem is, that this will cause other issues. For example I get messages like this now, when counsel-etags calls grep: A path separator must be exactly one byte, but the given separator is 21 bytes: C:/Program Files/Git/ In some shells on Windows '/' is automatically expanded. Use '//' instead.
    – B_old
    Apr 23, 2019 at 14:48
  • Here is a link to an example of how I use Emacs (for Windows) to build Emacs (for Windows) with the MinGW library: emacs.stackexchange.com/a/48316/2287 In the linked example, I use the MinGW sh.exe as the custom shell in compilation-mode. I have never used projectile.
    – lawlist
    Apr 23, 2019 at 19:24


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.