bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#77430: compilation-start should remember shell-file-name


From: Siyuan Chen
Subject: bug#77430: compilation-start should remember shell-file-name
Date: Tue, 1 Apr 2025 21:42:21 +0800

Background:

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")
    ))
```
NOTE: You can think of "ls" as a compilation command such as "stack build" in Haskell.

3. Evaluate Last S-_expression_.

4. M-x my/compile

The *compilation* buffer lists the files normally.

5. Press 'g' in the *compilation* buffer, i.e. `recompile'.

The expected behavior: List the files again.

The actual behavior: Compilation exited abnormally.

The problem is that `recompile' does not realize that `shell-file-name' has been updated to bash. It still uses the default cmdproxy.

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.

Best regards,
Siyuan Chen

Attachment: 0001-Remember-the-original-shell-file-name-so-we-can-use-.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]