unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* compilation-ask-about-kill
@ 2006-05-04 10:20 Alexander Klimov
  2006-05-04 14:22 ` compilation-ask-about-kill Burton Samograd
  2006-05-04 19:42 ` compilation-ask-about-kill Richard Stallman
  0 siblings, 2 replies; 14+ messages in thread
From: Alexander Klimov @ 2006-05-04 10:20 UTC (permalink / raw)


Hi.

It would be nice to allow recompilation with a single key stroke even
if the previous compilation hangs. With the following patch the user
can skip

 `A %... process is running; kill it?'

if he set `compilation-ask-about-kill' to nil.

--- compile.el.old      2006-05-04 13:07:12.685252800 +0200
+++ compile.el  2006-05-04 13:09:52.620011800 +0200
@@ -429,6 +429,13 @@
   :group 'compilation)

 ;;;###autoload
+(defcustom compilation-ask-about-kill t
+  "*Non-nil means \\[compile] asks permission to kill the running
compilation.
+Otherwise, it kills the previous compilation process  without
asking."
+  :type 'boolean
+  :group 'compilation)
+
+;;;###autoload
 (defcustom compilation-search-path '(nil)
   "*List of directories to search for source files named in error
messages.
 Elements should be directory names, not file names of directories.
@@ -970,9 +977,10 @@
       (let ((comp-proc (get-buffer-process (current-buffer))))
        (if comp-proc
            (if (or (not (eq (process-status comp-proc) 'run))
-                   (yes-or-no-p
-                    (format "A %s process is running; kill it? "
-                            name-of-mode)))
+                (or (not compilation-ask-about-kill)
+                    (yes-or-no-p
+                     (format "A %s process is running; kill it? "
+                             name-of-mode))))
                (condition-case ()
                    (progn
                      (interrupt-process comp-proc)

-- 
Regards,
ASK

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: compilation-ask-about-kill
  2006-05-04 10:20 compilation-ask-about-kill Alexander Klimov
@ 2006-05-04 14:22 ` Burton Samograd
  2006-05-04 19:42 ` compilation-ask-about-kill Richard Stallman
  1 sibling, 0 replies; 14+ messages in thread
From: Burton Samograd @ 2006-05-04 14:22 UTC (permalink / raw)


Alexander Klimov <alserkli@inbox.ru> writes:

> Hi.
>
> It would be nice to allow recompilation with a single key stroke even
> if the previous compilation hangs. With the following patch the user
> can skip
>
>  `A %... process is running; kill it?'
>
> if he set `compilation-ask-about-kill' to nil.

Agreed.  I was going to add this myself.

-- 
burton samograd					kruhft .at. gmail
kruhft.blogspot.com	www.myspace.com/kruhft	metashell.blogspot.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: compilation-ask-about-kill
  2006-05-04 10:20 compilation-ask-about-kill Alexander Klimov
  2006-05-04 14:22 ` compilation-ask-about-kill Burton Samograd
@ 2006-05-04 19:42 ` Richard Stallman
  1 sibling, 0 replies; 14+ messages in thread
From: Richard Stallman @ 2006-05-04 19:42 UTC (permalink / raw)
  Cc: emacs-devel

This is not an essential change, so we should not think about it now.
We can think about this after the release.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* compilation-ask-about-kill
@ 2010-01-05 14:46 Alexander Klimov
  2010-01-05 22:28 ` compilation-ask-about-kill Kevin Ryde
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Alexander Klimov @ 2010-01-05 14:46 UTC (permalink / raw)
  To: emacs-devel

Hi.

It would be nice to allow recompilation with a single key stroke even
if the previous compilation hangs. With the following patch the user
can skip

 `A ... process is running; kill it?'

if he set `compilation-ask-about-kill' to nil.

On 2006-05-04, Richard Stallman wrote:
> This is not an essential change, so we should not think about it
> now. We can think about this after the release.

Probably, enough time has passed since 2006 :-) The following patch is
adapted for the current version:

*** compile.el.~1~      2010-01-05 16:22:55.983074000 +0200
--- compile.el  2010-01-05 16:25:53.882071000 +0200
***************
*** 580,583 ****
--- 580,590 ----

  ;;;###autoload
+ (defcustom compilation-ask-about-kill t
+   "Non-nil means \\[compile] asks permission to kill the running compilation.
+ Otherwise, it kills the previous compilation process without asking."
+   :type 'boolean
+   :group 'compilation)
+
+ ;;;###autoload
  (defcustom compilation-search-path '(nil)
    "List of directories to search for source files named in error messages.
***************
*** 1193,1199 ****
        (if comp-proc
            (if (or (not (eq (process-status comp-proc) 'run))
!                   (yes-or-no-p
!                    (format "A %s process is running; kill it? "
!                            name-of-mode)))
                (condition-case ()
                    (progn
--- 1200,1207 ----
        (if comp-proc
            (if (or (not (eq (process-status comp-proc) 'run))
!                 (or (not compilation-ask-about-kill)
!                     (yes-or-no-p
!                      (format "A %s process is running; kill it? "
!                              name-of-mode))))
                (condition-case ()
                    (progn

-- 
Regards,
ASK




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: compilation-ask-about-kill
  2010-01-05 14:46 compilation-ask-about-kill Alexander Klimov
@ 2010-01-05 22:28 ` Kevin Ryde
  2010-01-06  7:36 ` compilation-ask-about-kill Alexander Klimov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Kevin Ryde @ 2010-01-05 22:28 UTC (permalink / raw)
  To: emacs-devel

Alexander Klimov <alserkli@inbox.ru> writes:
>
> It would be nice to allow recompilation with a single key stroke even
> if the previous compilation hangs.

As a bit of shameless self-promotion, I made my
compilation-always-kill.el for that and found it pretty good.

  http://user42.tuxfamily.org/compilation-always-kill/index.html

If I want to protect a compile from killing that way then I rename the
buffer in the usual way.

I've found it best to kill only an M-x compile though, and leave
M-x grep and other compile-derived things to ask yes-or-no.  A grep is
normally far shorter than a compile so a question for it doesn't come up
often.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: compilation-ask-about-kill
  2010-01-05 14:46 compilation-ask-about-kill Alexander Klimov
  2010-01-05 22:28 ` compilation-ask-about-kill Kevin Ryde
@ 2010-01-06  7:36 ` Alexander Klimov
  2010-01-06 20:28 ` compilation-ask-about-kill Juri Linkov
  2010-01-11 21:57 ` compilation-ask-about-kill Juri Linkov
  3 siblings, 0 replies; 14+ messages in thread
From: Alexander Klimov @ 2010-01-06  7:36 UTC (permalink / raw)
  To: emacs-devel

On Wed, 06 Jan 2010, Kevin Ryde wrote:
> I made my compilation-always-kill.el for that and found it pretty
> good.

defadvice yes-or-no-p is really ingenious, but IMO adding a line to
compilation-start is a cleaner solution.

-- 
Regards,
ASK




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: compilation-ask-about-kill
  2010-01-05 14:46 compilation-ask-about-kill Alexander Klimov
  2010-01-05 22:28 ` compilation-ask-about-kill Kevin Ryde
  2010-01-06  7:36 ` compilation-ask-about-kill Alexander Klimov
@ 2010-01-06 20:28 ` Juri Linkov
  2010-01-09  0:09   ` compilation-ask-about-kill Kevin Ryde
  2010-01-11 21:57 ` compilation-ask-about-kill Juri Linkov
  3 siblings, 1 reply; 14+ messages in thread
From: Juri Linkov @ 2010-01-06 20:28 UTC (permalink / raw)
  To: Alexander Klimov; +Cc: emacs-devel

> It would be nice to allow recompilation with a single key stroke even
> if the previous compilation hangs. With the following patch the user
> can skip
>
>  `A ... process is running; kill it?'

I think we should have a common option for `compile' and
`async-shell-command' that asks exactly the same question.
Another possible value should also allow to automatically rename
an existing output buffer with a running command without asking.

-- 
Juri Linkov
http://www.jurta.org/emacs/




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: compilation-ask-about-kill
  2010-01-06 20:28 ` compilation-ask-about-kill Juri Linkov
@ 2010-01-09  0:09   ` Kevin Ryde
  2010-01-09 17:54     ` compilation-ask-about-kill Juri Linkov
  2010-01-09 18:10     ` compilation-ask-about-kill David Kastrup
  0 siblings, 2 replies; 14+ messages in thread
From: Kevin Ryde @ 2010-01-09  0:09 UTC (permalink / raw)
  To: emacs-devel

A related thing I've found a bit silly is that the yes-or-no-p insists
on you answering yes or no to "kill compile?" if the compile finishes
while you're thinking about the question.

For example if the compile is in a visible window you may wait at that
question while it finishes.  It'd be cute if you could just press Ret in
that case.  I had in mind a yes-or-no-p variant with a condition
function or something to say when the question is no longer relevant, so
that no input, or any input, or whatnot, is acceptable.


;; UNTESTED!
;;
(defun yes-or-no-condition-p (prompt condfunc)
  (let ((result (if (funcall condfunc)
                    'again
                  'n/a)))
    (while (eq result 'again)
      (let ((answer (downcase (read-from-minibuffer
                               prompt nil nil nil yes-or-no-p-history
                               nil nil))))
        (cond ((equal answer "yes")
               (setq result t))
              ((equal answer "no")
               (setq result nil))
              ((not (funcall condfunc))
               (setq result 'n/a))
              (t
               (ding)
               (discard-input)
               (message "Please answer yes or no.")
               (sleep-for 2)))))
    result))




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: compilation-ask-about-kill
  2010-01-09  0:09   ` compilation-ask-about-kill Kevin Ryde
@ 2010-01-09 17:54     ` Juri Linkov
  2010-01-09 18:10     ` compilation-ask-about-kill David Kastrup
  1 sibling, 0 replies; 14+ messages in thread
From: Juri Linkov @ 2010-01-09 17:54 UTC (permalink / raw)
  To: Kevin Ryde; +Cc: emacs-devel

> A related thing I've found a bit silly is that the yes-or-no-p insists
> on you answering yes or no to "kill compile?" if the compile finishes
> while you're thinking about the question.

When the question becomes meaningless, the correct answer is "mu" :)

http://en.wikipedia.org/wiki/Mu_(negative)

-- 
Juri Linkov
http://www.jurta.org/emacs/




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: compilation-ask-about-kill
  2010-01-09  0:09   ` compilation-ask-about-kill Kevin Ryde
  2010-01-09 17:54     ` compilation-ask-about-kill Juri Linkov
@ 2010-01-09 18:10     ` David Kastrup
  2010-01-10 23:02       ` compilation-ask-about-kill Kevin Ryde
  1 sibling, 1 reply; 14+ messages in thread
From: David Kastrup @ 2010-01-09 18:10 UTC (permalink / raw)
  To: emacs-devel

Kevin Ryde <user42@zip.com.au> writes:

> A related thing I've found a bit silly is that the yes-or-no-p insists
> on you answering yes or no to "kill compile?" if the compile finishes
> while you're thinking about the question.
>
> For example if the compile is in a visible window you may wait at that
> question while it finishes.  It'd be cute if you could just press Ret
> in that case.  I had in mind a yes-or-no-p variant with a condition
> function or something to say when the question is no longer relevant,
> so that no input, or any input, or whatnot, is acceptable.

The question is relevant.  If you answer "yes", the new compile will
proceed.  If you answer "no", the new compile will be aborted.

So if you started the new compile command too early, you have to answer
"yes" to the "kill compile?" question in order not to kill your new
compile.

AUCTeX has had similar behavior.  But nowadays it discards the answer
(while still waiting for it) and proceeds anyway in case that the
question became irrelevant by the process finishing.

-- 
David Kastrup





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: compilation-ask-about-kill
  2010-01-09 18:10     ` compilation-ask-about-kill David Kastrup
@ 2010-01-10 23:02       ` Kevin Ryde
  0 siblings, 0 replies; 14+ messages in thread
From: Kevin Ryde @ 2010-01-10 23:02 UTC (permalink / raw)
  To: emacs-devel

David Kastrup <dak@gnu.org> writes:
>
> If you answer "no", the new compile will be aborted.

Can still have no mean no, but I don't much want to type yes when the
previous compile has finished and therefore a whole fresh M-x compile at
that time wouldn't ask me to say yes.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: compilation-ask-about-kill
  2010-01-05 14:46 compilation-ask-about-kill Alexander Klimov
                   ` (2 preceding siblings ...)
  2010-01-06 20:28 ` compilation-ask-about-kill Juri Linkov
@ 2010-01-11 21:57 ` Juri Linkov
  2010-01-12 11:06   ` compilation-ask-about-kill Alexander Klimov
  2010-01-13 22:01   ` compilation-ask-about-kill Kevin Ryde
  3 siblings, 2 replies; 14+ messages in thread
From: Juri Linkov @ 2010-01-11 21:57 UTC (permalink / raw)
  To: Alexander Klimov; +Cc: emacs-devel

> It would be nice to allow recompilation with a single key stroke even
> if the previous compilation hangs. With the following patch the user
> can skip
>
>  `A ... process is running; kill it?'
>
> if he set `compilation-ask-about-kill' to nil.

Instead of adding a new defcustom, it would be better to use the
existing feature created for this purpose.

As the docstring of `compilation-start-hook' suggests using
the following code when you do not want a question about killing
the compilation:

  (add-hook 'compilation-start-hook
            (lambda (process)
              (set-process-query-on-exit-flag process nil)))

I think a query in `compilation-start' should respect this user setting,
because when the user decides that the running process should be killed
without quering, then it has no difference whether the process is killed
by killing the process buffer with `C-x k'/`C-x C-c', or with running
a new compilation:

=== modified file 'lisp/progmodes/compile.el'
--- lisp/progmodes/compile.el	2010-01-09 21:14:50 +0000
+++ lisp/progmodes/compile.el	2010-01-11 21:56:48 +0000
@@ -1197,6 +1197,7 @@
       (let ((comp-proc (get-buffer-process (current-buffer))))
 	(if comp-proc
 	    (if (or (not (eq (process-status comp-proc) 'run))
+		    (not (process-query-on-exit-flag comp-proc))
 		    (yes-or-no-p
 		     (format "A %s process is running; kill it? "
 			     name-of-mode)))

-- 
Juri Linkov
http://www.jurta.org/emacs/




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: compilation-ask-about-kill
  2010-01-11 21:57 ` compilation-ask-about-kill Juri Linkov
@ 2010-01-12 11:06   ` Alexander Klimov
  2010-01-13 22:01   ` compilation-ask-about-kill Kevin Ryde
  1 sibling, 0 replies; 14+ messages in thread
From: Alexander Klimov @ 2010-01-12 11:06 UTC (permalink / raw)
  To: emacs-devel; +Cc: Juri Linkov

Hi.

On Mon, 11 Jan 2010, Juri Linkov wrote:
> > It would be nice to allow recompilation with a single key stroke even
> > if the previous compilation hangs. With the following patch the user
> > can skip
> >
> >  `A ... process is running; kill it?'
> >
> > if he set `compilation-ask-about-kill' to nil.
>
> Instead of adding a new defcustom, it would be better to use the
> existing feature created for this purpose.
>
> As the docstring of `compilation-start-hook' suggests using
> the following code when you do not want a question about killing
> the compilation:
>
>   (add-hook 'compilation-start-hook
>             (lambda (process)
>               (set-process-query-on-exit-flag process nil)))
>
> I think a query in `compilation-start' should respect this user setting,

I agree that compilation-start should respect this flag, but I am not
sure whether this will allow non-elisp-enabled users to express a wish
that they do not want compilation to ask about kill, whereas defcustom
gives an easy to discover "GUI" access to this commonly-requested
customization.

-- 
Regards,
ASK




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: compilation-ask-about-kill
  2010-01-11 21:57 ` compilation-ask-about-kill Juri Linkov
  2010-01-12 11:06   ` compilation-ask-about-kill Alexander Klimov
@ 2010-01-13 22:01   ` Kevin Ryde
  1 sibling, 0 replies; 14+ messages in thread
From: Kevin Ryde @ 2010-01-13 22:01 UTC (permalink / raw)
  To: emacs-devel

Juri Linkov <juri@jurta.org> writes:
>
> because when the user decides that the running process should be killed
> without quering, then it has no difference whether the process is killed
> by killing the process buffer with `C-x k'/`C-x C-c', or with running
> a new compilation:

That's not what I've preferred.  My spot of code deliberately kills on a
fresh M-x compile but leaves the query-on-exit still true.  An
M-x compile is like a "redo this", where kill-emacs is more like "I'm
finished for the day" and I quite like being reminded there's still
stuff in progress in the latter case.




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-01-13 22:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-05 14:46 compilation-ask-about-kill Alexander Klimov
2010-01-05 22:28 ` compilation-ask-about-kill Kevin Ryde
2010-01-06  7:36 ` compilation-ask-about-kill Alexander Klimov
2010-01-06 20:28 ` compilation-ask-about-kill Juri Linkov
2010-01-09  0:09   ` compilation-ask-about-kill Kevin Ryde
2010-01-09 17:54     ` compilation-ask-about-kill Juri Linkov
2010-01-09 18:10     ` compilation-ask-about-kill David Kastrup
2010-01-10 23:02       ` compilation-ask-about-kill Kevin Ryde
2010-01-11 21:57 ` compilation-ask-about-kill Juri Linkov
2010-01-12 11:06   ` compilation-ask-about-kill Alexander Klimov
2010-01-13 22:01   ` compilation-ask-about-kill Kevin Ryde
  -- strict thread matches above, loose matches on Subject: below --
2006-05-04 10:20 compilation-ask-about-kill Alexander Klimov
2006-05-04 14:22 ` compilation-ask-about-kill Burton Samograd
2006-05-04 19:42 ` compilation-ask-about-kill Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).