From: Martin Blais Date: Tue, 18 Sep 2012 04:18:36 +0000 (-0400) Subject: * lisp/progmodes/compile.el (compilation-start): Use compilation-always-kill X-Git-Tag: emacs-24.2.90~269^2~42 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a11035b8cd0ef80bc118cc97be53373b36475da0;p=emacs.git * lisp/progmodes/compile.el (compilation-start): Use compilation-always-kill to initialize query-on-exit; then test that instead. Fixes: debbugs:12288 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7ceacc5291d..c1c9e5ee1c8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-09-18 Martin Blais (tiny change) + + * progmodes/compile.el (compilation-start): Use compilation-always-kill + to initialize query-on-exit; then test that instead (bug#12288). + 2012-09-17 Stefan Merten * rst.el: Add support for `testcover'. @@ -1702,7 +1707,7 @@ :local as the address. (list-processes): Doc fix. -2012-08-04 Michal Nazarewicz (tiny change) +2012-08-04 Michal Nazarewicz * lisp/mpc.el: Support password in host argument. (mpc--proc-connect): Parse and use new password element. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index f5dedf0cd59..95b8758ba80 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1556,20 +1556,20 @@ Returns the compilation buffer created." (get-buffer-create (compilation-buffer-name name-of-mode mode name-function))) (let ((comp-proc (get-buffer-process (current-buffer)))) - (if comp-proc - (if (or (not (eq (process-status comp-proc) 'run)) - compilation-always-kill - (yes-or-no-p - (format "A %s process is running; kill it? " - name-of-mode))) - (condition-case () - (progn - (interrupt-process comp-proc) - (sit-for 1) - (delete-process comp-proc)) - (error nil)) - (error "Cannot have two processes in `%s' at once" - (buffer-name))))) + (if comp-proc + (if (or (not (eq (process-status comp-proc) 'run)) + (eq (process-query-on-exit-flag comp-proc) nil) + (yes-or-no-p + (format "A %s process is running; kill it? " + name-of-mode))) + (condition-case () + (progn + (interrupt-process comp-proc) + (sit-for 1) + (delete-process comp-proc)) + (error nil)) + (error "Cannot have two processes in `%s' at once" + (buffer-name))))) ;; first transfer directory from where M-x compile was called (setq default-directory thisdir) ;; Make compilation buffer read-only. The filter can still write it. @@ -1624,7 +1624,7 @@ Returns the compilation buffer created." (let ((process-environment (append compilation-environment - (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning + (if (if (boundp 'system-uses-terminfo);`If' for compiler warning. system-uses-terminfo) (list "TERM=dumb" "TERMCAP=" (format "COLUMNS=%d" (window-width))) @@ -1674,13 +1674,20 @@ Returns the compilation buffer created." nil `("-c" ,command)))) (start-file-process-shell-command (downcase mode-name) outbuf command)))) - ;; Make the buffer's mode line show process state. - (setq mode-line-process - '(:propertize ":%s" face compilation-mode-line-run)) - (set-process-sentinel proc 'compilation-sentinel) - (unless (eq mode t) - ;; Keep the comint filter, since it's needed for proper handling - ;; of the prompts. + ;; Make the buffer's mode line show process state. + (setq mode-line-process + '(:propertize ":%s" face compilation-mode-line-run)) + + ;; Set the process as killable without query by default. + ;; This allows us to start a new compilation without + ;; getting prompted. + (when compilation-always-kill + (set-process-query-on-exit-flag proc nil)) + + (set-process-sentinel proc 'compilation-sentinel) + (unless (eq mode t) + ;; Keep the comint filter, since it's needed for proper + ;; handling of the prompts. (set-process-filter proc 'compilation-filter)) ;; Use (point-max) here so that output comes in ;; after the initial text,