all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: compile/run a code from emacs
  2005-07-18 12:06 compile/run a code from emacs Baloff
@ 2005-07-17 20:01 ` N. Raghavendra
  2005-07-19 11:46   ` Baloff
  0 siblings, 1 reply; 6+ messages in thread
From: N. Raghavendra @ 2005-07-17 20:01 UTC (permalink / raw)


At 2005-07-18T05:06:09-07:00, Baloff wrote:

> is there a way to just hit one key and it does "$make && ./project1"
> for me?

In your source files, specify the value of the variable
`compile-command' like this:

/* 
 * Local Variables:
 * mode: c
 * compile-command: "make && ./project1"
 * End:
 */
  
If you want to bind, for instance, the function key `f5' to
compilation, you can put this in your init file:

(global-set-key [f5] 'compile)

HTH,
Raghavendra.

-- 
N. Raghavendra <raghu@mri.ernet.in> | See message headers for contact
Harish-Chandra Research Institute   | and OpenPGP details.

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

* compile/run a code from emacs
@ 2005-07-18 12:06 Baloff
  2005-07-17 20:01 ` N. Raghavendra
  0 siblings, 1 reply; 6+ messages in thread
From: Baloff @ 2005-07-18 12:06 UTC (permalink / raw)


Hello there
I wrote a code and a makefile using emacs,
then I went to the shell "all in emacs" and $make then $./project1 to 
run the program.
is there a way to just hit one key and it does "$make && ./project1" for me?
can someone help
thanks

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

* Re: compile/run a code from emacs
  2005-07-19 11:46   ` Baloff
@ 2005-07-19  5:09     ` N. Raghavendra
  2005-07-20 13:14       ` Baloff
  0 siblings, 1 reply; 6+ messages in thread
From: N. Raghavendra @ 2005-07-19  5:09 UTC (permalink / raw)


At 2005-07-19T04:46:28-07:00, Baloff wrote:

> N. Raghavendra wrote:

> > In your source files, specify the value of the variable
> > `compile-command' like this:
> > /*  * Local Variables:
> >  * mode: c
> >  * compile-command: "make && ./project1"
> >  * End:
> >  */
> >
> do you mean to put the above 4 lines in my c++ code but with out the
> /*, *, */? since they are for commenting?

The local variables section should be commented, since it is not part
of your source code.  So, do not remove the comment delimiters.

> > (global-set-key [f5] 'compile)
> >
> when I put this line in my ~/.emacs and hit f5 I get "Mark set" in
> the mini buffer

It looks like the `f5' key has been bound in your setup to
`set-mark-command'.  According to `(elisp)Coding Conventions',

  "Function keys <F5> through <F9> without modifier keys are reserved
   for users to define."

So the key should be unbound.  Did you load the init file, or evaluate
the key binding expression before trying the key?

Raghavendra.

-- 
N. Raghavendra <raghu@mri.ernet.in> | See message headers for contact
Harish-Chandra Research Institute   | and OpenPGP details.

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

* Re: compile/run a code from emacs
  2005-07-17 20:01 ` N. Raghavendra
@ 2005-07-19 11:46   ` Baloff
  2005-07-19  5:09     ` N. Raghavendra
  0 siblings, 1 reply; 6+ messages in thread
From: Baloff @ 2005-07-19 11:46 UTC (permalink / raw)


N. Raghavendra wrote:
> At 2005-07-18T05:06:09-07:00, Baloff wrote:
> 
> 
>>is there a way to just hit one key and it does "$make && ./project1"
>>for me?
> 
> 
> In your source files, specify the value of the variable
> `compile-command' like this:
> 
> /* 
>  * Local Variables:
>  * mode: c
>  * compile-command: "make && ./project1"
>  * End:
>  */
>
do you mean to put the above 4 lines in my c++ code but with out the /*, 
*, */? since they are for commenting?

> If you want to bind, for instance, the function key `f5' to
> compilation, you can put this in your init file:
> 
> (global-set-key [f5] 'compile)
> 
when I put this line in my ~/.emacs and hit f5 I get "Mark set" in the 
mini buffer


> HTH,
> Raghavendra.
> 

Hello
thanks,

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

* Re: compile/run a code from emacs
  2005-07-20 13:14       ` Baloff
@ 2005-07-20  8:43         ` N. Raghavendra
  0 siblings, 0 replies; 6+ messages in thread
From: N. Raghavendra @ 2005-07-20  8:43 UTC (permalink / raw)


At 2005-07-20T06:14:55-07:00, Baloff wrote:

> ok, it works, I put the commented code in my source file and hit f5,
> it asked to save main.cpp and it then
> 
> opened another buffer window and compiled it, but did not run the program.
> my line in the commented section is
> *compile-command: "make && ./proj1"

Perhaps the `make' command finished with a nonzero exit status?  In
any case, your message indicates that your use of file variables is
correct.

Raghavendra.

-- 
N. Raghavendra <raghu@mri.ernet.in> | See message headers for contact
Harish-Chandra Research Institute   | and OpenPGP details.

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

* Re: compile/run a code from emacs
  2005-07-19  5:09     ` N. Raghavendra
@ 2005-07-20 13:14       ` Baloff
  2005-07-20  8:43         ` N. Raghavendra
  0 siblings, 1 reply; 6+ messages in thread
From: Baloff @ 2005-07-20 13:14 UTC (permalink / raw)


N. Raghavendra wrote:
> At 2005-07-19T04:46:28-07:00, Baloff wrote:
> 
> 
>>N. Raghavendra wrote:
> 
> 
>>>In your source files, specify the value of the variable
>>>`compile-command' like this:
>>>/*  * Local Variables:
>>> * mode: c
>>> * compile-command: "make && ./project1"
>>> * End:
>>> */
>>>
>>
>>do you mean to put the above 4 lines in my c++ code but with out the
>>/*, *, */? since they are for commenting?
> 
> 
> The local variables section should be commented, since it is not part
> of your source code.  So, do not remove the comment delimiters.
> 
> 
>>>(global-set-key [f5] 'compile)
>>>
ok, it works, I put the commented code in my source file and hit f5, it 
asked to save main.cpp and it then

opened another buffer window and compiled it, but did not run the program.
my line in the commented section is
*compile-command: "make && ./proj1"
since proj1 is the target I have in my makefile


> 
> Raghavendra.
> 

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

end of thread, other threads:[~2005-07-20 13:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-18 12:06 compile/run a code from emacs Baloff
2005-07-17 20:01 ` N. Raghavendra
2005-07-19 11:46   ` Baloff
2005-07-19  5:09     ` N. Raghavendra
2005-07-20 13:14       ` Baloff
2005-07-20  8:43         ` N. Raghavendra

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.