* Default compile directory
@ 2009-08-17 21:12 Sumit Narayan
2009-08-18 5:38 ` Ivan Kanis
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Sumit Narayan @ 2009-08-17 21:12 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
Is there any way to set default compile directory?
The problem: I have a many sub-folders in my project and when I edit a
file deep inside subfolders and do M-x compile, I end up running make
in that subfolder, instead of the root folder. Is there any way for
Emacs to always run compile in the default folder?
One thing I figured was to change default compile command to be: cd
<project's root folder>; make. Is that the only/best way?
Thanks.
Sumit.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Default compile directory
2009-08-17 21:12 Default compile directory Sumit Narayan
@ 2009-08-18 5:38 ` Ivan Kanis
2009-08-18 19:59 ` Sumit Narayan
[not found] ` <mailman.5018.1250860038.2239.help-gnu-emacs@gnu.org>
2009-08-18 8:15 ` Peter Dyballa
2009-08-18 21:51 ` Nikolaj Schumacher
2 siblings, 2 replies; 9+ messages in thread
From: Ivan Kanis @ 2009-08-18 5:38 UTC (permalink / raw)
To: Sumit Narayan; +Cc: help-gnu-emacs
> Is there any way to set default compile directory?
>
> The problem: I have a many sub-folders in my project and when I edit a
> file deep inside subfolders and do M-x compile, I end up running make
> in that subfolder, instead of the root folder. Is there any way for
> Emacs to always run compile in the default folder?
>
> One thing I figured was to change default compile command to be: cd
> <project's root folder>; make. Is that the only/best way?
Hi Sumit,
You can use .dir-locals.el in your root folder and put something like:
(setq compile-command "cd <root folder>; make")
It will be evaluated every time you open a file in the folder. I think
it's a new feature of emacs 23.
Kind regards,
--
Ivan
Kanis http://kanis.fr
We know what we are, but know not what we may be.
-- William Shakespeare
Sumit Narayan <sumnaray@gmail.com> wrote:
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Default compile directory
2009-08-17 21:12 Default compile directory Sumit Narayan
2009-08-18 5:38 ` Ivan Kanis
@ 2009-08-18 8:15 ` Peter Dyballa
2009-08-18 20:08 ` Sumit Narayan
2009-08-18 21:51 ` Nikolaj Schumacher
2 siblings, 1 reply; 9+ messages in thread
From: Peter Dyballa @ 2009-08-18 8:15 UTC (permalink / raw)
To: Sumit Narayan; +Cc: help-gnu-emacs
Am 17.08.2009 um 23:12 schrieb Sumit Narayan:
> One thing I figured was to change default compile command to be: cd
> <project's root folder>; make. Is that the only/best way?
No. You can also keep open a(n optionally minimised) second frame
either with a buffer keeping open a file from your project's root
directory, or a dired buffer from it, or the *compilation* buffer.
When using GNU Emacs 23 you can in *compilation* buffer just type g
(like update in dired) and the compilation process starts again.
--
Greetings
Pete
If you're not confused, you're not paying attention.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Default compile directory
2009-08-18 5:38 ` Ivan Kanis
@ 2009-08-18 19:59 ` Sumit Narayan
[not found] ` <mailman.5018.1250860038.2239.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 9+ messages in thread
From: Sumit Narayan @ 2009-08-18 19:59 UTC (permalink / raw)
To: Ivan Kanis; +Cc: help-gnu-emacs
Thanks.
This is what I did:
Added
((nil . ((setq compile-command "cd <project root directory>; make"))))
in <project root directory>/.dir-locals.el.
When I open any file inside this folder, I am asked for permission to
apply the local variables
setq : (compile-command "cd <project root directory>; make")
For some reason, my response as 'y' or '!' does not make a difference.
When I give M-x compile, I still end up with "make -k".
Any idea why?
Thanks,
Sumit.
On Tue, Aug 18, 2009 at 1:38 AM, Ivan
Kanis<expire-by-2009-08-23@kanis.fr> wrote:
>
>> Is there any way to set default compile directory?
>>
>> The problem: I have a many sub-folders in my project and when I edit a
>> file deep inside subfolders and do M-x compile, I end up running make
>> in that subfolder, instead of the root folder. Is there any way for
>> Emacs to always run compile in the default folder?
>>
>> One thing I figured was to change default compile command to be: cd
>> <project's root folder>; make. Is that the only/best way?
>
> Hi Sumit,
>
> You can use .dir-locals.el in your root folder and put something like:
>
> (setq compile-command "cd <root folder>; make")
>
> It will be evaluated every time you open a file in the folder. I think
> it's a new feature of emacs 23.
>
> Kind regards,
> --
> Ivan
> Kanis http://kanis.fr
>
> We know what we are, but know not what we may be.
> -- William Shakespeare
>
> Sumit Narayan <sumnaray@gmail.com> wrote:
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Default compile directory
2009-08-18 8:15 ` Peter Dyballa
@ 2009-08-18 20:08 ` Sumit Narayan
0 siblings, 0 replies; 9+ messages in thread
From: Sumit Narayan @ 2009-08-18 20:08 UTC (permalink / raw)
To: Peter Dyballa; +Cc: help-gnu-emacs
Thanks Peter. This is a nice feature. I wasn't aware of it and I think
it is quite useful.
However, I have my compilation window close on its own if there were
no errors. To recompile, I will have to change to that buffer, which I
do not wish to. Emacs anyway saves the previous compile command. I
only need to give the compile command once in the project folder. But
if I move to another project, I will have to give the compile command
again. .dir-locals.el seems like something I could use.
Sumit.
On Tue, Aug 18, 2009 at 4:15 AM, Peter Dyballa<Peter_Dyballa@web.de> wrote:
>
> Am 17.08.2009 um 23:12 schrieb Sumit Narayan:
>
>> One thing I figured was to change default compile command to be: cd
>> <project's root folder>; make. Is that the only/best way?
>
> No. You can also keep open a(n optionally minimised) second frame either
> with a buffer keeping open a file from your project's root directory, or a
> dired buffer from it, or the *compilation* buffer. When using GNU Emacs 23
> you can in *compilation* buffer just type g (like update in dired) and the
> compilation process starts again.
>
> --
> Greetings
>
> Pete
>
> If you're not confused, you're not paying attention.
>
>
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Default compile directory
2009-08-17 21:12 Default compile directory Sumit Narayan
2009-08-18 5:38 ` Ivan Kanis
2009-08-18 8:15 ` Peter Dyballa
@ 2009-08-18 21:51 ` Nikolaj Schumacher
2 siblings, 0 replies; 9+ messages in thread
From: Nikolaj Schumacher @ 2009-08-18 21:51 UTC (permalink / raw)
To: Sumit Narayan; +Cc: help-gnu-emacs
Sumit Narayan <sumnaray@gmail.com> wrote:
> The problem: I have a many sub-folders in my project and when I edit a
> file deep inside subfolders and do M-x compile, I end up running make
> in that subfolder, instead of the root folder. Is there any way for
> Emacs to always run compile in the default folder?
In most cases you'll want to use M-x recompile to avoid this.
regards,
Nikolaj Schumacher
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Default compile directory
[not found] ` <mailman.5018.1250860038.2239.help-gnu-emacs@gnu.org>
@ 2009-08-21 14:32 ` A.Politz
2009-08-21 15:23 ` Sumit Narayan
0 siblings, 1 reply; 9+ messages in thread
From: A.Politz @ 2009-08-21 14:32 UTC (permalink / raw)
To: help-gnu-emacs
On Aug 18, 9:59 pm, Sumit Narayan <sumna...@gmail.com> wrote:
>
> This is what I did:
>
> Added
> ((nil . ((setq compile-command "cd <project root directory>; make"))))
> in <project root directory>/.dir-locals.el.
>
> [does not work]
According to the info doc, the syntax is similar to a let-list.
So, delete the 'setq' and it should work.
-ap
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Default compile directory
2009-08-21 14:32 ` A.Politz
@ 2009-08-21 15:23 ` Sumit Narayan
2009-08-25 15:35 ` Sumit Narayan
0 siblings, 1 reply; 9+ messages in thread
From: Sumit Narayan @ 2009-08-21 15:23 UTC (permalink / raw)
To: A.Politz; +Cc: help-gnu-emacs
Thanks Politz. I was also missing a dot.
For those who might be looking at this in future, this is how I got it
working. Add
((nil . ((compile-command . "cd <project root directory>; make"))))
in <project root directory>/.dir-locals.el.
Sumit.
On Fri, Aug 21, 2009 at 10:32 AM, A.Politz<politza@googlemail.com> wrote:
> On Aug 18, 9:59 pm, Sumit Narayan <sumna...@gmail.com> wrote:
>
>>
>> This is what I did:
>>
>> Added
>> ((nil . ((setq compile-command "cd <project root directory>; make"))))
>> in <project root directory>/.dir-locals.el.
>>
>> [does not work]
>
> According to the info doc, the syntax is similar to a let-list.
> So, delete the 'setq' and it should work.
>
>
>
> -ap
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Default compile directory
2009-08-21 15:23 ` Sumit Narayan
@ 2009-08-25 15:35 ` Sumit Narayan
0 siblings, 0 replies; 9+ messages in thread
From: Sumit Narayan @ 2009-08-25 15:35 UTC (permalink / raw)
To: A.Politz; +Cc: help-gnu-emacs
Back to this topic.
This only works if I my frame has some code open. But if I am in an
eshell frame, it goes back to the default compile command - 'make -k'.
Is that how it is supposed to be?
Thanks,
Sumit.
On Fri, Aug 21, 2009 at 11:23 AM, Sumit Narayan<sumnaray@gmail.com> wrote:
> Thanks Politz. I was also missing a dot.
>
> For those who might be looking at this in future, this is how I got it
> working. Add
>
> ((nil . ((compile-command . "cd <project root directory>; make"))))
>
> in <project root directory>/.dir-locals.el.
>
> Sumit.
>
>
>
> On Fri, Aug 21, 2009 at 10:32 AM, A.Politz<politza@googlemail.com> wrote:
>> On Aug 18, 9:59 pm, Sumit Narayan <sumna...@gmail.com> wrote:
>>
>>>
>>> This is what I did:
>>>
>>> Added
>>> ((nil . ((setq compile-command "cd <project root directory>; make"))))
>>> in <project root directory>/.dir-locals.el.
>>>
>>> [does not work]
>>
>> According to the info doc, the syntax is similar to a let-list.
>> So, delete the 'setq' and it should work.
>>
>>
>>
>> -ap
>>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-08-25 15:35 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-17 21:12 Default compile directory Sumit Narayan
2009-08-18 5:38 ` Ivan Kanis
2009-08-18 19:59 ` Sumit Narayan
[not found] ` <mailman.5018.1250860038.2239.help-gnu-emacs@gnu.org>
2009-08-21 14:32 ` A.Politz
2009-08-21 15:23 ` Sumit Narayan
2009-08-25 15:35 ` Sumit Narayan
2009-08-18 8:15 ` Peter Dyballa
2009-08-18 20:08 ` Sumit Narayan
2009-08-18 21:51 ` Nikolaj Schumacher
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).