[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compilation-ask-about-kill

From: Kevin Ryde
Subject: Re: compilation-ask-about-kill
Date: Sat, 09 Jan 2010 11:09:57 +1100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)

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.

(defun yes-or-no-condition-p (prompt condfunc)
  (let ((result (if (funcall condfunc)
    (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))
               (message "Please answer yes or no.")
               (sleep-for 2)))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]