emacs-devel
[Top][All Lists]
Advanced

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

catching keyboard-quit from read-char


From: Eric Abrahamsen
Subject: catching keyboard-quit from read-char
Date: Wed, 25 Jul 2018 15:11:04 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

I thought this used to work, but maybe I'm imagining things...

I've got a macro for prompting the user for a value, but catching a
couple of signals and returning nil in those cases. It looks like:

(defmacro ebdb-with-exit (&rest body)
  "Execute BODY, returning nil on quit or an empty value."
  `(condition-case-unless-debug nil
       ,@body
     ((quit ebdb-empty)
      nil)))

It works for `read-string', but not `read-char':

(ebdb-with-exit (read-string "String: ")) ; C-g returns nil
(ebdb-with-exit (read-char "Character: ")) ; C-g raises an error

I thought this used to work, but maybe I'm mis-remembering. Is there
anything I can do to get this to behave the way I want it to? (Ie,
returning nil).

Thanks,
Eric




reply via email to

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