[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12288: 24.2.50; compilation-start: Query for killing existing compil
From: |
Martin Blais |
Subject: |
bug#12288: 24.2.50; compilation-start: Query for killing existing compilation process only if query-on-exit-flag is non-nil |
Date: |
Tue, 04 Sep 2012 21:50:58 -0400 |
Salut Stef,
Here is a new patch for compile.el that has the change as described by
Christopher. "compilation-always-kill" is consulted to initialize the
process-query-on-exit-flag when creating a new process, and the
process flag is examined when deciding to query to kill the running
process or not.
=== modified file 'lisp/progmodes/compile.el'
*** lisp/progmodes/compile.el 2012-08-30 08:22:24 +0000
--- lisp/progmodes/compile.el 2012-09-04 18:38:00 +0000
***************
*** 1544,1550 ****
(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)))
--- 1544,1550 ----
(let ((comp-proc (get-buffer-process (current-buffer))))
(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)))
***************
*** 1663,1668 ****
--- 1663,1675 ----
;; 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
On Sat, Sep 1, 2012, at 21:21, Christopher Schmidt wrote:
> Martin Blais <blais@furius.ca> writes:
> > On Sat, Sep 1, 2012, at 11:29, Christopher Schmidt wrote:
> >> Those processes that have a nil query-on-exit-flag should be killed
> >> by compilation-start without a yes-or-no query. A buffer-local
> >> non-nil value for compilation-always-kill allows me to achieve that.
> >>
> >> I still think a check for query-on-exit-flag in compilation-start is
> >> a good idea. Non-nil query-on-exit-flag and non-nil buffer-local
> >> compilation-always-kill feels redundant, doesn't it?
> >
> > Maybe what we should do is this (just an idea, not sure if it'll make
> > sense to you):
> >
> > 1. Make the compile code check the process-query-on-exit-flag instead
> > of the compilation-always-kill variable. This would simplify matters,
> > in that there's a single flag that decides whether to kill the running
> > process, and it's the same flag that's already being used for when you
> > kill a buffer. One thing.
> >
> > 2. Provide a way to set the default value of
> > process-query-on-exit-flag on compile subprocesses easier than the
> > hook/comment. Suppressing the ask on recompile is a very common desire
> > BTW--some people have packages to do just that--and IMO being able to
> > customize this via a dedicated variable is valuable.
> >
> > What do you think?
>
> This is IMO a lot more intuitive than having a variable that
> unconditionally removes the prompt. I'd go for it.
>
> Christopher