GNU bug report logs - #73764
format-kbd-macro returns a key name that keymap-lookup doesn't recognize

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Eduardo Ochs <eduardoochs@HIDDEN>; dated Sat, 12 Oct 2024 04:47:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 73764 <at> debbugs.gnu.org:


Received: (at 73764) by debbugs.gnu.org; 14 Oct 2024 21:57:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 14 17:57:40 2024
Received: from localhost ([127.0.0.1]:45037 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t0T4N-0001S0-P0
	for submit <at> debbugs.gnu.org; Mon, 14 Oct 2024 17:57:40 -0400
Received: from mail-lj1-f169.google.com ([209.85.208.169]:52251)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1t0T4L-0001RY-0b
 for 73764 <at> debbugs.gnu.org; Mon, 14 Oct 2024 17:57:38 -0400
Received: by mail-lj1-f169.google.com with SMTP id
 38308e7fff4ca-2fb51e00c05so17463811fa.0
 for <73764 <at> debbugs.gnu.org>; Mon, 14 Oct 2024 14:57:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1728942979; x=1729547779; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=iQaVkrEAUG3ycFadTzQlzQ8EdTwtvxM8sMKo5p7yluc=;
 b=jezp2Nt3mskex+7MLSp1csabjKci6Y3+P1ARD2RZwrd/uFnqfCbpFAvyxmq6WCh+2V
 8880GuKwICq4tOkiR7PzZ22agAiybvb6vOfgU+xVd/GMTO1DLpn28EjFNlOfmD88dSp6
 WlK8LXrBreiY6+qY0Lamk0/aL55VSevlLZsP4uYVw7OZkTfQF11HRDFc96p87w5QlBTw
 NtvZWmXhE5ED+IXbcWu/qksTwIVI25dezNBr2tI2k1HOSX2xSUy/GFZlml3l/fGEVaCF
 ZGPTOwRluHqmnYpnv5z612dbviNaEdOf1/poLkbnEGYfDc+6A07C3bNsNnxfCud5XA1V
 RtHA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1728942979; x=1729547779;
 h=content-transfer-encoding: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=iQaVkrEAUG3ycFadTzQlzQ8EdTwtvxM8sMKo5p7yluc=;
 b=NwxWUcTlmATJomm3TWeulDKd7/IpnKHvS02nxxj+MCe6n5xaNhfG/zOXGxDXbc4Zj+
 exaX03zBOH56V6RRnVMWG7Im93QoSDnaKWsO4Lapodvo5NY0ufgAwAA689s+dKsda/Nk
 ATTBXOmYksIL81Z+ROwa6hnEfkHihjJPdJIF3PWnBfNkldWlVZmhhaZZ7jTctmR3C8Kt
 mjsPVMCwvbds/hfe78xZH0so5fW1ZWroHSPRpxUJxYYkGO8yejLE3SlXAyCX0781vGx7
 qEakK33xs8nS+wC3yrkmUstBUoUCXudSpHHHP6sMuse3U0EuaBz9Rh55299PmSh33c2p
 3kbg==
X-Gm-Message-State: AOJu0YzzgD3gD0aXPfPaWlNvdd/htnvCWWc56/DUyrPXOtcBQqhRhB2B
 CXxrunln/U3EoTQixR34Z7cwJV49lRKc2+7r6B0mCwDJFlm4aJHGAG1aXIuSCZwet1Q+H1vtAZx
 D7BZbIBs/dYeESJA6R+CQ3ooIoWrngw==
X-Google-Smtp-Source: AGHT+IE2M56CQQOWtgHqt3iy1bRu3yYpK43OuLpfXXHpl8hfkDk9IKf5ynkjBUM0jjnjxWbztsdYkiupmEFuabnrkkk=
X-Received: by 2002:a05:6402:3510:b0:5c9:5aac:c622 with SMTP id
 4fb4d7f45d1cf-5c95ac09918mr17168319a12.5.1728942521905; Mon, 14 Oct 2024
 14:48:41 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Mon, 14 Oct 2024 14:48:41 -0700
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <86ed4islc2.fsf@HIDDEN>
References: <CADs++6jwK14-SNxjbPoRfajnyMKHpJkRk=-zN+hc+8jubWEj5w@HIDDEN>
 <86plo5y902.fsf@HIDDEN> <jwviktxihdb.fsf-monnier+emacs@HIDDEN>
 <8634l1wfqi.fsf@HIDDEN> <87cyk5s7ay.fsf@HIDDEN> <86y12tuz7p.fsf@HIDDEN>
 <87cyk2u3ky.fsf@HIDDEN> <86froysmrw.fsf@HIDDEN> <86ed4islc2.fsf@HIDDEN>
MIME-Version: 1.0
Date: Mon, 14 Oct 2024 14:48:41 -0700
Message-ID: <CADwFkmk-DXL+WMcAbnLd2YcOGbd7RG4oZHtkHTAk-qBLG=Lerg@HIDDEN>
Subject: Re: bug#73764: format-kbd-macro returns a key name that keymap-lookup
 doesn't recognize
To: Eli Zaretskii <eliz@HIDDEN>, rpluim@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 73764
Cc: 73764 <at> debbugs.gnu.org, schwab@HIDDEN, monnier@HIDDEN,
 eduardoochs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

> In any case, there's the more general issue at hand here:
> keymap--check is (at least in this case) unnecessarily restrictive:
> where key-parse will gladly accept and correctly process a key whose
> modifiers are in any order, keymap--check insist on the canonical
> order.  I'm not sure I like this, at least in non-interactive
> functions.

One issue that these new functions tried to resolve was that the old
functions were too lenient.  See, for example, this passage in the
manual, and its docstring:

     The =E2=80=98kbd=E2=80=99 function is very permissive, and will try to=
 return
     something sensible even if the syntax used isn't completely
     conforming.  To check whether the syntax is actually valid, use the
     =E2=80=98key-valid-p=E2=80=99 function.

So this strict behaviour is not by accident, and we should probably
think twice before going back on this design decision.

At least, we should review the old arguments to make sure we don't bring
back any undesired/buggy behaviour that this was supposed to remedy.
I didn't have the time to do that fully, as there are many relevant
threads from around that period, both on emacs-devel and bug-gnu-emacs.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73764; Package emacs. Full text available.

Message received at 73764 <at> debbugs.gnu.org:


Received: (at 73764) by debbugs.gnu.org; 14 Oct 2024 16:53:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 14 12:53:45 2024
Received: from localhost ([127.0.0.1]:42594 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t0OKH-0000j3-Ih
	for submit <at> debbugs.gnu.org; Mon, 14 Oct 2024 12:53:45 -0400
Received: from eggs.gnu.org ([209.51.188.92]:57290)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1t0OKE-0000ig-Qw
 for 73764 <at> debbugs.gnu.org; Mon, 14 Oct 2024 12:53:44 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1t0Nt5-0008NN-H4; Mon, 14 Oct 2024 12:25:48 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=rioOl3oj7nZ0n+QWr9mRucks+KP6qXOYYkGINmHiCSM=; b=KmwSfhZLHH87ksJEsLhb
 ZC3cl57l7AKW2JuDQWyyHIMf1HvuBWWM2nZElOfWg8YkS8tMS3oLwsWOvlSxp2rdZiQoAE5kCMwTM
 BhPulpjajk6Egj9+9UwYhsfLlDK7+Ybh72hwTEmuUYOwRzbyN8zAofttyVRem8hcgeg4U47erZhj1
 +rP6cw/DiCAh4gVrl8gFrzVlRIvrrYVs4fPs/m9071bsHs801F1LInXSTviETl2ZcCGvRIGFLgDci
 AEgwvgYouD7XoS5FK2NM9NijGkpwMeA6h4YX2+RbpxUlWDnVGbWYTBNdcD3KrIKoUju+POAIu2KAZ
 Gvr91MF2S48WmA==;
Date: Mon, 14 Oct 2024 19:25:33 +0300
Message-Id: <86ed4islc2.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: rpluim@HIDDEN
In-Reply-To: <86froysmrw.fsf@HIDDEN> (message from Eli Zaretskii on Mon, 14
 Oct 2024 18:54:27 +0300)
Subject: Re: bug#73764: format-kbd-macro returns a key name that keymap-lookup
 doesn't recognize
References: <CADs++6jwK14-SNxjbPoRfajnyMKHpJkRk=-zN+hc+8jubWEj5w@HIDDEN>
 <86plo5y902.fsf@HIDDEN> <jwviktxihdb.fsf-monnier+emacs@HIDDEN>
 <8634l1wfqi.fsf@HIDDEN> <87cyk5s7ay.fsf@HIDDEN>
 <86y12tuz7p.fsf@HIDDEN> <87cyk2u3ky.fsf@HIDDEN> <86froysmrw.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 73764
Cc: 73764 <at> debbugs.gnu.org, schwab@HIDDEN, monnier@HIDDEN,
 eduardoochs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: 73764 <at> debbugs.gnu.org, schwab@HIDDEN, monnier@HIDDEN,
>  eduardoochs@HIDDEN
> Date: Mon, 14 Oct 2024 18:54:27 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> > From: Robert Pluim <rpluim@HIDDEN>
> > Cc: Andreas Schwab <schwab@HIDDEN>,  73764 <at> debbugs.gnu.org,
> >   monnier@HIDDEN,  eduardoochs@HIDDEN
> > Date: Mon, 14 Oct 2024 17:06:05 +0200
> > 
> > So if format-kbd-macro generates something with 'C-' in the "wrong"
> > place, whatʼs to stop us re-ordering the modifiers as a
> > post-processing step (inside `format-kbd-macro')?
> 
> If that's the only case where we put C- in the wrong place, then
> nothing stops us.  Is it?

In any case, there's the more general issue at hand here:
keymap--check is (at least in this case) unnecessarily restrictive:
where key-parse will gladly accept and correctly process a key whose
modifiers are in any order, keymap--check insist on the canonical
order.  I'm not sure I like this, at least in non-interactive
functions.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73764; Package emacs. Full text available.

Message received at 73764 <at> debbugs.gnu.org:


Received: (at 73764) by debbugs.gnu.org; 14 Oct 2024 15:54:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 14 11:54:58 2024
Received: from localhost ([127.0.0.1]:41077 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t0NPN-0003g3-Tx
	for submit <at> debbugs.gnu.org; Mon, 14 Oct 2024 11:54:58 -0400
Received: from eggs.gnu.org ([209.51.188.92]:33490)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1t0NPK-0003fi-Jf
 for 73764 <at> debbugs.gnu.org; Mon, 14 Oct 2024 11:54:55 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1t0NOx-0004RW-49; Mon, 14 Oct 2024 11:54:31 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=U3lYJmrnpJDDsfpCDJcMtNdPNroED6CacyM5waQFGbE=; b=SuMIcp6HzXUCD22MXYAF
 +TSiRBRXyl0UGIa1zgHgs01siuqSMwz7AQQ9t8x73Hmpe81WcEo9FloHSGIWc5zVXyD++DJzd2nr6
 ZqTw7pw6C/+x3Q15luoUUSb0EwkSPhPcQvAU841HOv5tJAXs4Df+qhfYO4hbpEe2x+8UcQdGsi/Bg
 clyBuchmMBc4AFDLENzomWe0g/oJPi520Vg94MKfwJX/QR649GmvZ5tcictS0rFP4vdSOPbMArns7
 DqXQNMlqKNEdsKeXOf2LyDx/KybnD1RQKstQwYc/MCzgruoHhsuYLHZwzfc1gzSE2p7OmGlL16CdF
 bHZvkTmZ7BRKxg==;
Date: Mon, 14 Oct 2024 18:54:27 +0300
Message-Id: <86froysmrw.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Robert Pluim <rpluim@HIDDEN>
In-Reply-To: <87cyk2u3ky.fsf@HIDDEN> (message from Robert Pluim on Mon, 14
 Oct 2024 17:06:05 +0200)
Subject: Re: bug#73764: format-kbd-macro returns a key name that
 keymap-lookup doesn't recognize
References: <CADs++6jwK14-SNxjbPoRfajnyMKHpJkRk=-zN+hc+8jubWEj5w@HIDDEN>
 <86plo5y902.fsf@HIDDEN> <jwviktxihdb.fsf-monnier+emacs@HIDDEN>
 <8634l1wfqi.fsf@HIDDEN> <87cyk5s7ay.fsf@HIDDEN>
 <86y12tuz7p.fsf@HIDDEN> <87cyk2u3ky.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 73764
Cc: 73764 <at> debbugs.gnu.org, schwab@HIDDEN, monnier@HIDDEN,
 eduardoochs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Robert Pluim <rpluim@HIDDEN>
> Cc: Andreas Schwab <schwab@HIDDEN>,  73764 <at> debbugs.gnu.org,
>   monnier@HIDDEN,  eduardoochs@HIDDEN
> Date: Mon, 14 Oct 2024 17:06:05 +0200
> 
> >>>>> On Sat, 12 Oct 2024 18:18:18 +0300, Eli Zaretskii <eliz@HIDDEN> said:
> 
>     >> From: Andreas Schwab <schwab@HIDDEN>
>     >> Cc: Stefan Monnier <monnier@HIDDEN>,  73764 <at> debbugs.gnu.org,
>     >> eduardoochs@HIDDEN
>     >> Date: Sat, 12 Oct 2024 16:51:49 +0200
>     >> 
>     >> On Okt 12 2024, Eli Zaretskii wrote:
>     >> 
>     >> >> I guess we also need to make sure `format-kbd-macro` generates
>     >> >> something that `key-valid-p` accepts.
>     >> >
>     >> > AFAICS, that's impossible without completely rewriting its code.  It
>     >> > proceeds from left to right (i.e. from MSB to LSB).
>     >> 
>     >> The issue here is that C-h is a character on its own, unlike, say, C-+.
> 
>     Eli> Right.  And in that case, the C- prefix is generated when a control
>     Eli> character is seen, which is at the end.
> 
> So if format-kbd-macro generates something with 'C-' in the "wrong"
> place, whatʼs to stop us re-ordering the modifiers as a
> post-processing step (inside `format-kbd-macro')?

If that's the only case where we put C- in the wrong place, then
nothing stops us.  Is it?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73764; Package emacs. Full text available.

Message received at 73764 <at> debbugs.gnu.org:


Received: (at 73764) by debbugs.gnu.org; 14 Oct 2024 15:07:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 14 11:07:31 2024
Received: from localhost ([127.0.0.1]:40098 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t0MfT-0000H5-FU
	for submit <at> debbugs.gnu.org; Mon, 14 Oct 2024 11:07:31 -0400
Received: from mail-wm1-f50.google.com ([209.85.128.50]:42140)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rpluim@HIDDEN>) id 1t0MfR-0000GJ-Jz
 for 73764 <at> debbugs.gnu.org; Mon, 14 Oct 2024 11:07:30 -0400
Received: by mail-wm1-f50.google.com with SMTP id
 5b1f17b1804b1-43115887867so29716605e9.0
 for <73764 <at> debbugs.gnu.org>; Mon, 14 Oct 2024 08:07:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1728918367; x=1729523167; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id
 :reply-to; bh=OafdBp9A+cFx6lhwP1+ep2G7PF2cmiFRrxGVbjKXZ+w=;
 b=nByB0a1IePOXiqdBjrQ04qF+sWDx3rOoZIVF9dkaygZiZQyJ9DpYWtuzUrl95ueTk+
 mpks79Ln+AK0z4UEh98rW++8bA07ehAkj/EcqhRkUvEP6vEoyIjqf4MTjpFlrR8W5GYn
 CGqnIQimlAGl3t5M048W27Q4dVpLabI5Kr/zgSfUR1brB+BDJQRJvQcl7DRsPg8Yx3SB
 tlFCYQvnKdTYi/Q/hbarvlXlrDpZI9SqjvCv+/BtDWlfNUYs85uB8KTijTVMCB9Et79m
 G3snUTWCckwX9tmAW2BhXYWvVSEvYghCg6inVfqgHmaGoC+r7JDCyBNe/1wOXGFz5+mo
 C+3A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1728918367; x=1729523167;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=OafdBp9A+cFx6lhwP1+ep2G7PF2cmiFRrxGVbjKXZ+w=;
 b=XEbtBZbRGiuKer5l+fKFHPpwBeJDiFcWXk3vB+KIcCWuXxic+I1ciOITIusMexgMPE
 2lylPGVCudGcj7qQCbLGJVx2Dd65GzbmCoevkCWeFEQKmithpodhtqrilfamAUhLBFDT
 7Jvi9QfIoxjoTufVVe0S87GClMWyOvjEZn4Ifd7qoYH1Qm2S2zncwm1pCCBZSj+ZXTVi
 SfQxNeJpijyN2gmPZVuxDYpQ4zKFdDKK5o7JsIK7Ix+jN0FyE7VBncAT4FZ9CWtnF30u
 QfGiiGa3agdvApPZ+AbkH1pWojjkCAbCk+Rl1BcaNJYDZZ8D24csKVW4MyKyMZM8cidX
 QgSQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCWuZxWaxfO8WE1AKJizV/HB/fa9gq/jd6LxBhA0QwaC4M6vmAd/l5s5L2TkHlW1bLurBnoU+A==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzUhJ0s4RspFhq9xWzYqeoZbHkT3TCeoPb3tFRFZXww9k7xxUgh
 Mj8oRbkMcygl3o90f09QUn6fapOxz77mpmN57HKm2KlUHrS0Tww5
X-Google-Smtp-Source: AGHT+IHH+k6JGWg6YDDB4pRfdT1b+yS3Rhz1ZKco4OjI5CKvxCVhm8JWzbKr/vWVJ6GSCRDaf8ooyQ==
X-Received: by 2002:a05:600c:3106:b0:431:136b:8bef with SMTP id
 5b1f17b1804b1-43115aa52a6mr137050435e9.7.1728918366478; 
 Mon, 14 Oct 2024 08:06:06 -0700 (PDT)
Received: from rltb ([2a01:e0a:3f3:fb51:4bed:478b:efb9:1460])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-37d4b7f2c1esm11525941f8f.109.2024.10.14.08.06.05
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 14 Oct 2024 08:06:05 -0700 (PDT)
From: Robert Pluim <rpluim@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#73764: format-kbd-macro returns a key name that
 keymap-lookup doesn't recognize
In-Reply-To: <86y12tuz7p.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 12 Oct
 2024 18:18:18 +0300")
References: <CADs++6jwK14-SNxjbPoRfajnyMKHpJkRk=-zN+hc+8jubWEj5w@HIDDEN>
 <86plo5y902.fsf@HIDDEN> <jwviktxihdb.fsf-monnier+emacs@HIDDEN>
 <8634l1wfqi.fsf@HIDDEN> <87cyk5s7ay.fsf@HIDDEN>
 <86y12tuz7p.fsf@HIDDEN>
Date: Mon, 14 Oct 2024 17:06:05 +0200
Message-ID: <87cyk2u3ky.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 73764
Cc: 73764 <at> debbugs.gnu.org, Andreas Schwab <schwab@HIDDEN>,
 monnier@HIDDEN, eduardoochs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>>>>> On Sat, 12 Oct 2024 18:18:18 +0300, Eli Zaretskii <eliz@HIDDEN> said:

    >> From: Andreas Schwab <schwab@HIDDEN>
    >> Cc: Stefan Monnier <monnier@HIDDEN>,  73764@HIDDEN=
g,
    >> eduardoochs@HIDDEN
    >> Date: Sat, 12 Oct 2024 16:51:49 +0200
    >>=20
    >> On Okt 12 2024, Eli Zaretskii wrote:
    >>=20
    >> >> I guess we also need to make sure `format-kbd-macro` generates
    >> >> something that `key-valid-p` accepts.
    >> >
    >> > AFAICS, that's impossible without completely rewriting its code.  =
It
    >> > proceeds from left to right (i.e. from MSB to LSB).
    >>=20
    >> The issue here is that C-h is a character on its own, unlike, say, C=
-+.

    Eli> Right.  And in that case, the C- prefix is generated when a control
    Eli> character is seen, which is at the end.

So if format-kbd-macro generates something with 'C-' in the "wrong"
place, what=CA=BCs to stop us re-ordering the modifiers as a
post-processing step (inside `format-kbd-macro')?

Robert
--=20




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73764; Package emacs. Full text available.

Message received at 73764 <at> debbugs.gnu.org:


Received: (at 73764) by debbugs.gnu.org; 12 Oct 2024 15:23:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 12 11:23:46 2024
Received: from localhost ([127.0.0.1]:48476 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1szdy5-0006O4-HN
	for submit <at> debbugs.gnu.org; Sat, 12 Oct 2024 11:23:46 -0400
Received: from eggs.gnu.org ([209.51.188.92]:38566)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1szdy0-0006NG-Kr
 for 73764 <at> debbugs.gnu.org; Sat, 12 Oct 2024 11:23:41 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1szdss-0008S4-83; Sat, 12 Oct 2024 11:18:22 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=TK3YuIMp7Cx42q6TF+FEmZ7+0cw3qvC+CawKitj+eDU=; b=K0LuiM4fzTpI
 opDwM+Ts1kylsT/xt0fOFyxaLZWtPk/Np3Hiccsw6XhD4BUHgtotw6cwKVtEn82UHvnGfjCZWX2i8
 8cxZSX2rqkPK2CvhwZ16iuXPvyqCoNqn8txGOvDQOkRn8w0q4GgmLt3Sa7UoRKdNeEfu92WK7dzxk
 rpcU8SO8UWLxid9XBYU7Q0Z5eFuCWIIsMRktgsTywgOrEJ40UzfCWIO57hsPmkACo9UZUe/oimoAP
 yxZDO+I45wx3N/jc4UBdC6/jOrvXyeEP2bpAF+P3Pyf3GtA1oCKoGSF/cnuQoGwUol2vB/RvlPxNM
 lkp3u4USuvWvLnvzgza3Aw==;
Date: Sat, 12 Oct 2024 18:18:18 +0300
Message-Id: <86y12tuz7p.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Andreas Schwab <schwab@HIDDEN>
In-Reply-To: <87cyk5s7ay.fsf@HIDDEN> (message from Andreas Schwab on Sat,
 12 Oct 2024 16:51:49 +0200)
Subject: Re: bug#73764: format-kbd-macro returns a key name that
 keymap-lookup doesn't recognize
References: <CADs++6jwK14-SNxjbPoRfajnyMKHpJkRk=-zN+hc+8jubWEj5w@HIDDEN>
 <86plo5y902.fsf@HIDDEN> <jwviktxihdb.fsf-monnier+emacs@HIDDEN>
 <8634l1wfqi.fsf@HIDDEN> <87cyk5s7ay.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 73764
Cc: 73764 <at> debbugs.gnu.org, monnier@HIDDEN, eduardoochs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Andreas Schwab <schwab@HIDDEN>
> Cc: Stefan Monnier <monnier@HIDDEN>,  73764 <at> debbugs.gnu.org,
>   eduardoochs@HIDDEN
> Date: Sat, 12 Oct 2024 16:51:49 +0200
> 
> On Okt 12 2024, Eli Zaretskii wrote:
> 
> >> I guess we also need to make sure `format-kbd-macro` generates
> >> something that `key-valid-p` accepts.
> >
> > AFAICS, that's impossible without completely rewriting its code.  It
> > proceeds from left to right (i.e. from MSB to LSB).
> 
> The issue here is that C-h is a character on its own, unlike, say, C-+.

Right.  And in that case, the C- prefix is generated when a control
character is seen, which is at the end.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73764; Package emacs. Full text available.

Message received at 73764 <at> debbugs.gnu.org:


Received: (at 73764) by debbugs.gnu.org; 12 Oct 2024 14:53:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 12 10:53:08 2024
Received: from localhost ([127.0.0.1]:46463 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1szdUS-00043p-I4
	for submit <at> debbugs.gnu.org; Sat, 12 Oct 2024 10:53:08 -0400
Received: from mail-out.m-online.net ([212.18.0.10]:33990)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <whitebox@HIDDEN>) id 1szdUQ-00043d-NH
 for 73764 <at> debbugs.gnu.org; Sat, 12 Oct 2024 10:53:07 -0400
Received: from frontend01.mail.m-online.net (unknown [192.168.8.182])
 by mail-out.m-online.net (Postfix) with ESMTP id 4XQmfZ5bL1z1syC4;
 Sat, 12 Oct 2024 16:51:50 +0200 (CEST)
Received: from localhost (dynscan1.mnet-online.de [192.168.6.68])
 by mail.m-online.net (Postfix) with ESMTP id 4XQmfZ34NRz1qqlS;
 Sat, 12 Oct 2024 16:51:50 +0200 (CEST)
X-Virus-Scanned: amavis at mnet-online.de
Received: from mail.mnet-online.de ([192.168.8.182])
 by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024)
 with ESMTP id Croxd81XoBRk; Sat, 12 Oct 2024 16:51:49 +0200 (CEST)
X-Auth-Info: MpwuqhJbX8II3lwFuRETNFwHgffsFgHrTKkjSB/9zneDiZunVG9Drhiy9BQ9mTIY
Received: from igel.home (aftr-82-135-83-221.dynamic.mnet-online.de
 [82.135.83.221])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by mail.mnet-online.de (Postfix) with ESMTPSA;
 Sat, 12 Oct 2024 16:51:49 +0200 (CEST)
Received: by igel.home (Postfix, from userid 1000)
 id 7AE9C2C1A11; Sat, 12 Oct 2024 16:51:49 +0200 (CEST)
From: Andreas Schwab <schwab@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#73764: format-kbd-macro returns a key name that
 keymap-lookup doesn't recognize
In-Reply-To: <8634l1wfqi.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 12 Oct
 2024 17:36:05 +0300")
References: <CADs++6jwK14-SNxjbPoRfajnyMKHpJkRk=-zN+hc+8jubWEj5w@HIDDEN>
 <86plo5y902.fsf@HIDDEN> <jwviktxihdb.fsf-monnier+emacs@HIDDEN>
 <8634l1wfqi.fsf@HIDDEN>
X-Yow: Yow!  Am I JOGGING yet??
Date: Sat, 12 Oct 2024 16:51:49 +0200
Message-ID: <87cyk5s7ay.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.4 (/)
X-Debbugs-Envelope-To: 73764
Cc: 73764 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 eduardoochs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.4 (-)

On Okt 12 2024, Eli Zaretskii wrote:

>> I guess we also need to make sure `format-kbd-macro` generates
>> something that `key-valid-p` accepts.
>
> AFAICS, that's impossible without completely rewriting its code.  It
> proceeds from left to right (i.e. from MSB to LSB).

The issue here is that C-h is a character on its own, unlike, say, C-+.

ELISP> (format-kbd-macro [?\M-\C-+])
"C-M-+"

Maybe key-valid-p should accept those control characters as the last
component as a special case.

-- 
Andreas Schwab, schwab@HIDDEN
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73764; Package emacs. Full text available.

Message received at 73764 <at> debbugs.gnu.org:


Received: (at 73764) by debbugs.gnu.org; 12 Oct 2024 14:36:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 12 10:36:41 2024
Received: from localhost ([127.0.0.1]:46434 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1szdEW-0003FH-W8
	for submit <at> debbugs.gnu.org; Sat, 12 Oct 2024 10:36:41 -0400
Received: from eggs.gnu.org ([209.51.188.92]:49900)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1szdEU-0003F1-7a
 for 73764 <at> debbugs.gnu.org; Sat, 12 Oct 2024 10:36:38 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1szdEA-0003Pk-CE; Sat, 12 Oct 2024 10:36:18 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=c0ZrD6sJoIlVe1aBscIWP+UJI2jpGanUHrIOV30RY4A=; b=bcM8vZ9vBlHM
 BBM2J3DsguWoh6neUrOLbVDN1S9toIU7QKzzYyQLvymX6DWSQde2ejJJCgXPVGTYX/UpHQoGrvyKd
 gYBANMBWfXkPHPyAF78SpvtJTR0mKEbJuky8yz137kbVvWDuRfB2u5wj5lJbuIAtR2sRvK/nMJhy9
 qtYeJImhA2lSXjDj9XtHUoWj9gvIr/nHtPAG9ZhKvMADr26Sm0s7DNGtUfjQNLPY5S8QYGJBJVh8O
 Voa84DaKRrmwMUOb+0enUYNdoHo8G66Gk82AKVZ13mKzUsHA4fL6znSZ8dmZ6ng31+oGOwppTXFVu
 K5eC1reTTBaQONYpIQ8YeA==;
Date: Sat, 12 Oct 2024 17:36:05 +0300
Message-Id: <8634l1wfqi.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <jwviktxihdb.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Sat, 12 Oct 2024 09:33:59 -0400)
Subject: Re: bug#73764: format-kbd-macro returns a key name that
 keymap-lookup doesn't recognize
References: <CADs++6jwK14-SNxjbPoRfajnyMKHpJkRk=-zN+hc+8jubWEj5w@HIDDEN>
 <86plo5y902.fsf@HIDDEN> <jwviktxihdb.fsf-monnier+emacs@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 73764
Cc: 73764 <at> debbugs.gnu.org, eduardoochs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Stefan Monnier <monnier@HIDDEN>
> Cc: Eduardo Ochs <eduardoochs@HIDDEN>,  73764 <at> debbugs.gnu.org
> Date: Sat, 12 Oct 2024 09:33:59 -0400
> 
> >>   (keymap-lookup global-map "M-C-h")
> >>     ;;-> "M-C-h" is not a valid key definition; see `key-valid-p'
> [...]
> > Should we fix key-valid-p to be more lenient?
> 
> AFAIK the strictness was a conscious choice, so maybe we should simply
> improve the error message to say something like "M-C-h uses an invalid
> modifier ordering, maybe you meant C-M-h".

The general problem is much wider, so it is not easy to intuit "what
you meant".  E.g., what do you say if the key is "S-s-M-H-A-C-b"?  Do
you want to have a function that reorders the modifiers in canonical
order?  And if we have such a function, why not reorder silently and
accept the key, like we do with the order of BEG..END in functions
that accept the region?

> >> if we run this
> >>
> >>   (format-kbd-macro (read-key-sequence-vector "Type C-M-h:"))
> >>
> >> we get "M-C-h".
> 
> I guess we also need to make sure `format-kbd-macro` generates
> something that `key-valid-p` accepts.

AFAICS, that's impossible without completely rewriting its code.  It
proceeds from left to right (i.e. from MSB to LSB).

> > Or maybe just remove the call to keymap--check from keymap-lookup?
> 
> IIRC we wanted to use `keymap--check` on all input coming from the user,
> so I guess the question is whether the second arg of `keymap-lookup` is
> expected to be an immediate constant.

But keymap-look up is not an interactive function.

> That function is still young, so it's hard to tell how it'll turn up,
> but my `grep` says that indeed many (most) calls take a literal string
> as argument, so `keymap--check` seems appropriate.

If we remove the call to keymap--check, won't the other APIs signal an
error instead?  If they will, why do we need to protect them?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73764; Package emacs. Full text available.

Message received at 73764 <at> debbugs.gnu.org:


Received: (at 73764) by debbugs.gnu.org; 12 Oct 2024 14:10:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 12 10:10:10 2024
Received: from localhost ([127.0.0.1]:46333 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1szcor-0001iE-6r
	for submit <at> debbugs.gnu.org; Sat, 12 Oct 2024 10:10:10 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:60075)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1szcNT-00081c-S7
 for 73764 <at> debbugs.gnu.org; Sat, 12 Oct 2024 09:41:52 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4D2F91000C3;
 Sat, 12 Oct 2024 09:34:06 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1728740041;
 bh=vEQboWuPcl2GH6/pKDrdiuCtEzHJzwDkroVi6Mfwy3Y=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=Y/o3WF+KDB1bu289d5Zkul/DWo7M7J8l5tRq6psweLVKHtiPdGfpxBq6ReNLj2XOZ
 4WHs/KBOSy7son00S84Z26DZyHkS/cnZ1lLyGdHKzA2J82TyFhc6O56637KUHYPqQ5
 QA2fbSKZ+DZ38s8gYf3usJJJQYn9rTYB2xUIxIBdk1v4mc13CX6S7FuH0zAMp23MGf
 lU4ziXv8LvgYBbGzhuzo6sUh5SsIoUk0rwfgChxMEGbTgUrNd8q6N/Pfsb/281DzML
 FyoEPCE/9tTmhWx2IcRCVoEj4KFwmAved0wmg2ArDpeIGpCJK2+759VuSurseYuEM/
 P1zMjbv3WEeIQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 754FB10002E;
 Sat, 12 Oct 2024 09:34:01 -0400 (EDT)
Received: from pastel (unknown [104.195.209.82])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4B5031204E5;
 Sat, 12 Oct 2024 09:34:01 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#73764: format-kbd-macro returns a key name that
 keymap-lookup doesn't recognize
In-Reply-To: <86plo5y902.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 12 Oct
 2024 12:18:37 +0300")
Message-ID: <jwviktxihdb.fsf-monnier+emacs@HIDDEN>
References: <CADs++6jwK14-SNxjbPoRfajnyMKHpJkRk=-zN+hc+8jubWEj5w@HIDDEN>
 <86plo5y902.fsf@HIDDEN>
Date: Sat, 12 Oct 2024 09:33:59 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.067 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 73764
Cc: 73764 <at> debbugs.gnu.org, Eduardo Ochs <eduardoochs@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>>   (keymap-lookup global-map "M-C-h")
>>     ;;-> "M-C-h" is not a valid key definition; see `key-valid-p'
[...]
> Should we fix key-valid-p to be more lenient?

AFAIK the strictness was a conscious choice, so maybe we should simply
improve the error message to say something like "M-C-h uses an invalid
modifier ordering, maybe you meant C-M-h".

>> if we run this
>>
>>   (format-kbd-macro (read-key-sequence-vector "Type C-M-h:"))
>>
>> we get "M-C-h".

I guess we also need to make sure `format-kbd-macro` generates
something that `key-valid-p` accepts.

> Or maybe just remove the call to keymap--check from keymap-lookup?

IIRC we wanted to use `keymap--check` on all input coming from the user,
so I guess the question is whether the second arg of `keymap-lookup` is
expected to be an immediate constant.
That function is still young, so it's hard to tell how it'll turn up,
but my `grep` says that indeed many (most) calls take a literal string
as argument, so `keymap--check` seems appropriate.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73764; Package emacs. Full text available.

Message received at 73764 <at> debbugs.gnu.org:


Received: (at 73764) by debbugs.gnu.org; 12 Oct 2024 09:19:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 12 05:19:06 2024
Received: from localhost ([127.0.0.1]:36303 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1szYHC-0007qw-6C
	for submit <at> debbugs.gnu.org; Sat, 12 Oct 2024 05:19:06 -0400
Received: from eggs.gnu.org ([209.51.188.92]:55198)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1szYH7-0007qN-0I
 for 73764 <at> debbugs.gnu.org; Sat, 12 Oct 2024 05:19:04 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1szYGn-0006rz-HZ; Sat, 12 Oct 2024 05:18:41 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=8sBRqQoO/5IZLhJjHv9+h7zQSPqt0shef28CYaxoNso=; b=niUzfHb4Utzr
 fFcGBzelMaa/S4ANKc32VRX1aQbNH8q1fi7SusBEmxG07ahugTaEuCpRJ69i7a5Sz5JpR8o9gyJCI
 DWAKT81uLe++Vuvd+drAxYVMOK0PKfjNe6TUM0Wg3wl+RT1pkyj4rJeZi7nqsIq/URkONYABiPGG7
 hbgeiP1kzhc1ZaJeEDeZ6cALtMAMTTGtqLZ8aigCci8jPKSOQ1fthbOntCVZvn2Qm/80Ralz4IAQL
 SgZLoee9RPfolVPf16qsAqaOxcUkJz7BtcvXtC1MygLZONOFbR+9SQOHI5kn94b1kRGKeJvh0W9w4
 TUMLlV70UwbuQsStBn32/w==;
Date: Sat, 12 Oct 2024 12:18:37 +0300
Message-Id: <86plo5y902.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Eduardo Ochs <eduardoochs@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <CADs++6jwK14-SNxjbPoRfajnyMKHpJkRk=-zN+hc+8jubWEj5w@HIDDEN>
 (message from Eduardo Ochs on Sat, 12 Oct 2024 01:46:26 -0300)
Subject: Re: bug#73764: format-kbd-macro returns a key name that keymap-lookup
 doesn't recognize
References: <CADs++6jwK14-SNxjbPoRfajnyMKHpJkRk=-zN+hc+8jubWEj5w@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 73764
Cc: 73764 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Eduardo Ochs <eduardoochs@HIDDEN>
> Date: Sat, 12 Oct 2024 01:46:26 -0300
> 
> if we run this
> 
>   (format-kbd-macro (read-key-sequence-vector "Type C-M-h:"))
> 
> we get "M-C-h". But try:
> 
>   (keymap-lookup global-map "M-C-h")
>     ;;-> "M-C-h" is not a valid key definition; see `key-valid-p'
> 
>   (keymap-lookup global-map "C-M-h")
>     ;;-> mark-defun

This is because key-valid-p is too restrictive: it only accepts
modifiers in the canonical order A-C-H-M-S-s.  But key-parse, which is
called by keymap-lookup, accepts and correctly processes the modifiers
in any order:

  (key-parse "M-C-h")
   => [134217736]

Should we fix key-valid-p to be more lenient?  Or maybe just remove
the call to keymap--check from keymap-look up?

Stefan, WDYT?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73764; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Oct 2024 04:46:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 12 00:46:59 2024
Received: from localhost ([127.0.0.1]:36033 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1szU1q-0001vq-Sg
	for submit <at> debbugs.gnu.org; Sat, 12 Oct 2024 00:46:59 -0400
Received: from lists.gnu.org ([209.51.188.17]:42342)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eduardoochs@HIDDEN>) id 1szU1o-0001vi-62
 for submit <at> debbugs.gnu.org; Sat, 12 Oct 2024 00:46:56 -0400
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 <eduardoochs@HIDDEN>)
 id 1szU1Z-0008V4-Tq
 for bug-gnu-emacs@HIDDEN; Sat, 12 Oct 2024 00:46:41 -0400
Received: from mail-yw1-x1134.google.com ([2607:f8b0:4864:20::1134])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <eduardoochs@HIDDEN>)
 id 1szU1Y-0003IB-C7
 for bug-gnu-emacs@HIDDEN; Sat, 12 Oct 2024 00:46:41 -0400
Received: by mail-yw1-x1134.google.com with SMTP id
 00721157ae682-6dbc5db8a31so18653077b3.1
 for <bug-gnu-emacs@HIDDEN>; Fri, 11 Oct 2024 21:46:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1728708398; x=1729313198; darn=gnu.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=SYkkc9uzHLWPu/FinIYfvtrdAJK+4hcVxK5AXWzAwsI=;
 b=SHQy/UOoMG1RvK5+XXk5Falu/IyRTNz0c4GNeluH31nOYHi3sDyRQToYQWtIFCOjEZ
 2i1IDWh9pM6lxN4nnF6Jp8QNEpn9tqHteSX5A86OHO2My6LzHu5uNaf8IKHaYf47mlxe
 4dpUDWWOkYqWCM/6JK07OCI36iufi58rq+Tux37RH7wgER9U38moJQ24s+/45D72C/CR
 B66pNIt8Z5r5J9vJMTBK9oJpC+qxq+/UMD8OAdizXB5rm2/SQwLogxKB6doz2Q3AlpnC
 3BtcEqI6EXG5RnDzQMplftpbaT2C1iiywfzkdpKFIf+6NMjvF8GdtK8ER1z/WwtTqVaA
 w7JQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1728708398; x=1729313198;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=SYkkc9uzHLWPu/FinIYfvtrdAJK+4hcVxK5AXWzAwsI=;
 b=J0d0hXnh+8kn3iLcgidKlyayQOaRW8VhHAgcKAn4LBWj8S6vlu087I/6pmG39VxNGd
 YGhD9i6AqYAGh+uGEU1qSEScJ8kA66FmM0X8EGsGUYYgQeBRNvJo4MjYXl6PG98gJsG6
 8Et6TxEcs+lWo6CQ0kiV+5MYjvmDHUBwo9/uimzKCQnmsflVbva6WAkL3ZlUnyllIm8g
 cqRw5V1hP3+zgvc38RrlKI28t5SW83xShb+7u47KSpAevvtzhT6tcB3nOfds8RGIvd+c
 0WzfUdwIpOeAmaarADg4r9tZX6ab4EyTgGgV8GZ+S2LCVlcSJlwvZE/CoxBcIjAyrGq4
 CaPw==
X-Gm-Message-State: AOJu0YzmKBQX4HV5Tq/zR21SM553w+2U6MRnCmYk1VLPFE6Gioze07D8
 bfU8ZuC/5sfQgKQP/mHx+OHqn/zJVU+HBYawRilvab6tAJ8l7s9uYkc544JD6Xawu9H2tpj48PW
 APlkIhSJgFKcjV3QVJS3fIg5iZewDtKl0
X-Google-Smtp-Source: AGHT+IF5OQMbm6d+5vS6dlA93A5aUeCPmILTiIEt31NZkr1wtpaGm0SDNQwLAfNeC/84evihsCFchDaK1R73bQc5cyI=
X-Received: by 2002:a05:690c:6f07:b0:6e2:3e9:d892 with SMTP id
 00721157ae682-6e32f29e2b6mr73636617b3.19.1728708398096; Fri, 11 Oct 2024
 21:46:38 -0700 (PDT)
MIME-Version: 1.0
From: Eduardo Ochs <eduardoochs@HIDDEN>
Date: Sat, 12 Oct 2024 01:46:26 -0300
Message-ID: <CADs++6jwK14-SNxjbPoRfajnyMKHpJkRk=-zN+hc+8jubWEj5w@HIDDEN>
Subject: format-kbd-macro returns a key name that keymap-lookup doesn't
 recognize
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Received-SPF: pass client-ip=2607:f8b0:4864:20::1134;
 envelope-from=eduardoochs@HIDDEN; helo=mail-yw1-x1134.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Hi list,

if we run this

  (format-kbd-macro (read-key-sequence-vector "Type C-M-h:"))

we get "M-C-h". But try:

  (keymap-lookup global-map "M-C-h")
    ;;-> "M-C-h" is not a valid key definition; see `key-valid-p'

  (keymap-lookup global-map "C-M-h")
    ;;-> mark-defun

Tested on GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu,
GTK+ Version 3.24.24, cairo version 1.16.0) of 2024-10-11,
git-pulled and compiled a few hours ago.

  Cheers,
    Eduardo Ochs
    http://anggtwu.net/




Acknowledgement sent to Eduardo Ochs <eduardoochs@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#73764; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.