From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key Date: Thu, 02 May 2024 09:13:41 -0400 Message-ID: References: <87edu3cml8.fsf@gmail.com> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32581"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Robert Pluim , 59305@debbugs.gnu.org, Lars Ingebrigtsen To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 02 15:15:11 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 1s2WHH-0008Ea-6y for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 May 2024 15:15:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2WGr-0000QT-K7; Thu, 02 May 2024 09:14:45 -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 1s2WGn-0000Q4-4g for bug-gnu-emacs@gnu.org; Thu, 02 May 2024 09:14:41 -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 1s2WGm-0003EH-SQ for bug-gnu-emacs@gnu.org; Thu, 02 May 2024 09:14:40 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s2WH8-0005tU-LY for bug-gnu-emacs@gnu.org; Thu, 02 May 2024 09:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 May 2024 13:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59305 X-GNU-PR-Package: emacs Original-Received: via spool by 59305-submit@debbugs.gnu.org id=B59305.171465565522498 (code B ref 59305); Thu, 02 May 2024 13:15:02 +0000 Original-Received: (at 59305) by debbugs.gnu.org; 2 May 2024 13:14:15 +0000 Original-Received: from localhost ([127.0.0.1]:43711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s2WGM-0005qo-Hp for submit@debbugs.gnu.org; Thu, 02 May 2024 09:14:14 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:22988) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s2WGJ-0005qg-QA for 59305@debbugs.gnu.org; Thu, 02 May 2024 09:14:13 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C4BD34427DC; Thu, 2 May 2024 09:13:43 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1714655622; bh=eKOb1AsbRFLCYzYEWy8d/cLSVyI3KTiEZupTfAyji6k=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Ga/9Fobx6lrsiHBH4gAmZqJWESuYz7sX1vTgvGmOex05dHPZpBi++iAyVPxOad2Xt 1u2hMwWMi49GWVaSw2hJnbyZm9qApfwAAyt8pjNKSWSARQ/G038vKPmwyzgHPuwRdr Hi5tUY4rB/aYODbADbpx4NGE5kDwRHIhOjV50y8fAsQEDgnxH0ZoQo45YlJPM5C0CL oPl5T6AEJzkyjPjgzcKaAKtjqqJYyYf3wa+4w36e+Og0HdSX4KqCWh7bZCullASP91 JvYi/tTGIZRA3M/JIWoiUVYwcAOQo+6Xm6Hpjgrp6DqFZSYj7Lt0dGZvnUm9UgJW8y SS3PoL8FnbzLQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 62B73442796; Thu, 2 May 2024 09:13:42 -0400 (EDT) Original-Received: from pastel (unknown [45.72.201.215]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 33C46120472; Thu, 2 May 2024 09:13:42 -0400 (EDT) In-Reply-To: (Stefan Kangas's message of "Thu, 24 Nov 2022 16:14:05 -0800") 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:284318 Archived-At: >> Whilst not strictly a regression, this behaviour is confusing and >> unhelpful, and the solution is not easily found. I can think of two >> solutions: >> >> 1. Change `kbd' to always return a vector even if the input is >> ascii-only, which makes [4] work `key-parse` always returns a vector. >> 2. Change `keymap-set' to convert ascii-only strings to the format in >> [5] or [6]. Probably just a call to `string-to-vector' is enough. > > I feel like the second alternative goes against the design of > `keymap-global-set', where the idea explicitly was to only support a KEY > argument that is `key-valid-p'. The problem with 2 is that it requires a heuristic that tries to guess which kind of string it is (either the good "new" kbd-style or the old bad event-sequence). This *will* misfire sooner or later. >> (string-to-vector "foo") will do. But that just highlights the problem >> even more: if it=CA=BCs that simple, why can=CA=BCt `keymap-global-set' = do that >> internally instead of forcing users to jump through hoops? > AFAIU, because otherwise we can't have error handling for common typos, > such as: It's worse than that: we cannot reliably know whether the user meant for the string to be a kbd-style description of events or a "raw" sequence of events. E.g. should (keymap-global-set "C-a") remap that sequence to [?\C-a] or to [?C ?- ?a]? > Then perhaps we should just change the docstrings and manual to > explain that binding a key to a string of characters should use > `kmacro' (since `kbd' is not the right thing for ASCII-only entry) I fully support this: I think we should phase out the use of strings/vectors as commands. Stefan