|
From: | Spencer Baugh |
Subject: | Re: unwind-protect within while-no-input |
Date: | Wed, 08 May 2024 09:44:20 -0400 |
User-agent: | Gnus/5.13 (Gnus v5.13) |
Michael Heerdegen via "Emacs development discussions." <emacs-devel@gnu.org> writes: > Michael Heerdegen via "Emacs development discussions." > <emacs-devel@gnu.org> writes: > >> `unwind-protect' works as expected: >> >> #+begin_src emacs-lisp >> (let (foo) >> (while-no-input >> (unwind-protect (while t nil) >> (setq foo 'interrupted))) >> (message "foo: %s" foo)) >> #+end_src > > Note the unwind forms are executed even if you quit: > > #+begin_src emacs-lisp > (let (foo) > (while-no-input > (unwind-protect (while t nil) > (setq foo 'interrupted) > (message "foo: %s" foo))) > (message "foo: %s" foo)) > #+end_src > > Am I'm missing something? > > Michael. Yes: it doesn't actually work. Try this: (let (foo) (while-no-input (unwind-protect (while t nil) (sleep-for 10) (setq foo 'interrupted) (message "foo: %s" foo))) (message "foo: %s" foo)) C-x C-e aaaa Output: foo: nil
[Prev in Thread] | Current Thread | [Next in Thread] |