From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#73584: 29.3; read-key Date: Wed, 2 Oct 2024 21:47:19 +0000 Message-ID: References: <56f7ea1fff72be793a8026baf34e1548@jovi.net> <86v7yb11wc.fsf@gnu.org> <86h69u22y8.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2756"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73584@debbugs.gnu.org, Emacs-hacker2023@jovi.net To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 02 23:49:27 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sw7Dr-0000XQ-6N for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 02 Oct 2024 23:49:27 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sw7DS-0001EG-MI; Wed, 02 Oct 2024 17:49:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sw7DR-0001E0-CH for bug-gnu-emacs@gnu.org; Wed, 02 Oct 2024 17:49:01 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sw7DR-0000IB-3y for bug-gnu-emacs@gnu.org; Wed, 02 Oct 2024 17:49:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:MIME-Version:References:In-Reply-To:From:To:Subject; bh=IyvaabRCidKmMnhyeQfAfP8sLxy4cDChtlyxRSiYiSs=; b=o3IxgmJH6WXR4D7XL1EXQIiFLosD/Q6398AfGLwicWz0KDBhzIPcAtW7E1JdAdwy/QLPxTwqKkBJmrenTBA91qD8xkxhVNT3wwn+1rG/V2HQzWJgN1XkdhNMZ4a11tshcUk6gUquy4xDo9dFA8mqr2697uTbOjUgeKo6X9OqER5KoVO4Af01t/+qzwJMWwMF2vgV+zO/IWOveIWwiwfYiasVoql/GbJcoIzJx/uy1jiT9qZMj3/KUPijCvDdLTUY/1G2DDl1s84o2eqQXTFFwnvcs+3Wc7ZTKmEWNGx0MxwEl9f4JZfNtl0rbPcLyVRMDChWG9Hu4DWOPkcjtorZVw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sw7DR-0003S9-QM for bug-gnu-emacs@gnu.org; Wed, 02 Oct 2024 17:49:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Oct 2024 21:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73584 X-GNU-PR-Package: emacs Original-Received: via spool by 73584-submit@debbugs.gnu.org id=B73584.172790570913233 (code B ref 73584); Wed, 02 Oct 2024 21:49:01 +0000 Original-Received: (at 73584) by debbugs.gnu.org; 2 Oct 2024 21:48:29 +0000 Original-Received: from localhost ([127.0.0.1]:59418 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sw7Cv-0003RN-Fi for submit@debbugs.gnu.org; Wed, 02 Oct 2024 17:48:29 -0400 Original-Received: from mail-ed1-f42.google.com ([209.85.208.42]:44395) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sw7Ct-0003R5-2C for 73584@debbugs.gnu.org; Wed, 02 Oct 2024 17:48:27 -0400 Original-Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5c8784e3bc8so226152a12.1 for <73584@debbugs.gnu.org>; Wed, 02 Oct 2024 14:48:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727905640; x=1728510440; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=IyvaabRCidKmMnhyeQfAfP8sLxy4cDChtlyxRSiYiSs=; b=HqXjKiPswPePBJSr/6TlgGGc3CLABVSoW3Mg4G1Y9KYUzsHLFDesUlZOBvPsiZhC1P qYTD/7MYjlHTXu1TjgIafpPpjlxcCgEGFVgkNM62B7RLtjYabE0IvHKVEDJVQc6Jw7PL /Hnmu3ryxtd6YaloSOQIOmcUoH4Pj6J0h4lHf/zzIfSPqzEFqJR1V8adNY3Joh/Y4KJo BRExYWhpLuZwWAk19F8ghfZuO+Mobs+DYVrw+gulCnlu9oF0gDR5IfnKbSTC6yv3r7Ws gbuwcE7Xvz7ctzby+EzYHnXNHO9188bi7k/DDtwix+Rn/zUIO0NjIStkhCYgcYNESXS5 fJuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727905640; x=1728510440; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IyvaabRCidKmMnhyeQfAfP8sLxy4cDChtlyxRSiYiSs=; b=YNqZIZcEDjqD3+u/DEqLgDq4rqiHUfM4mpLZRclgXcpE57x2rAE76thfpsUqEG50va tBxlagxEBuwjZqvOrK0ug3mmENNJCBQCaHZsdoYugS6Efvh1GsqSdACSg6S2v8ikQQSq DaoIEexlyhAdABRgJ7wqRBlYkoCAinHL+EpJcNFJ472LUWGX4mKynokzDplAky8NxS7w VGsIePSERBzNvDeGH6bXS/UY9Vxwq07+BlSrZRGnqXJ2RC4fKuKl9q0cbdJsuSi0sC7V tlYWKBGdA1Fby1Zke8e8n/ZHPt80hbK+27HnPgnDpBydjqn6pHTONdKgeKK00zPoSQ0M ot4Q== X-Forwarded-Encrypted: i=1; AJvYcCXhBc+Do+w/CITj8T4JGO0HYi3pTbjLNmDS38rWYs/O/GgK8TF62tEakz9skzlUQEwlL7Fw1A==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyFtnmo0agot5Fx++faT3xwVetdmwJ0UlDkbeL/AvgKwYbhNMk3 iaWEwMWBo/5Zdymod6VjruYSnBt5kX2y54a8vPGAahpPBvEYcbMJwN58P+vFYEMdmEI7oOnblTL r+Pa6dLIGQZyIs6Y8qCVykHyp7j4L+A== X-Google-Smtp-Source: AGHT+IHeTjpZHfYoBbdwKs44Ck0S0hsK0ljFxCHZJCl5+sr/KeLPoGJU/M6lLBg2XVesvhibtUYYMRJDtE5uRedtt7s= X-Received: by 2002:a05:6402:2709:b0:5c5:c447:e4c0 with SMTP id 4fb4d7f45d1cf-5c8b18e0e19mr2554438a12.4.1727905640004; Wed, 02 Oct 2024 14:47:20 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 2 Oct 2024 21:47:19 +0000 In-Reply-To: <86h69u22y8.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292868 Archived-At: Eli Zaretskii writes: >> From: Stefan Kangas >> 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. >> --- a/lisp/subr.el >> +++ b/lisp/subr.el >> @@ -3307,6 +3307,8 @@ read-key >> what you want as `read-key' temporarily removes all bindings >> while calling `read-key-sequence'. If nil or unspecified, the >> only unbound fallback disabled is downcasing of the last event." >> + (or (stringp prompt) >> + (signal 'wrong-type-argument (list 'stringp prompt))) > > This will signal an error if PROMPT is nil or omitted, which we > definitely must support. Thanks, yes. That would have to be amended. >> ;; This overriding-terminal-local-map binding also happens to >> ;; disable quail's input methods, so although read-key-sequence >> ;; always inherits the input method, in practice read-key does not >> >> BTW, do we have something like `cl-check-type' outside of cl-lib? > > We shouldn't use any cl stuff in subr.el, surely? 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. 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.