Emacs (recompile -y)

Is it possible to pass the -yes flag to the recompile command in emacs?

Sorry my complete lack of (e) lisp know-how. I'm tired of going beyond Emacs to compile my latex code, so I added the following key binding to my .emacs:

(global-set-key (kbd "<f12>") 'recompile); 

Is it possible to automatically answer β€œyes” to the following prompt, which may appear: β€œThe compilation process is running, kill it (yes or no)”.

In addition, you can open the window that will be displayed and display the output for automatic scrolling down. Interesting stuff is usually there. Perhaps it is possible to link the following command after recompilation: "Cx o, end of buffer".

Thanks!

+7
emacs elisp
source share
4 answers

Here is some code to solve your first problem (interrupting the current compilation):

 (defun interrupt-and-recompile () "Interrupt old compilation, if any, and recompile." (interactive) (ignore-errors (kill-compilation)) (recompile)) 

For your second problem (scrolling compilation output), just configure the custom parameter compilation-scroll-output .

+7
source share

I need to somehow put the kill compilation into ignore-errors with Emacs 23.2 to make it work when no process is running. Otherwise, it works great.

 (defun interrupt-and-recompile () "Interrupt old compilation, if any, and recompile." (interactive) (ignore-errors (kill-compilation)) (recompile) ) 
+2
source share

Whenever I tried to use kill-compilation with latex / pdflatex, it did not work. I assume this is because latex does not respond to SIGINT.

Instead, I use the following hack, which first sets the process-kill-without-query compilation -buffer bit and then closes it (which kills the running process).

 (defun interrupt-and-recompile () "Interrupt old compilation, if any, and recompile." (interactive) (ignore-errors (process-kill-without-query (get-buffer-process (get-buffer "*compilation*")))) (ignore-errors (kill-buffer "*compilation*")) (recompile) ) 
+2
source share

Other solutions did not work for me for the same reason as sfeuz, but I did not like the nuclear option of destroying a hard-coded buffer by name.

Here's a short solution that automatically passes this specific question by saying yes-or-no-p:

ftp://download.tuxfamily.org/user42/compilation-always-kill.el

(source: http://www.emacswiki.org/CompilationMode )

0
source share

All Articles