[bug#77574] .dir-locals.el: Add compile command.

Message ID fc4491ddc3c480d2373ae2d661b05b08a158c317.1743940605.git.gabrielsantosdesouza@disroot.org
State New
Headers
Series [bug#77574] .dir-locals.el: Add compile command. |

Commit Message

Gabriel Santos April 6, 2025, 11:56 a.m. UTC
Change-Id: I461082926c3d2370bcdead4c75ec8d6c5508c12e
---

Simple compilation command that uses guix shell in case the user doesn't have
all of the necessary dependencies installed.

 .dir-locals.el | 1 +
 1 file changed, 1 insertion(+)


base-commit: 0e144a0da24a30f86c9fa33c3f3fcfd7ac6e21be
  

Comments

Morgan Smith April 7, 2025, 9:17 p.m. UTC | #1
Gabriel Santos <gabriel.santos.smtp@gmail.com> writes:

> Change-Id: I461082926c3d2370bcdead4c75ec8d6c5508c12e
> ---
>
> Simple compilation command that uses guix shell in case the user doesn't have
> all of the necessary dependencies installed.

I think this is mostly the correct command (see below) and would love to
see this change as I am manually inserting it all the time.  Thank you
for taking the time to do this!

>
>  .dir-locals.el | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/.dir-locals.el b/.dir-locals.el
> index 76c9e12992..296f09bb97 100644
> --- a/.dir-locals.el
> +++ b/.dir-locals.el
> @@ -4,6 +4,7 @@
>    . ((fill-column . 78)
>       (tab-width   .  8)
>       (sentence-end-double-space . t)
> +     (compile-command . "guix shell -D guix -CP -- make")

According to the info manual [[info:guix#Building from Git]] the command
should be "guix shell -D guix -CPW -- make" (notice the 'W' switch).

>
>       ;; For use with 'bug-reference-prog-mode'.  Extra bug-reference
>       ;; configuration should be done in your Emacs user configuration file;
>
> base-commit: 0e144a0da24a30f86c9fa33c3f3fcfd7ac6e21be
  
Gabriel Santos April 7, 2025, 9:41 p.m. UTC | #2
>According to the info manual [[info:guix#Building from Git]] the command
>should be "guix shell -D guix -CPW -- make" (notice the 'W' switch).

Yes, I got the command from the manual too, but I've been able
to compile without the "W" flag. Maybe it's because I already
have Guix compiled. I'll do a "make clean" to check.

I'll test this out, and if it's necessary send a v2 with
an added copyright statement (which I didn't add because
my pull didn't catch the copyright commit).
  
Morgan Smith April 7, 2025, 10:06 p.m. UTC | #3
Gabriel Santos <gabrielsantosdesouza@disroot.org> writes:

>>According to the info manual [[info:guix#Building from Git]] the command
>>should be "guix shell -D guix -CPW -- make" (notice the 'W' switch).
>
> Yes, I got the command from the manual too, but I've been able
> to compile without the "W" flag. Maybe it's because I already
> have Guix compiled. I'll do a "make clean" to check.

The 'W' switch is for nested container shenanigans.  I think our tests
("make check" and "make check-system") need it.  As it's very natural to
modify the compile command from a prompt, I imagine many users will
simply append "check" and "check-system" to the default command.

Assuming you can compile without the 'W', I'm not opposed to leaving the
command as is.  However, personally I would add the 'W'.
  
Gabriel Santos April 7, 2025, 10:16 p.m. UTC | #4
>The 'W' switch is for nested container shenanigans.  I think our tests
>("make check" and "make check-system") need it. [...]
>Assuming you can compile without the 'W', I'm not opposed to leaving the
>command as is.  However, personally I would add the 'W'.

If it's used by other make commands, and doesn't
impact the regular build process, then it would be
best if I just added it. I thought it was a part of
thhe documentation that hadn't been updated.

Sending a v2 soon.
  
Tomas Volf April 7, 2025, 10:18 p.m. UTC | #5
Bit off-topic, but...

Morgan Smith <Morgan.J.Smith@outlook.com> writes:

> Gabriel Santos <gabriel.santos.smtp@gmail.com> writes:
>
>> Change-Id: I461082926c3d2370bcdead4c75ec8d6c5508c12e
>> ---
>>
>> Simple compilation command that uses guix shell in case the user doesn't have
>> all of the necessary dependencies installed.
>
> I think this is mostly the correct command (see below) and would love to
> see this change as I am manually inserting it all the time.

Let me bring your attention to (emacs)Directory Variables, specifically
to .dir-locals-2.el.  It is very useful in situations like this.

Tomas
  

Patch

diff --git a/.dir-locals.el b/.dir-locals.el
index 76c9e12992..296f09bb97 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -4,6 +4,7 @@ 
   . ((fill-column . 78)
      (tab-width   .  8)
      (sentence-end-double-space . t)
+     (compile-command . "guix shell -D guix -CP -- make")
 
      ;; For use with 'bug-reference-prog-mode'.  Extra bug-reference
      ;; configuration should be done in your Emacs user configuration file;