From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Kangas <stefankangas@gmail.com>,
Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 73584@debbugs.gnu.org, Emacs-hacker2023@jovi.net
Subject: bug#73584: 29.3; read-key
Date: Thu, 03 Oct 2024 09:04:27 +0300 [thread overview]
Message-ID: <86v7y9zpqs.fsf@gnu.org> (raw)
In-Reply-To: <CADwFkmk4jOD7Z6R_iETQJENgAcZB40ZXuDZhbBX78j4a41Surg@mail.gmail.com> (message from Stefan Kangas on Wed, 2 Oct 2024 21:47:19 +0000)
> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Wed, 2 Oct 2024 21:47:19 +0000
> Cc: Emacs-hacker2023@jovi.net, 73584@debbugs.gnu.org
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> From: Stefan Kangas <stefankangas@gmail.com>
> >> Date: Wed, 2 Oct 2024 10:02:44 +0000
> >> Cc: 73584@debbugs.gnu.org
> >>
> >> It would arguably be a bit nicer to signal the error early to avoid
> >> having to mash C-[:
> >
> > Maybe. But what exactly is wrong with signaling the error from
> > read-key-sequence-vector, which read-key calls?
>
> I just observe that I have to mash C-[ to get back control of Emacs, and
> that it would probably have been better if I didn't have to. I imagine
> situations when this happens because of a bug in some library, and users
> won't know what to do in that situation. It clearly confused OP.
The OP shot himself in the foot by invoking by hand a low-level
function with a wrong argument. Interactive functions and high-level
APIs must check their arguments right away, but low-level functions
like this one do not.
What I could understand is if we'd arranged for the temporary keymap
to stop being in effect even inside the debugger. Because the
scenario of this bug reveals some more general issue: when we signal
an error from a function that sets up some limited keymap, the
debugger is invoked with that keymap still in effect, or so it seems.
Stefan Monnier, do we have a good way of doing that in cases like
this? Perhaps the debugger should define some minimal key bindings
when it starts or something?
> I meant to ask if we have something similar to `cl-check-type' that does
> not come from cl-lib.el. I'm asking that precisely because we can't use
> cl-lib in subr.el.
Sorry, my misunderstanding.
> It would have been convenient if we had something like:
>
> (defmacro check-type (form predicate)
> `(unless (,predicate form)
> (signal 'wrong-type-argument (list ,predicate form))))
>
> We have this pattern in quite a few places in our code, so maybe we
> should consider adding it if we don't have it already.
If we want something like this, I think we should support a list of
allowed types, not just one type.
next prev parent reply other threads:[~2024-10-03 6:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-01 18:21 bug#73584: 29.3; read-key Devon Sean McCullough
2024-10-02 5:58 ` Eli Zaretskii
2024-10-02 10:02 ` Stefan Kangas
2024-10-02 10:50 ` Eli Zaretskii
2024-10-02 21:47 ` Stefan Kangas
2024-10-03 6:04 ` Eli Zaretskii [this message]
2024-10-03 15:43 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-13 11:41 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86v7y9zpqs.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=73584@debbugs.gnu.org \
--cc=Emacs-hacker2023@jovi.net \
--cc=monnier@iro.umontreal.ca \
--cc=stefankangas@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).