all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Ryde <user42@zip.com.au>
To: emacs-devel@gnu.org
Subject: Re: compilation-ask-about-kill
Date: Sat, 09 Jan 2010 11:09:57 +1100	[thread overview]
Message-ID: <873a2gdtpm.fsf@blah.blah> (raw)
In-Reply-To: <87d41n58yw.fsf@mail.jurta.org> (Juri Linkov's message of "Wed, 06 Jan 2010 22:28:23 +0200")

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))




  reply	other threads:[~2010-01-09  0:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Kevin Ryde [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=873a2gdtpm.fsf@blah.blah \
    --to=user42@zip.com.au \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.