jed-users mailing list

[2010 Date Index] [2010 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [Jed-users-l] Compile and run


Swithun Crowe <swithun@xxxxxxxxxxxxxxxxxxxxx> wrote:
> Here is a function that does what you want. It gets information about the 
> buffer (file name and directory), creates a command string, and runs that 
> command sending the output to a new buffer and then displays the buffer.
>
> define compile_and_run () 
>{
> 	 % declare variables
> 	 variable FORMAT = "cd %s && gcc -o %s %s && ./%s";
> 	 variable filename, exe, dir, cmd, buffer;
>
> 	 % get file info and create command string
> 	 (filename, dir, , ) = getbuf_info ();
> 	 exe = path_basename_sans_extname (filename);
> 	 buffer = exe + "_output";
> 	 cmd = sprintf (FORMAT, dir, exe, filename, exe);

It might be more useful to replace the following lines

> 	 % set output buffer, run command and move to that buffer
> 	 setbuf (buffer);
> 	 run_shell_cmd (cmd);
> 	 pop2buf (buffer);
>}

by

         compile(cmd);

This will execute the command in an external process and allow you to
step through any compilation errors.  The compile function is defined
in "acompile.sl".

Thanks,
--John

_______________________________________________
Jed-users-l mailing list
Jed-users-l@xxxxxxxx
http://mailman.jtan.com/mailman/listinfo/jed-users-l


[2010 date index] [2010 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]