Compile-n-run in jed

In jed’s maling-list someone asked about how to compile and run from it without leave it. (Most of GUI IDEs do it.)
And you can automaticed it with a function that gets information about the buffer in which you are, runs the command and displays it on new 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);

Made it with charm and jed from a rxvt-unicode terminal.


Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Cerrar sesión /  Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )

Conectando a %s

A %d blogueros les gusta esto: