Subject: bug#9323: Non-recursive make build systems and M-x compile

From: Reuben Thomas <[email-masked]>
Date: Fri, 19 Aug 2011 20:55:55 +0100

On 19 August 2011 20:46, Andreas Schwab <[email-masked]> wrote:
> Reuben Thomas <[email-masked]> writes:
>
>> On 19 August 2011 14:41, Andreas Schwab <[email-masked]> wrote:
>>> Reuben Thomas <[email-masked]> 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