unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9323: Non-recursive make build systems and M-x compile
@ 2011-08-18 18:37 Reuben Thomas
  2011-08-18 21:48 ` Andreas Schwab
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Reuben Thomas @ 2011-08-18 18:37 UTC (permalink / raw)
  To: 9323

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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#9323: Non-recursive make build systems and M-x compile
  2011-08-18 18:37 bug#9323: Non-recursive make build systems and M-x compile Reuben Thomas
@ 2011-08-18 21:48 ` Andreas Schwab
  2011-08-18 22:43   ` Reuben Thomas
  2011-08-19  1:28 ` grischka
  2011-08-19  3:23 ` Stefan Monnier
  2 siblings, 1 reply; 13+ messages in thread
From: Andreas Schwab @ 2011-08-18 21:48 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 9323

Reuben Thomas <rrt@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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#9323: Non-recursive make build systems and M-x compile
  2011-08-18 21:48 ` Andreas Schwab
@ 2011-08-18 22:43   ` Reuben Thomas
  0 siblings, 0 replies; 13+ messages in thread
From: Reuben Thomas @ 2011-08-18 22:43 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 9323

On 18 August 2011 22:48, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Reuben Thomas <rrt@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#9323: Non-recursive make build systems and M-x compile
  2011-08-18 18:37 bug#9323: Non-recursive make build systems and M-x compile Reuben Thomas
  2011-08-18 21:48 ` Andreas Schwab
@ 2011-08-19  1:28 ` grischka
  2011-08-19  3:23 ` Stefan Monnier
  2 siblings, 0 replies; 13+ messages in thread
From: grischka @ 2011-08-19  1:28 UTC (permalink / raw)
  To: rrt; +Cc: 9323

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






^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#9323: Non-recursive make build systems and M-x compile
  2011-08-18 18:37 bug#9323: Non-recursive make build systems and M-x compile Reuben Thomas
  2011-08-18 21:48 ` Andreas Schwab
  2011-08-19  1:28 ` grischka
@ 2011-08-19  3:23 ` Stefan Monnier
  2011-08-19 12:17   ` Reuben Thomas
  2 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2011-08-19  3:23 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 9323

> 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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#9323: Non-recursive make build systems and M-x compile
  2011-08-19  3:23 ` Stefan Monnier
@ 2011-08-19 12:17   ` Reuben Thomas
  2011-08-19 13:41     ` Andreas Schwab
  0 siblings, 1 reply; 13+ messages in thread
From: Reuben Thomas @ 2011-08-19 12:17 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 9323

On 19 August 2011 04:23, Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#9323: Non-recursive make build systems and M-x compile
  2011-08-19 12:17   ` Reuben Thomas
@ 2011-08-19 13:41     ` Andreas Schwab
  2011-08-19 17:22       ` Reuben Thomas
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Schwab @ 2011-08-19 13:41 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 9323

Reuben Thomas <rrt@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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#9323: Non-recursive make build systems and M-x compile
  2011-08-19 13:41     ` Andreas Schwab
@ 2011-08-19 17:22       ` Reuben Thomas
  2011-08-19 19:46         ` Andreas Schwab
  0 siblings, 1 reply; 13+ messages in thread
From: Reuben Thomas @ 2011-08-19 17:22 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 9323

On 19 August 2011 14:41, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Reuben Thomas <rrt@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#9323: Non-recursive make build systems and M-x compile
  2011-08-19 17:22       ` Reuben Thomas
@ 2011-08-19 19:46         ` Andreas Schwab
  2011-08-19 19:55           ` Reuben Thomas
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Schwab @ 2011-08-19 19:46 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 9323

Reuben Thomas <rrt@sc3d.org> writes:

> On 19 August 2011 14:41, Andreas Schwab <schwab@linux-m68k.org> wrote:
>> Reuben Thomas <rrt@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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#9323: Non-recursive make build systems and M-x compile
  2011-08-19 19:46         ` Andreas Schwab
@ 2011-08-19 19:55           ` Reuben Thomas
  2011-08-19 23:30             ` Andreas Schwab
  0 siblings, 1 reply; 13+ messages in thread
From: Reuben Thomas @ 2011-08-19 19:55 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 9323

On 19 August 2011 20:46, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Reuben Thomas <rrt@sc3d.org> writes:
>
>> On 19 August 2011 14:41, Andreas Schwab <schwab@linux-m68k.org> wrote:
>>> Reuben Thomas <rrt@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#9323: Non-recursive make build systems and M-x compile
  2011-08-19 19:55           ` Reuben Thomas
@ 2011-08-19 23:30             ` Andreas Schwab
  2011-08-20  5:20               ` Reuben Thomas
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Schwab @ 2011-08-19 23:30 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 9323

Reuben Thomas <rrt@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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#9323: Non-recursive make build systems and M-x compile
  2011-08-19 23:30             ` Andreas Schwab
@ 2011-08-20  5:20               ` Reuben Thomas
  2011-08-20 12:57                 ` Andreas Schwab
  0 siblings, 1 reply; 13+ messages in thread
From: Reuben Thomas @ 2011-08-20  5:20 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 9323

On 20 August 2011 00:30, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Reuben Thomas <rrt@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#9323: Non-recursive make build systems and M-x compile
  2011-08-20  5:20               ` Reuben Thomas
@ 2011-08-20 12:57                 ` Andreas Schwab
  0 siblings, 0 replies; 13+ messages in thread
From: Andreas Schwab @ 2011-08-20 12:57 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 9323

Emacs should perhaps put MAKEFLAGS=w in the environment.

Andreas.

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





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-08-20 12:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-18 18:37 bug#9323: Non-recursive make build systems and M-x compile Reuben Thomas
2011-08-18 21:48 ` Andreas Schwab
2011-08-18 22:43   ` Reuben Thomas
2011-08-19  1:28 ` grischka
2011-08-19  3:23 ` Stefan Monnier
2011-08-19 12:17   ` Reuben Thomas
2011-08-19 13:41     ` Andreas Schwab
2011-08-19 17:22       ` Reuben Thomas
2011-08-19 19:46         ` Andreas Schwab
2011-08-19 19:55           ` Reuben Thomas
2011-08-19 23:30             ` Andreas Schwab
2011-08-20  5:20               ` Reuben Thomas
2011-08-20 12:57                 ` Andreas Schwab

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).