From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key Date: Wed, 16 Nov 2022 09:47:31 +0100 Message-ID: <87edu3cml8.fsf@gmail.com> 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="40609"; mail-complaints-to="usenet@ciao.gmane.io" To: 59305@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 16 09:48:30 2022 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 1ovE5t-000AQf-Kv for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 16 Nov 2022 09:48:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovE5i-0001fm-08; Wed, 16 Nov 2022 03:48:18 -0500 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 1ovE5V-0001eh-4K for bug-gnu-emacs@gnu.org; Wed, 16 Nov 2022 03:48:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovE5S-00037v-EI for bug-gnu-emacs@gnu.org; Wed, 16 Nov 2022 03:48:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ovE5R-0005Le-Um for bug-gnu-emacs@gnu.org; Wed, 16 Nov 2022 03:48:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Nov 2022 08:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59305 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166858846120450 (code B ref -1); Wed, 16 Nov 2022 08:48:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Nov 2022 08:47:41 +0000 Original-Received: from localhost ([127.0.0.1]:56012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ovE57-0005Jk-D3 for submit@debbugs.gnu.org; Wed, 16 Nov 2022 03:47:41 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:55644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ovE53-0005Jb-S8 for submit@debbugs.gnu.org; Wed, 16 Nov 2022 03:47:40 -0500 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 1ovE53-0001aO-Md for bug-gnu-emacs@gnu.org; Wed, 16 Nov 2022 03:47:37 -0500 Original-Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovE51-00034y-VV for bug-gnu-emacs@gnu.org; Wed, 16 Nov 2022 03:47:37 -0500 Original-Received: by mail-wm1-x32f.google.com with SMTP id v7so11396619wmn.0 for ; Wed, 16 Nov 2022 00:47:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=y2b4RoHbmvunipDHr77pU8JdX5DzIl4IXWtjKnmg99c=; b=Bsb+55nlwmdivBLvXrqq/yQWmC71emVTffvVDkb3lRDU6SCJacq9081wTys4C2Akep 9T2vIhj689445kcChbfDZMJVMqT/mMhOjAqJYiHqS8jJ0LvqcMF8zj3m/9wA8jtcvEf9 vjkjhkEtOob8QfxXf/c3uBgv+EdaDZLKHvMOzTpBElNxOL+pIiWJ/MxnIb94vgjty7L+ ExA14v7wv3MQxg8ohDy7b/15ZLGBAlnCTesIPNzQJo/43meDH6RO0zWh7wrFADOW88si iYvZq0a2RDhYicWLlCrS3Up5hlXnW5w+WBpoqWzsV0ZZbeie5sbAmFuHDL/hnBdnS+n5 tjqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=y2b4RoHbmvunipDHr77pU8JdX5DzIl4IXWtjKnmg99c=; b=ZoZCEleWKfpAOQ9ZG/HfkxVTr/TKv3IvjuI1GQDNM/v3tcM5IrtSFDatp5n8LECadX 30b/bkA5TlTrOjFo4BMZJsToiBeaR7idKIzPEJQ0N1lha8z5Md7n9TuqYERSLXhWGOV6 wfWMPjHxW3dB0slV/jIhZIuUStJSoegmUBLMmC9EnAZfTnRMycSDuqgaetdnz4x54MrO ECSgPScj/pu2p7Vjtul1L0VY8mFHP6fAV/F7iRtzQMHMN2Hi8+HAUCP/dQZ+50CDP0LT LGGYGkj1rdh7BDqvq9F7bCgB0G70yuz78jw01KWVM48xhpyYIbd4Ra0pYG6tefsG9jRH hvCQ== X-Gm-Message-State: ANoB5pl79FrIDD4CUS/lCAFQrCgmSiUS8kUQGjUVQ/Ml6Ai94XkSG9Ic q46IzOL6N+Sw3ZAAX3uQ6SLUNsBxaKs= X-Google-Smtp-Source: AA0mqf5w0tYQ4HuVevTvLdfjnlzAECcyUwsYamKWv6wjmpmyRiYw5uzoh0SBWuRf7ybR0yoeegBlJQ== X-Received: by 2002:a05:600c:2057:b0:3cf:6ab3:49ce with SMTP id p23-20020a05600c205700b003cf6ab349cemr1337623wmg.137.1668588453398; Wed, 16 Nov 2022 00:47:33 -0800 (PST) Original-Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id e8-20020adffc48000000b00236863c02f5sm14217922wrs.96.2022.11.16.00.47.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 00:47:32 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=rpluim@gmail.com; helo=mail-wm1-x32f.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-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:247995 Archived-At: `global-set-key' allows you to bind keys to strings (or vectors). The following all succeed without error (although only [1] and [3] match the expectations of users unfamiliar with Emacs' key representation). 1. (global-set-key (kbd "C-c h") "hello") 2. (global-set-key (kbd "C-c h") "ol=C3=A1") 3. (global-set-key (kbd "C-c h") (kbd "ol=C3=A1")) Trying to map this to emacs-29's `keymap-global-set', we get the following issues (keymap-global-set "C-c h" "hello") =3D> error (keymap-global-set "C-c h" "ol=C3=A1") =3D> error OK, maybe we need to wrap the definitions in `kbd' like [3] above. (keymap-global-set "C-c h" (kbd "ol=C3=A1")) =3D> definition is a vector ->= ok but 4. (keymap-global-set "C-c h" (kbd "hello")) =3D> defn is a string -> error After reading up on `key-valid-p': 5. (keymap-global-set "C-c h" "h e l l o") =3D> success! or alternatively 6. (keymap-global-set "C-c h" [?h ?e ?l ?l ?o]) =3D> success! 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 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. Thanks Robert In GNU Emacs 29.0.50 (build 43, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0) of 2022-11-16 built on rltb Repository revision: 60f2bb862f834fcb580d839ac79b30a8b4cd4167 Repository branch: master System Description: Debian GNU/Linux 11 (bullseye) Configured using: 'configure -C' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB