From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.devel Subject: Re: compilation-ask-about-kill Date: Sat, 09 Jan 2010 11:09:57 +1100 Organization: Bah Humbug Message-ID: <873a2gdtpm.fsf@blah.blah> References: <87d41n58yw.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1262995842 8254 80.91.229.12 (9 Jan 2010 00:10:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Jan 2010 00:10:42 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 09 01:10:35 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NTOuX-0008EL-2x for ged-emacs-devel@m.gmane.org; Sat, 09 Jan 2010 01:10:33 +0100 Original-Received: from localhost ([127.0.0.1]:55806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NTOuX-0006dc-Gg for ged-emacs-devel@m.gmane.org; Fri, 08 Jan 2010 19:10:33 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NTOuR-0006cT-VM for emacs-devel@gnu.org; Fri, 08 Jan 2010 19:10:27 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NTOuM-0006aA-TZ for emacs-devel@gnu.org; Fri, 08 Jan 2010 19:10:27 -0500 Original-Received: from [199.232.76.173] (port=45844 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NTOuM-0006a4-Q9 for emacs-devel@gnu.org; Fri, 08 Jan 2010 19:10:22 -0500 Original-Received: from mailout2-2.pacific.net.au ([61.8.2.225]:36555 helo=mailout2.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NTOuL-0000K4-Vz for emacs-devel@gnu.org; Fri, 08 Jan 2010 19:10:22 -0500 Original-Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.2.162]) by mailout2.pacific.net.au (Postfix) with ESMTP id 58C7A1AAEE7 for ; Sat, 9 Jan 2010 11:10:15 +1100 (EST) Original-Received: from blah.blah (ppp2E37.dyn.pacific.net.au [61.8.46.55]) by mailproxy1.pacific.net.au (Postfix) with ESMTP id B247B8C09 for ; Sat, 9 Jan 2010 11:10:14 +1100 (EST) Original-Received: from gg by blah.blah with local (Exim 4.71) (envelope-from ) id 1NTOty-0004bt-Ls for emacs-devel@gnu.org; Sat, 09 Jan 2010 11:09:58 +1100 In-Reply-To: <87d41n58yw.fsf@mail.jurta.org> (Juri Linkov's message of "Wed, 06 Jan 2010 22:28:23 +0200") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:119744 Archived-At: 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))