GNU bug report logs - #77430
compilation-start should remember shell-file-name

Previous Next

Package: emacs;

Reported by: Siyuan Chen <chansey97 <at> gmail.com>

Date: Tue, 1 Apr 2025 13:43:06 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Siyuan Chen <chansey97 <at> gmail.com>
Cc: 77430 <at> debbugs.gnu.org
Subject: bug#77430: compilation-start should remember shell-file-name
Date: Tue, 01 Apr 2025 17:46:37 +0300
> From: Siyuan Chen <chansey97 <at> gmail.com>
> Date: Tue, 1 Apr 2025 21:42:21 +0800
> 
> Recently, I've been setting up a Haskell compilation environment with Emacs on Windows. The project
> depends on diagrams-cairo, which depends on GTK+, so I have to build it via msys64 with MINGW. It works
> well in a non Emacs environment, so I'd like to adapt it to the Emacs environment.
> 
> Everything is OK, except when I press 'g' in the *compilation* buffer.
> 
> To simplify the problem, below only the minimal test is provided.
> 
> Reproduce steps:
> 
> 1. Create a file test.el in E:/tmp
> 
> 2. Open that file and paste the following code
> ```
> (defun my/compile ()
>   (interactive)
>   (let ((shell-file-name "C:/msys64/usr/bin/bash")
>         (compilation-environment
> "PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl")
> 
>         )
>     (compile "ls")
>     ))
> ```

Why cannot your my/compile function do this:

  (setq-local shell-file-name "C:/msys64/usr/bin/bash")

instead of let-binding it?

> I have created a patch to workaround the issue. It remembers the original `shell-file-name' in
> `compilation-start', so we can use it when we `recompile'.

Thanks, but I don't think it's TRT for 'compile' to record the shell
by default.  In your case, you want to use the same shell each time,
but that is not always true.  Since you already have a tailored
compilation command, I suggest that the same command does this job
for you.




This bug report was last modified 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.