emacs-devel
[Top][All Lists]
Advanced

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

Problem with `while-no-input'


From: klaus.berndl
Subject: Problem with `while-no-input'
Date: Wed, 8 Mar 2006 12:34:57 +0100

Hello,

A question to `while-no-input':

I tried this short test-code:

(defun klaus-test-input ()
  (interactive)
  (let ((result nil)
        (i 0))
    (setq result (while-no-input
                   (while t
                     (setq i (1+ i)))))
    (message "Klaus: %s" result)))

I expected this to being interrupted by any user-interaction (e.g. keypress 
etc..)
and setting result to t according to the docstring of `while-no-input':

   while-no-input is a Lisp macro in `subr.el'.
   (while-no-input &rest body)

   Execute body only as long as there's no pending input.
   If input arrives, that ends the execution of body,
   and `while-no-input' returns t.  Quitting makes it return nil.
   If body finishes, `while-no-input' returns whatever value body produced.

But only C-g interrupts this code but not pressing any key like 'a' etc...

Have i overlooked something or have i misunderstood the documentation of
`while-no-input'? Have i misinterpreted the sentence "If input arrives,
that ends the execution of body, and `while-no-input' returns t" or what
I'm doing wrong?

Thanks for your help!

I tried this with Emacs 22.0.50.1 compiled on 29.1.2006 for Windows....

Ciao,
Klaus




reply via email to

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