GNU bug report logs - #9323
M-x compile does not work well with make -s

Previous Next

Package: emacs;

Reported by: Reuben Thomas <rrt <at> sc3d.org>

Date: Thu, 18 Aug 2011 18:40:02 UTC

Severity: minor

To reply to this bug, email your comments to 9323 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9323; Package emacs. (Thu, 18 Aug 2011 18:40:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Reuben Thomas <rrt <at> sc3d.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 18 Aug 2011 18:40:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: bug-emacs <bug-emacs <at> gnu.org>
Subject: Non-recursive make build systems and M-x compile
Date: Thu, 18 Aug 2011 19:37:10 +0100
With a non-recursive make-based build system, how do I make M-x
compile work nicely?

If I just run M-x compile when visiting a source file under src/ it
doesn't work, as src/ contains no Makefile.

If I change the build command to make -C .., then Emacs gives errors
in the compile buffer pointing to files like "src/foo.c", but can't
follow those links, I presume because it considers the current dir for
the build to be "src".

Looking through compile.el it seems I ought to be able to set
compile-directory conveniently somehow; I imagine that I wouldn't want
to change the default-directory for my source buffers, though.

(BTW, typo in compile.el: "fone after" → "done after".)

-- 
http://rrt.sc3d.org




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9323; Package emacs. (Thu, 18 Aug 2011 21:51:02 GMT) Full text and rfc822 format available.

Message #8 received at 9323 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 9323 <at> debbugs.gnu.org
Subject: Re: bug#9323: Non-recursive make build systems and M-x compile
Date: Thu, 18 Aug 2011 23:48:04 +0200
Reuben Thomas <rrt <at> sc3d.org> writes:

> If I change the build command to make -C .., then Emacs gives errors
> in the compile buffer pointing to files like "src/foo.c", but can't
> follow those links, I presume because it considers the current dir for
> the build to be "src".

make -C should output "Entering directory" lines which are parsed by
Emacs.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9323; Package emacs. (Thu, 18 Aug 2011 22:46:02 GMT) Full text and rfc822 format available.

Message #11 received at 9323 <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 9323 <at> debbugs.gnu.org
Subject: Re: bug#9323: Non-recursive make build systems and M-x compile
Date: Thu, 18 Aug 2011 23:43:07 +0100
On 18 August 2011 22:48, Andreas Schwab <schwab <at> linux-m68k.org> wrote:
> Reuben Thomas <rrt <at> sc3d.org> writes:
>
>> If I change the build command to make -C .., then Emacs gives errors
>> in the compile buffer pointing to files like "src/foo.c", but can't
>> follow those links, I presume because it considers the current dir for
>> the build to be "src".
>
> make -C should output "Entering directory" lines which are parsed by
> Emacs.

It does; sorry I wasn't clear. The problem is that the links start:
src/foo.c, but the directory for the compilation is src, so in
following the link, Emacs tries to find src/src/foo.c, and fails.

-- 
http://rrt.sc3d.org




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9323; Package emacs. (Fri, 19 Aug 2011 01:32:02 GMT) Full text and rfc822 format available.

Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: grischka <grishka <at> gmx.de>
To: rrt <at> sc3d.org
Cc: bug-gnu-emacs <at> gnu.org
Subject: bug#9323: Non-recursive make build systems and M-x compile
Date: Fri, 19 Aug 2011 03:28:50 +0200
Reuben Thomas wrote:
> With a non-recursive make-based build system, how do I make M-x
> compile work nicely?
> 
> If I just run M-x compile when visiting a source file under src/ it
> doesn't work, as src/ contains no Makefile.

eproject does a cd to the project root before it runs commands:

    http://www.emacswiki.org/emacs-en/eproject

--- grischka





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9323; Package emacs. (Fri, 19 Aug 2011 03:26:01 GMT) Full text and rfc822 format available.

Message #17 received at 9323 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 9323 <at> debbugs.gnu.org
Subject: Re: bug#9323: Non-recursive make build systems and M-x compile
Date: Thu, 18 Aug 2011 23:23:46 -0400
> If I change the build command to make -C .., then Emacs gives errors
> in the compile buffer pointing to files like "src/foo.c", but can't
> follow those links, I presume because it considers the current dir for
> the build to be "src".

compile.el has ad-hoc support to try and recognize "cd ..; <foo>" and
similar (with more dot-dots).


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9323; Package emacs. (Fri, 19 Aug 2011 12:20:02 GMT) Full text and rfc822 format available.

Message #20 received at 9323 <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 9323 <at> debbugs.gnu.org
Subject: Re: bug#9323: Non-recursive make build systems and M-x compile
Date: Fri, 19 Aug 2011 13:17:10 +0100
On 19 August 2011 04:23, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
>> If I change the build command to make -C .., then Emacs gives errors
>> in the compile buffer pointing to files like "src/foo.c", but can't
>> follow those links, I presume because it considers the current dir for
>> the build to be "src".
>
> compile.el has ad-hoc support to try and recognize "cd ..; <foo>" and
> similar (with more dot-dots).

Thanks, so I just need to use a different compile command.

That's great, but it's not documented for users (it's mentioned in
comments in lisp.el). How about adding something to compile's
docstring along the lines of:

To launch a compilation in a directory other than that of the buffer,
prefix the compilation command with `cd ..;' or similar; compile will
parse this to set the default directory of the compile buffer.

-- 
http://rrt.sc3d.org




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9323; Package emacs. (Fri, 19 Aug 2011 13:44:02 GMT) Full text and rfc822 format available.

Message #23 received at 9323 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 9323 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#9323: Non-recursive make build systems and M-x compile
Date: Fri, 19 Aug 2011 15:41:08 +0200
Reuben Thomas <rrt <at> sc3d.org> writes:

> That's great, but it's not documented for users (it's mentioned in
> comments in lisp.el). How about adding something to compile's
> docstring along the lines of:
>
> To launch a compilation in a directory other than that of the buffer,
> prefix the compilation command with `cd ..;' or similar; compile will
> parse this to set the default directory of the compile buffer.

??? That's exactly what "make -C ..." accomplishes.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9323; Package emacs. (Fri, 19 Aug 2011 17:25:01 GMT) Full text and rfc822 format available.

Message #26 received at 9323 <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 9323 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#9323: Non-recursive make build systems and M-x compile
Date: Fri, 19 Aug 2011 18:22:06 +0100
On 19 August 2011 14:41, Andreas Schwab <schwab <at> linux-m68k.org> wrote:
> Reuben Thomas <rrt <at> sc3d.org> writes:
>
>> That's great, but it's not documented for users (it's mentioned in
>> comments in lisp.el). How about adding something to compile's
>> docstring along the lines of:
>>
>> To launch a compilation in a directory other than that of the buffer,
>> prefix the compilation command with `cd ..;' or similar; compile will
>> parse this to set the default directory of the compile buffer.
>
> ??? That's exactly what "make -C ..." accomplishes.

That's right, but compile.el does not parse the directory out of a
"make -C .." command, leading to the problem I described above where
the paths listed in error & warning messages in the compile buffer are
not correct relative to the path of the compile buffer itself. On the
other hand, compile.el does understand the format "cd ..; make",
allowing it to set the path of the compile buffer correctly.

-- 
http://rrt.sc3d.org




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9323; Package emacs. (Fri, 19 Aug 2011 19:50:02 GMT) Full text and rfc822 format available.

Message #29 received at 9323 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 9323 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#9323: Non-recursive make build systems and M-x compile
Date: Fri, 19 Aug 2011 21:46:52 +0200
Reuben Thomas <rrt <at> sc3d.org> writes:

> On 19 August 2011 14:41, Andreas Schwab <schwab <at> linux-m68k.org> wrote:
>> Reuben Thomas <rrt <at> sc3d.org> writes:
>>
>>> That's great, but it's not documented for users (it's mentioned in
>>> comments in lisp.el). How about adding something to compile's
>>> docstring along the lines of:
>>>
>>> To launch a compilation in a directory other than that of the buffer,
>>> prefix the compilation command with `cd ..;' or similar; compile will
>>> parse this to set the default directory of the compile buffer.
>>
>> ??? That's exactly what "make -C ..." accomplishes.
>
> That's right, but compile.el does not parse the directory out of a
> "make -C .." command,

Yes, it does.  The directory is displayed by the entering message.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9323; Package emacs. (Fri, 19 Aug 2011 19:59:02 GMT) Full text and rfc822 format available.

Message #32 received at 9323 <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 9323 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#9323: Non-recursive make build systems and M-x compile
Date: Fri, 19 Aug 2011 20:55:55 +0100
On 19 August 2011 20:46, Andreas Schwab <schwab <at> linux-m68k.org> wrote:
> Reuben Thomas <rrt <at> sc3d.org> writes:
>
>> On 19 August 2011 14:41, Andreas Schwab <schwab <at> linux-m68k.org> wrote:
>>> Reuben Thomas <rrt <at> sc3d.org> writes:
>>>
>>>> That's great, but it's not documented for users (it's mentioned in
>>>> comments in lisp.el). How about adding something to compile's
>>>> docstring along the lines of:
>>>>
>>>> To launch a compilation in a directory other than that of the buffer,
>>>> prefix the compilation command with `cd ..;' or similar; compile will
>>>> parse this to set the default directory of the compile buffer.
>>>
>>> ??? That's exactly what "make -C ..." accomplishes.
>>
>> That's right, but compile.el does not parse the directory out of a
>> "make -C .." command,
>
> Yes, it does.  The directory is displayed by the entering
> message.

I'm sorry things are still unclear. I will now demonstrate step by
step exactly the difference I am talking about:

Running a recent build of emacs master branch from bazaar (emacs -Q):

I visit ~/Software/zile-stable/src/main.c

I do M-x compile

I edit the command so that it reads:

make -C .. -k

and then run it. At the top of the compile buffer the following is shown:

-*- mode: compilation; default-directory: "~/Software/zile-stable/src/" -*-

Note that it has set default-directory to the directory of main.c, not
its parent.

Later, there is a warning:

src/astr.c:67:12: warning: assignment discards qualifiers from pointer
target type

If I press enter over this warning, Emacs cannot open the target file,
and prompts me with:

Find this error in (default src/astr.c): ...

Now I make clean (in a terminal) and try again, M-x compile, and this
time I edit the command to:

cd ..; make -k

Now the compile buffer's first line reads:

-*- mode: compilation; default-directory: "~/Software/zile-stable/" -*-

Note that default-directory has been correctly set.

The same warning as above is displayed in the buffer, and if I hit
Enter over it, Emacs visits the file referred to without a prompt.

Note that in compile.el there is no mention of make's -C option,
whereas there are a couple of mentions of parsing out cd commands at
the start of the compile command.

-- 
http://rrt.sc3d.org




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9323; Package emacs. (Fri, 19 Aug 2011 23:33:01 GMT) Full text and rfc822 format available.

Message #35 received at 9323 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 9323 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#9323: Non-recursive make build systems and M-x compile
Date: Sat, 20 Aug 2011 01:30:38 +0200
Reuben Thomas <rrt <at> sc3d.org> writes:

> Note that it has set default-directory to the directory of main.c, not
> its parent.

It doesn't matter.  Emacs will see the directory in the entering
message and adjust:

make: Entering directory `/home/rrt/Software/zile-stable'

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9323; Package emacs. (Sat, 20 Aug 2011 05:24:02 GMT) Full text and rfc822 format available.

Message #38 received at 9323 <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 9323 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#9323: Non-recursive make build systems and M-x compile
Date: Sat, 20 Aug 2011 06:20:57 +0100
On 20 August 2011 00:30, Andreas Schwab <schwab <at> linux-m68k.org> wrote:
> Reuben Thomas <rrt <at> sc3d.org> writes:
>
>> Note that it has set default-directory to the directory of main.c, not
>> its parent.
>
> It doesn't matter.  Emacs will see the directory in the entering
> message and adjust:
>
> make: Entering directory `/home/rrt/Software/zile-stable'

I used -s as an argument to make (I am sorry, I see I didn't mention
this), and in this case make does not produce those messages. Hence,
"cd ..; make -k -s" works, but "make -C .. -k -s" doesn't.

So, it still seems worth documenting Emacs's ability to work around
this problem by parsing "cd ..".

-- 
http://rrt.sc3d.org




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9323; Package emacs. (Sat, 20 Aug 2011 13:00:03 GMT) Full text and rfc822 format available.

Message #41 received at 9323 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 9323 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#9323: Non-recursive make build systems and M-x compile
Date: Sat, 20 Aug 2011 14:57:20 +0200
Emacs should perhaps put MAKEFLAGS=w in the environment.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Changed bug title to 'M-x compile does not work well with make -s' from 'Non-recursive make build systems and M-x compile' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 21 Aug 2011 02:23:02 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 21 Aug 2011 02:23:02 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 299 days ago.

Previous Next


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