- Subject: Re: [Jed-users-l] Compile and run
- From: Swithun Crowe <swithun@xxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 24 Aug 2010 10:28:43 +0100 (BST)
Hello
GH> Yes, but I still have to type the "gcc filename.c -o filename &&
GH> ./filename" manually. Is there a way for Jed to automatically recongise the
GH> file that I have open and do the compile&run automatically?
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);
% set output buffer, run command and move to that buffer
setbuf (buffer);
run_shell_cmd (cmd);
pop2buf (buffer);
}
Swithun.
_______________________________________________
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]