X-Loop: help-debbugs@HIDDEN Subject: bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key Resent-From: Robert Pluim <rpluim@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Wed, 16 Nov 2022 08:48:01 +0000 Resent-Message-ID: <handler.59305.B.166858846120450 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 59305 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 59305 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.166858846120450 (code B ref -1); Wed, 16 Nov 2022 08:48:01 +0000 Received: (at submit) by debbugs.gnu.org; 16 Nov 2022 08:47:41 +0000 Received: from localhost ([127.0.0.1]:56012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ovE57-0005Jk-D3 for submit <at> debbugs.gnu.org; Wed, 16 Nov 2022 03:47:41 -0500 Received: from lists.gnu.org ([209.51.188.17]:55644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <rpluim@HIDDEN>) id 1ovE53-0005Jb-S8 for submit <at> debbugs.gnu.org; Wed, 16 Nov 2022 03:47:40 -0500 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 <rpluim@HIDDEN>) id 1ovE53-0001aO-Md for bug-gnu-emacs@HIDDEN; Wed, 16 Nov 2022 03:47:37 -0500 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 <rpluim@HIDDEN>) id 1ovE51-00034y-VV for bug-gnu-emacs@HIDDEN; Wed, 16 Nov 2022 03:47:37 -0500 Received: by mail-wm1-x32f.google.com with SMTP id v7so11396619wmn.0 for <bug-gnu-emacs@HIDDEN>; 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) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id e8-20020adffc48000000b00236863c02f5sm14217922wrs.96.2022.11.16.00.47.32 for <bug-gnu-emacs@HIDDEN> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 00:47:32 -0800 (PST) From: Robert Pluim <rpluim@HIDDEN> Date: Wed, 16 Nov 2022 09:47:31 +0100 Message-ID: <87edu3cml8.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=rpluim@HIDDEN; 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-Spam-Score: -1.3 (-) 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 (--) `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
X-Loop: help-debbugs@HIDDEN Subject: bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key Resent-From: Robert Pluim <rpluim@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Tue, 22 Nov 2022 16:59:02 +0000 Resent-Message-ID: <handler.59305.B59305.16691362989668 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 59305 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 59305 <at> debbugs.gnu.org Received: via spool by 59305-submit <at> debbugs.gnu.org id=B59305.16691362989668 (code B ref 59305); Tue, 22 Nov 2022 16:59:02 +0000 Received: (at 59305) by debbugs.gnu.org; 22 Nov 2022 16:58:18 +0000 Received: from localhost ([127.0.0.1]:52434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1oxWbC-0002Vs-0b for submit <at> debbugs.gnu.org; Tue, 22 Nov 2022 11:58:18 -0500 Received: from mail-wr1-f52.google.com ([209.85.221.52]:33597) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <rpluim@HIDDEN>) id 1oxWb9-0002Vd-Gx for 59305 <at> debbugs.gnu.org; Tue, 22 Nov 2022 11:58:16 -0500 Received: by mail-wr1-f52.google.com with SMTP id i12so21795218wrb.0 for <59305 <at> debbugs.gnu.org>; Tue, 22 Nov 2022 08:58:15 -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:references :in-reply-to:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=R0MgBe4i1TvDCH3d8+BaICfLGkHJCRyBgdxNfU/7i+w=; b=lcJYMsyozTast6Hw4QxjpTReD5Vz+JOsoIfH6hh53F7CJEv9YDFtBw/yLb1fhjmQuj 2pWJIm8knputL21gllPHJ/Cb6hicLbmrL9y1PaQVWZEjx2avEaPX/MKsaPB3cYs4NJXH BsNZ4dej2CpOMY+nzhTSWyJRWGolYMVFfY1W5ixhq1Do+63UmyF0JLIvemVahnWoh1Tb Uc/N+bfr8spgK7Yo9kGInw7zEUNcaMPk05bANPHUnPdhN4DuHGM/C6Sp7hDSGDn6f09b rBwv29XQ7IicDUXATw8Xy/LcDbsj+0DcpZHc7VciHInBtaNPjKHKxKzYgnNFXM00OFvk KFfA== 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:references :in-reply-to:subject:to:from:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=R0MgBe4i1TvDCH3d8+BaICfLGkHJCRyBgdxNfU/7i+w=; b=MRq9XgNG40WXwTpj7tCIPMt04kLrHOma/pYdhLS8U3Yhb230OB3SFPM4PPu+CEuMs0 F7bAxfiF2w/A+c6Fi4Wc7GS1z0O52NWfcQ4c9cT7iYQ/K0JqCE0gmqktpJNIQJih8d+5 92YVmBYN/EJEVBWYWGb5fSZ/d7KRIeHPasRom3T2SohjhF9MUxlO7aMWTwaxE3o2aUWW ruI1a6HPNy5/iObn8xYCCEyz3fmXgxn2YVzGT3npTMVl3QLanrrWT+KMW03in5nsJKTG jscs8MRz6qyNufVqecVd3XO9oWVYNqDyMtEPPc+MaBKk8NNNXR3D+Nnpq8bgwkrwuFO+ ARxQ== X-Gm-Message-State: ANoB5plLMuqbC4XkWrAPgNgKTPs3AChWIVtVzL0siuvV5oby5hAFiyZy J/78oopP/7lWqFh/hejbgocl+HG1Yl8= X-Google-Smtp-Source: AA0mqf5CnKlmyIDhFUKizN0XZPVriWs9+7u4IG/bSiUQr2cJQyvtqWAZMIjxFTJePPus64reWaGnTw== X-Received: by 2002:a05:6000:78d:b0:22e:3d63:80bc with SMTP id bu13-20020a056000078d00b0022e3d6380bcmr15548907wrb.30.1669136289004; Tue, 22 Nov 2022 08:58:09 -0800 (PST) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id o2-20020a05600c510200b003cf5ec79bf9sm20101263wms.40.2022.11.22.08.58.08 for <59305 <at> debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 08:58:08 -0800 (PST) From: Robert Pluim <rpluim@HIDDEN> In-Reply-To: <87edu3cml8.fsf@HIDDEN> (Robert Pluim's message of "Wed, 16 Nov 2022 09:47:31 +0100") References: <87edu3cml8.fsf@HIDDEN> Date: Tue, 22 Nov 2022 17:58:07 +0100 Message-ID: <87h6yrexk0.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) 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 Wed, 16 Nov 2022 09:47:31 +0100, Robert Pluim <rpluim@HIDDEN> s= aid: Robert> 1. Change `kbd' to always return a vector even if the input is Robert> ascii-only, which makes [4] work I tried that, and it seems to work, but I guess it=CA=BCs kind of risky. Just what we need to see if people are testing the pre-test properly =F0=9F=98=B8 Robert> 2. Change `keymap-set' to convert ascii-only strings to the for= mat in Robert> [5] or [6]. Probably just a call to `string-to-vector' is enoug= h. This is less invasive. Something like this: diff --git a/lisp/keymap.el b/lisp/keymap.el index eaeba96644..deb44844fb 100644 --- a/lisp/keymap.el +++ b/lisp/keymap.el @@ -61,7 +61,23 @@ keymap-set ;; If we're binding this key to another key, then parse that other ;; key, too. (when (stringp definition) - (keymap--check definition) + ;; For backwards compatibility, we want people to be able to say + ;; "hello" instead of forcing them to say "h e l l o", and to fix + ;; the common mistake of specifying a string with non-ascii + ;; characters, we convert to a vector instead. + (cond + ((let ((case-fold-search nil)) ;; no special chars or keywords + (not (string-match-p + (rx (or " " "^" "<" ">" "-" "\\" + "NUL" "RET" "TAB" "LFD" + "ESC" "SPC" "DEL"))))) + (setq definition (string-join (seq-split definition 1) " ")) + (keymap--check definition)) + ((string-match-p ;; non-ascii characters + "[[:nonascii:]]" definition) + (setq definition (string-to-vector definition))) + (t ;; kbd syntax + (keymap--check definition))) (setq definition (key-parse definition))) (define-key keymap (key-parse key) definition)) Robert --=20
X-Loop: help-debbugs@HIDDEN Subject: bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key Resent-From: Stefan Kangas <stefankangas@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Fri, 25 Nov 2022 00:15:01 +0000 Resent-Message-ID: <handler.59305.B59305.166933526123980 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 59305 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Robert Pluim <rpluim@HIDDEN> Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 59305 <at> debbugs.gnu.org Received: via spool by 59305-submit <at> debbugs.gnu.org id=B59305.166933526123980 (code B ref 59305); Fri, 25 Nov 2022 00:15:01 +0000 Received: (at 59305) by debbugs.gnu.org; 25 Nov 2022 00:14:21 +0000 Received: from localhost ([127.0.0.1]:60573 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1oyMMH-0006Ei-9E for submit <at> debbugs.gnu.org; Thu, 24 Nov 2022 19:14:21 -0500 Received: from mail-oi1-f182.google.com ([209.85.167.182]:38479) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>) id 1oyMM6-0006Dw-Uy for 59305 <at> debbugs.gnu.org; Thu, 24 Nov 2022 19:14:11 -0500 Received: by mail-oi1-f182.google.com with SMTP id v81so2935493oie.5 for <59305 <at> debbugs.gnu.org>; Thu, 24 Nov 2022 16:14:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=lKG54MzIytosaJwrBCRpgRJZMtMp2gvQbMNXDzK33UI=; b=HO1DMz0leLb5Z7WZufT5R7rwG4Twvak2M2aSfhdHJGCzgHawH8zVf+7+0Ulxf11owW GA6dCgdp25b7J0+rZgx+R0Vq++vQ2TllUIVT96XjmPPTKmhQ3OGmKqHtC/mV10C3Fv9T Qzr9I7HqZ6EjHnrAP1F2/kmcyPaXk3jfBlTA/aB9iFIObHz5anpXGfIMHJ0X56U6hvq8 LS7+5OrxbGR8+33/ZHPj9YU2pFtegJ95YEF/o5G/TEcN6oBeURWWOv3hFa28sRzzqgsl skkCty+MhAidAJbpphC5PUKxjxRvYx717QXvVclLOACJYOGfzetg+LEqy0ITWVJLc/y5 cEiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=lKG54MzIytosaJwrBCRpgRJZMtMp2gvQbMNXDzK33UI=; b=V6x4TpFcmtbh4sfc4/w2fms/6vx69IdDCK73YlnDN8XLWVT44i3Pmw7/zXDsXgB3jS xF7VliRUctacZyB5xx7WnqI/k513xwRhlhiTI7Shua50dKVoVI+QeawTNjIB0hGHndQQ ar+n3ZEWJGKFh9/cremnINJoZVj4N9EvL959BnWQzd7J3Pa6qrD6Ca8wQiat7uZefLel zCECDngOJj50iVnEpjnENc2P95yTF5HUukwFVBEAOOMkwssuH2yJxWRil5EdlB7PtOLy +jN8ve80XSA6e9xlrJvOqGeZ97M9OxaHcrIPA3hrxtLinnAVF33ZAMGjh0QVfUpaA0kU hMzw== X-Gm-Message-State: ANoB5pls49q3H7zCEHFayIVhWBm8/RSfRUoZQRLOaDhN9K4ZOb1FrZ+q gx/xm0GA5mn110GoGG0BJH3Eh49yZDqXLJVzw7Q= X-Google-Smtp-Source: AA0mqf4Ez1HgVrJIAZX3icd/sF8/UTisH/XzubVlp0SARLk/a9xMLuob6kRwfl9NXFRB5xJSdL7zozpSTkXCf8i8Zeg= X-Received: by 2002:a05:6808:2229:b0:35b:2b17:af81 with SMTP id bd41-20020a056808222900b0035b2b17af81mr7927055oib.199.1669335245428; Thu, 24 Nov 2022 16:14:05 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 24 Nov 2022 16:14:05 -0800 From: Stefan Kangas <stefankangas@HIDDEN> In-Reply-To: <87edu3cml8.fsf@HIDDEN> (Robert Pluim's message of "Wed, 16 Nov 2022 09:47:31 +0100") References: <87edu3cml8.fsf@HIDDEN> X-Hashcash: 1:20:221125:larsi@HIDDEN::ebJcydZyi9qZK+T9:1I9W MIME-Version: 1.0 Date: Thu, 24 Nov 2022 16:14:05 -0800 Message-ID: <CADwFkmmLXvGvdZvo5G=rVGaL71ZQMNc3NXrj7WXaATM0qksSMQ@HIDDEN> Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) 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 (-) Robert Pluim <rpluim@HIDDEN> writes: > After reading up on `key-valid-p': > > 5. (keymap-global-set "C-c h" "h e l l o") => success! > > or alternatively > > 6. (keymap-global-set "C-c h" [?h ?e ?l ?l ?o]) => 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. 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'. Could we perhaps introduce a new optional argument to treat the argument as a literal string? Or if really want it to not be `key-valid-p', to at least require it to be something like '(literal "foo") ? It would be useful to here what Lars thinks (in Cc).
X-Loop: help-debbugs@HIDDEN Subject: bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key Resent-From: Robert Pluim <rpluim@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Fri, 25 Nov 2022 08:03:01 +0000 Resent-Message-ID: <handler.59305.B59305.166936332918834 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 59305 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Kangas <stefankangas@HIDDEN> Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 59305 <at> debbugs.gnu.org Received: via spool by 59305-submit <at> debbugs.gnu.org id=B59305.166936332918834 (code B ref 59305); Fri, 25 Nov 2022 08:03:01 +0000 Received: (at 59305) by debbugs.gnu.org; 25 Nov 2022 08:02:09 +0000 Received: from localhost ([127.0.0.1]:33368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1oyTez-0004th-GQ for submit <at> debbugs.gnu.org; Fri, 25 Nov 2022 03:02:09 -0500 Received: from mail-wr1-f54.google.com ([209.85.221.54]:40688) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <rpluim@HIDDEN>) id 1oyTex-0004tR-7N for 59305 <at> debbugs.gnu.org; Fri, 25 Nov 2022 03:02:07 -0500 Received: by mail-wr1-f54.google.com with SMTP id x5so5571953wrt.7 for <59305 <at> debbugs.gnu.org>; Fri, 25 Nov 2022 00:02:07 -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:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=VlpSCyI+kmpbjGHKN4mZbQmizEWlfZDMM+CGRnULq3I=; b=FI5F2NDusoh/j+B/IDa5LVvxAvfIM90k8bQLdedLkvXwuqWSX5gCO5VfF/+7CaTZs+ 7DFcCBYeWKpr9grC5wTw2NnpR1ntpo+nYsXb70o6aqD7RU1eHhRJj9rv1/06A4vGQgty RGNUmhY5WdgwN4IXkJ6I1VoiJ0oh5+zzuaPyG7mtjPHrtEztIghmfIHdP9UV1fqiyR7/ Y+lvf7TjDYeeCIB3w32pSaXEOJKzXa9k81JAwXOfLqG9EgW1YR6VLoyI/wCjqNdnxgBb HucBa5QTsUzbR1y5Zgj0VNwDTibfMi0f4BJWlXngYv5Vld+YMO5TNn7Pd+4zS0n6lZf3 8XNQ== 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:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VlpSCyI+kmpbjGHKN4mZbQmizEWlfZDMM+CGRnULq3I=; b=ybU9wNe1Ke9b5w+0sN/q78wMOI4lC2lZRu0ED/xrF/L5MnbINaSfxlbPGNwgYlXtlh U5FUrfg38QsBHeExQKoUmZSci4ulMr0SFddUP9fyXDkf5PSugZvzpYS5Bckl3MYu42jC 1XbJxuSyHoYS9tLtkBfOBjuuPsKaP+9yJ+qoarqoU93OGl97k8Xbj/VWsT87nd/j0MVU n6WyF5aL5SlEM29Qn2Yjd3CCAZnXqE5K8k+D2k07LnblQLNahEq3WMGF2D1lDsRBBnv0 XNIx3j1UKbRUpAP7W5RF4aSxByKq8/iHDlo4/0NAX9UO+0yaUsbnl5mSnZc1tYciE6q5 XrNA== X-Gm-Message-State: ANoB5pmJ9k45cnbPLz03N1FNB3tqqpFqfPSw/Uy6tyioAiGAEVwrLY/K 2OEeCiQJaQvTDUTE6GOaJhE= X-Google-Smtp-Source: AA0mqf61AfNScu3adWPAKTbAeS5weTypYudC8TiwemkLW3Ya4cSMg4Zvxd71O0qOIrYHx6piYq/mkQ== X-Received: by 2002:a5d:5507:0:b0:236:8a6d:eaeb with SMTP id b7-20020a5d5507000000b002368a6deaebmr22162157wrv.208.1669363321277; Fri, 25 Nov 2022 00:02:01 -0800 (PST) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id n11-20020adfe78b000000b0023677fd2657sm3231942wrm.52.2022.11.25.00.02.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Nov 2022 00:02:00 -0800 (PST) From: Robert Pluim <rpluim@HIDDEN> In-Reply-To: <CADwFkmmLXvGvdZvo5G=rVGaL71ZQMNc3NXrj7WXaATM0qksSMQ@HIDDEN> (Stefan Kangas's message of "Thu, 24 Nov 2022 16:14:05 -0800") References: <87edu3cml8.fsf@HIDDEN> <CADwFkmmLXvGvdZvo5G=rVGaL71ZQMNc3NXrj7WXaATM0qksSMQ@HIDDEN> Date: Fri, 25 Nov 2022 09:01:59 +0100 Message-ID: <874junfonc.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) 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 Thu, 24 Nov 2022 16:14:05 -0800, Stefan Kangas <stefankangas@gmail= .com> said: Stefan> Robert Pluim <rpluim@HIDDEN> writes: >> After reading up on `key-valid-p': >>=20 >> 5. (keymap-global-set "C-c h" "h e l l o") =3D> success! >>=20 >> or alternatively >>=20 >> 6. (keymap-global-set "C-c h" [?h ?e ?l ?l ?o]) =3D> success! >>=20 >> Whilst not strictly a regression, this behaviour is confusing and >> unhelpful, and the solution is not easily found. I can think of two >> solutions: >>=20 >> 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. Stefan> I feel like the second alternative goes against the design of Stefan> `keymap-global-set', where the idea explicitly was to only supp= ort a KEY Stefan> argument that is `key-valid-p'. It was? If so, then it should not have been touted as the replacement for `global-set-key' everywhere without a big warning sign. Stefan> Could we perhaps introduce a new optional argument to treat the= argument Stefan> as a literal string? Or if really want it to not be `key-valid= -p', to Stefan> at least require it to be something like '(literal "foo") ? (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? Robert --=20
X-Loop: help-debbugs@HIDDEN Subject: bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key Resent-From: Stefan Kangas <stefankangas@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Fri, 25 Nov 2022 08:26:01 +0000 Resent-Message-ID: <handler.59305.B59305.166936474329808 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 59305 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Robert Pluim <rpluim@HIDDEN> Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 59305 <at> debbugs.gnu.org Received: via spool by 59305-submit <at> debbugs.gnu.org id=B59305.166936474329808 (code B ref 59305); Fri, 25 Nov 2022 08:26:01 +0000 Received: (at 59305) by debbugs.gnu.org; 25 Nov 2022 08:25:43 +0000 Received: from localhost ([127.0.0.1]:33410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1oyU1m-0007ki-PZ for submit <at> debbugs.gnu.org; Fri, 25 Nov 2022 03:25:43 -0500 Received: from mail-oa1-f49.google.com ([209.85.160.49]:42664) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>) id 1oyU1k-0007kV-Ub for 59305 <at> debbugs.gnu.org; Fri, 25 Nov 2022 03:25:41 -0500 Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-142b72a728fso4362829fac.9 for <59305 <at> debbugs.gnu.org>; Fri, 25 Nov 2022 00:25:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=RIkf/Bo7rk46+v9l7kODgWRsB/boVsUPGPBk3m8OqbA=; b=G1r+piO/hkBAAcKhmJiKQ/snTXz3HwjOjjteqvsZOQkdYH6LG4OpOYkd09YxclzDlc CCdrWi8/FAlMno7XIlIClEUCk3KdI0HFM26qnxoqhtJCjExT+kaskKeQ1AsQFhvqyK2x 7OkJsZEJLJVLz7R9Yfr5tMsu0Bl58UAwrnee1Ad1xJQ39RGrJHgu/g2oaCjQnDgnSzV0 DB/8bkL/MftLmDqPdeDRuZz7BoKRc9Dv92eo4d1PUM9BRRAuxtXAf6ZTDQ7BmeA+YTAj 5bxZcXgjDslwO8zbsL0yilpvTV4IMhpZIj9U4R2/CSqS4jS5EjD8ZgkWAFgc9z3WO7rs GeKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=RIkf/Bo7rk46+v9l7kODgWRsB/boVsUPGPBk3m8OqbA=; b=4sKIoB86+rkFsibbJTeu166ZfBnLHZszcGYScfLu7oT76dXCQX5mXtCqNGO8UNsPw2 1+HXquU5tQSZsg6BnW4QJ/aro+F+cD4xQeqbtbMk8Iv/kx4+2IX2FJtO87Gt0a0sJdoY VU/f1jYk73ysZ9K21FnY7GSSd9oTKunzCi8WaOIkv62ojwExbeAazFc8jhQJZKs/KdL3 YEv0okMou10NL5nd0YQ2O7WNVaBkGIY1E9BA5OsDzX6lZaWEFuOS9vr/Q/Jik7YcJtZy ka3Wbcwc9CSBIgG65SfU6qRVHuHs27AFkw5aVy0GVGxd0XFKJvINAwh7Apa7WjeIrorU pMwg== X-Gm-Message-State: ANoB5pkbdi6mZnrZlJAziLuRntqpBJZd/buTTI442WEeoRf1avQuMAbp SvI/V4zOlo66OQa/nK3LhgwZuMgjnymhVc4JoJU= X-Google-Smtp-Source: AA0mqf7jPY4T0n9icUyBvvv2EJ7kMYn1Ip0HJbhJ6BgyuGEhNkSmFKHwOqGRL+5Ovg3CYmDzI30XcQUBMtweVXeLbgg= X-Received: by 2002:a05:6870:4995:b0:143:522a:ebcc with SMTP id ho21-20020a056870499500b00143522aebccmr3544238oab.199.1669364735460; Fri, 25 Nov 2022 00:25:35 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 25 Nov 2022 00:25:34 -0800 From: Stefan Kangas <stefankangas@HIDDEN> In-Reply-To: <874junfonc.fsf@HIDDEN> References: <87edu3cml8.fsf@HIDDEN> <CADwFkmmLXvGvdZvo5G=rVGaL71ZQMNc3NXrj7WXaATM0qksSMQ@HIDDEN> <874junfonc.fsf@HIDDEN> X-Hashcash: 1:20:221125:larsi@HIDDEN::f96494pB2znPILXC:2YE9 MIME-Version: 1.0 Date: Fri, 25 Nov 2022 00:25:34 -0800 Message-ID: <CADwFkmmp_nwiFSzaydskJWSi9uLS8gTJkewvF7cVBK8od6QsHg@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) 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 (-) Robert Pluim <rpluim@HIDDEN> writes: > Stefan> I feel like the second alternative goes against the design of > Stefan> `keymap-global-set', where the idea explicitly was to only su= pport a KEY > Stefan> argument that is `key-valid-p'. > > It was? If so, then it should not have been touted as the replacement > for `global-set-key' everywhere without a big warning sign. Yes, see the discussions about it at the time. The same idea is there in all the new keybinding functions. > Stefan> Could we perhaps introduce a new optional argument to treat t= he argument > Stefan> as a literal string? Or if really want it to not be `key-val= id-p', to > Stefan> at least require it to be something like '(literal "foo") ? > > (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' d= o that > internally instead of forcing users to jump through hoops? AFAIU, because otherwise we can't have error handling for common typos, such as: (keymap-global-set "xo") ; bad, I actually want "x o" I think catching this is more important than supporting the somewhat nicer syntax for inserting strings with a key binding (which you can still do by other means, as you point out).
X-Loop: help-debbugs@HIDDEN Subject: bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key Resent-From: Robert Pluim <rpluim@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 15 Dec 2022 08:43:01 +0000 Resent-Message-ID: <handler.59305.B59305.167109377732644 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 59305 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Kangas <stefankangas@HIDDEN> Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 59305 <at> debbugs.gnu.org Received: via spool by 59305-submit <at> debbugs.gnu.org id=B59305.167109377732644 (code B ref 59305); Thu, 15 Dec 2022 08:43:01 +0000 Received: (at 59305) by debbugs.gnu.org; 15 Dec 2022 08:42:57 +0000 Received: from localhost ([127.0.0.1]:42531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1p5jpQ-0008US-UG for submit <at> debbugs.gnu.org; Thu, 15 Dec 2022 03:42:57 -0500 Received: from mail-wr1-f45.google.com ([209.85.221.45]:36362) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <rpluim@HIDDEN>) id 1p5jpO-0008UL-NH for 59305 <at> debbugs.gnu.org; Thu, 15 Dec 2022 03:42:55 -0500 Received: by mail-wr1-f45.google.com with SMTP id h10so2284413wrx.3 for <59305 <at> debbugs.gnu.org>; Thu, 15 Dec 2022 00:42:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=xsg+WFuvyYGWNulBHAOci4SRzwv8fBGhz8r0aPueCGo=; b=YgQJvHH2unKsp5yOUks9sip462dC+8O+rA+96Uf6NIEiwGAW7N8Sq0byD25/BcCOaB PyPC/c0LgApO5+RfGYVfKsmvIO1a1SiNFNykKpsNT0yPy1NQyfkal3D4GNGyF1IV2p1D vdScxVP3qAT3nIRCcOjs2t5OvKBCYuhgOohPnmwEjhieYshXb4diWNTtRAt+zaLFPEVe 7LfnOosqYIKFa616jaz+I5MmFKU9Z6hkq8oeNC5/htK8Sh818KO3lLQbTV47sJhyh5qa /WjewXqeJC92gTziQIg9k5B86N1ofZzndAlnT/6UJfsMf4/9n5xWJckfyGwHpKNbOGqV Bj3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=xsg+WFuvyYGWNulBHAOci4SRzwv8fBGhz8r0aPueCGo=; b=C7dZ3FA8zLi9lj1jM2XMEYrJhffbGin5p4Kt2OigshDw2RAehMlr45KLrjArF0Lq/q 0Axol161V73LtBCWyfrP447fqdROcQ5shn8dWzF4FtTDB2kH/pLQf9Bdn3XI5/RDgEVb 4cCyP5t6K/JtkX7Oi+g+4Ig203jNW5/218/iXDJ/6iWQXVqM/ORk+wTYsIawtXaec9U7 +itbgvbej4s7GDbW6i3Kio9MwpipgcZQ+FzXjFlt+6yCRQyQOsYhND0ZicG8zdefzysc OZ+RDABV4GHe/VM6M24uAsVpKP6CCQYOoSs0B4e4AvKiG4WbIqlj9xgO7tp7hI5bAlC8 ZtkQ== X-Gm-Message-State: ANoB5ployN6yzyJN+rMEJ4zFneiOq+04gERBhQHzRUSf5tPFCQAIHgne Ho2sdyaDJRIzZUTmN2hvfUAtylzNSP8= X-Google-Smtp-Source: AA0mqf7BMpYlZYavXZz8ZUQC8euft+e4F8TbNLfyvk4LJdjMzhqgnK11c2vTwfOyNGcDrtSnLv+wWQ== X-Received: by 2002:adf:f645:0:b0:242:1e1f:2d89 with SMTP id x5-20020adff645000000b002421e1f2d89mr16557415wrp.60.1671093768321; Thu, 15 Dec 2022 00:42:48 -0800 (PST) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id t16-20020a5d42d0000000b00236545edc91sm5214875wrr.76.2022.12.15.00.42.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 00:42:47 -0800 (PST) From: Robert Pluim <rpluim@HIDDEN> In-Reply-To: <CADwFkmmp_nwiFSzaydskJWSi9uLS8gTJkewvF7cVBK8od6QsHg@HIDDEN> (Stefan Kangas's message of "Fri, 25 Nov 2022 00:25:34 -0800") References: <87edu3cml8.fsf@HIDDEN> <CADwFkmmLXvGvdZvo5G=rVGaL71ZQMNc3NXrj7WXaATM0qksSMQ@HIDDEN> <874junfonc.fsf@HIDDEN> <CADwFkmmp_nwiFSzaydskJWSi9uLS8gTJkewvF7cVBK8od6QsHg@HIDDEN> Date: Thu, 15 Dec 2022 09:42:46 +0100 Message-ID: <87r0x1njll.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) 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 Fri, 25 Nov 2022 00:25:34 -0800, Stefan Kangas <stefankangas@HIDDEN> said: Stefan> AFAIU, because otherwise we can't have error handling for common typos, Stefan> such as: Stefan> (keymap-global-set "xo") ; bad, I actually want "x o" Stefan> I think catching this is more important than supporting the somewhat Stefan> nicer syntax for inserting strings with a key binding (which you can Stefan> still do by other means, as you point out). 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) Robert --
X-Loop: help-debbugs@HIDDEN Subject: bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key Resent-From: Robert Pluim <rpluim@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Fri, 26 Apr 2024 14:36:02 +0000 Resent-Message-ID: <handler.59305.B59305.171414210429510 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 59305 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Kangas <stefankangas@HIDDEN> Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 59305 <at> debbugs.gnu.org Received: via spool by 59305-submit <at> debbugs.gnu.org id=B59305.171414210429510 (code B ref 59305); Fri, 26 Apr 2024 14:36:02 +0000 Received: (at 59305) by debbugs.gnu.org; 26 Apr 2024 14:35:04 +0000 Received: from localhost ([127.0.0.1]:38181 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s0MfE-0007fE-Fe for submit <at> debbugs.gnu.org; Fri, 26 Apr 2024 10:35:03 -0400 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]:47585) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <rpluim@HIDDEN>) id 1s0MfA-0007dI-6E for 59305 <at> debbugs.gnu.org; Fri, 26 Apr 2024 10:34:59 -0400 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2d8b2389e73so26495031fa.3 for <59305 <at> debbugs.gnu.org>; Fri, 26 Apr 2024 07:34:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714142071; x=1714746871; 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=x6xYN2NiRvz5zD4LY2cZ2LVUtf0/2Q9mexFmE2hIhjI=; b=Uqx2ULPNOrQ/5ys1LdF++8CKTSjWKPuBnVdDInPhtAiJFHg8JkGSekffAEk05Gbxti Km0cCk7dXpJS+HzRxDYcVH1LegrvhIfnw+M+ohFjc684HWnuWW//CjMxwL1jSCsb7HiA orAcm9Q7Glx+Vdi5akOqenXb20toFVxtiuErEerIaMtlwaHTKLXUlFWy5o/j1CmdfDmG evaO/ZC6UyYFHDNaOSnr6kO+ZdpqPla4NPaTC6jkDiMrTor8bRDpbE9qUGbsjLhB+1rJ 0k+/gzk7iO5p0MaEuIOvU9JJfK1+46WECVEF4mTTo6n4qAMvNxH1Z7xrqsuHhSx8jPuD Y4PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714142071; x=1714746871; 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=x6xYN2NiRvz5zD4LY2cZ2LVUtf0/2Q9mexFmE2hIhjI=; b=lBb/TGLF1LtO6FsM86rfPHRnMU7ZFFk7oOz7V/qzAsDMirGWtoDIncNf9i4ETEJ6eV psWEnlKVB7GG10Fnhn9NAdWs18anD0Z+WNXWv/Cdm5bap4gb8bpk8FiJ0WpUmVFiuZyZ X9UFDCGA37D6Kl5i7n1HWxOSB2PMOTg9nVf/7PElS7I5WlSn3pgnoiHuhfrSL8tIoHxx B/kNTx7clVzdLvBLqRUPtnY3ONTnJNqzb767cXSJWCANKDvpjRNYGVAD1r1CWtwRXLkb ne5wMf+485mokZkJByjMDfhNU8W+76dghakzOgAye99yV/X8kFl6xi8A2OZBzMIm5UcK m6Qw== X-Forwarded-Encrypted: i=1; AJvYcCW6vxWXDwPyjT+6m/DkfaberXerHPCTX5cXzfOwXybDfLJo3CIY4bKpUD0kjeXOLfcZXwUPxFvNKZAGTcIDPRYWScTrLLs= X-Gm-Message-State: AOJu0YzbGjJ5TNsRo3Esk/rlS4hBxmVT86phFHC77DimJrXMJFClp9Co i7wFN9TXzs7MbuLfpFPBF0o8kVCf6z2tNStYpId5JvuK5OKR5CU5y1hkwg== X-Google-Smtp-Source: AGHT+IGIwxIHu1d0rEqbUSuC9EUUqBqN+bFh+1hi3K0pOZ7FqJjPeIp7FNGijDAZj5Xi9oTuWzo5+w== X-Received: by 2002:a2e:a284:0:b0:2d8:5a5e:7c5e with SMTP id k4-20020a2ea284000000b002d85a5e7c5emr1680986lja.22.1714142071001; Fri, 26 Apr 2024 07:34:31 -0700 (PDT) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id jx6-20020a05600c578600b004185be4baefsm1507494wmb.0.2024.04.26.07.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 07:34:30 -0700 (PDT) From: Robert Pluim <rpluim@HIDDEN> In-Reply-To: <87r0x1njll.fsf@HIDDEN> (Robert Pluim's message of "Thu, 15 Dec 2022 09:42:46 +0100") References: <87edu3cml8.fsf@HIDDEN> <CADwFkmmLXvGvdZvo5G=rVGaL71ZQMNc3NXrj7WXaATM0qksSMQ@HIDDEN> <874junfonc.fsf@HIDDEN> <CADwFkmmp_nwiFSzaydskJWSi9uLS8gTJkewvF7cVBK8od6QsHg@HIDDEN> <87r0x1njll.fsf@HIDDEN> Date: Fri, 26 Apr 2024 16:34:29 +0200 Message-ID: <87bk5wqjka.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) 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 Thu, 15 Dec 2022 09:42:46 +0100, Robert Pluim <rpluim@HIDDEN> s= aid: Robert> Then perhaps we should just change the docstrings and manual to Robert> explain that binding a key to a string of characters should use Robert> `kmacro' (since `kbd' is not the right thing for ASCII-only ent= ry) I was going to write 'Stefan why did you overwrite my patch', but it=CA=BCs me who didn=CA=BCt follow up :-) Changing `kbd' to always return a vector, attractive as it is to the purist in me, falls foul of existing code that expects eg `(kbd "RET")' to return a string (and that=CA=BCs just in Emacs=CA=BC code). I gu= ess we could add an 'always produce a vector' argument to `kbd', but perhaps just recommending `kmacro' is best, since it=CA=BCs a fairly niche usage. This is against emacs-29 Robert --=20 diff --git c/doc/emacs/custom.texi i/doc/emacs/custom.texi index 4bd78f3ce83..d59440e203d 100644 --- c/doc/emacs/custom.texi +++ i/doc/emacs/custom.texi @@ -1933,8 +1933,38 @@ Init Rebinding (keymap-global-set "<mouse-2>" 'mouse-save-then-kill) @end example =20 - Language and coding systems may cause problems with key bindings for -non-@acronym{ASCII} characters. @xref{Init Non-ASCII}. +@cindex binding key to string + Key sequences can also be bound directly to Lisp strings rather than +commands. Such strings are written using the same syntax as key +sequences. For example, to bind @kbd{C-c h} to the string +@samp{hello}: + +@example +(keymap-global-set "C-c h" "h e l l o") +@end example + + Since this is somewhat cumbersome to write, the convenience function +@code{kmacro} can be used instead: + +@example +(keymap-global-set "C-c h" (kmacro "hello")) +@end example + + Non-@acronym{ASCII} characters can be specified directly in the +string. To bind to e.g. @samp{ol@U{00E1}}, use: + +@example +(keymap-global-set "C-c h" (kmacro "ol@U{00E1}")) +@end example + + However, be aware that language and coding systems may cause +problems with key bindings for non-@acronym{ASCII} characters. +@xref{Init Non-ASCII}. It may thus be better to use the following +instead: + +@example +(keymap-global-set "C-c h" (kmacro "ol\u00E1")) +@end example =20 @findex global-set-key @findex define-key diff --git c/lisp/keymap.el i/lisp/keymap.el index 4bdf65d39fa..592a9fd89ab 100644 --- c/lisp/keymap.el +++ i/lisp/keymap.el @@ -84,6 +84,9 @@ keymap-global-set If COMMAND is a string (which can only happen when this function is called from Lisp), it must satisfy `key-valid-p'. =20 +The `kmacro' convenience function converts a simple string of +characters to an equivalent form that is acceptable for COMMAND. + Note that if KEY has a local binding in the current buffer, that local binding will continue to shadow any global binding that you make with this function." @@ -108,6 +111,9 @@ keymap-local-set If COMMAND is a string (which can only happen when this function is called from Lisp), it must satisfy `key-valid-p'. =20 +The `kmacro' convenience function converts a simple string of +characters to an equivalent form that is acceptable for COMMAND. + The binding goes in the current buffer's local keymap, which in most cases is shared with all other buffers in the same major mode." (declare (compiler-macro (lambda (form) (keymap--compile-check key) form= ))
X-Loop: help-debbugs@HIDDEN Subject: bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 02 May 2024 09:03:01 +0000 Resent-Message-ID: <handler.59305.B59305.171464053321876 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 59305 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Robert Pluim <rpluim@HIDDEN>, Stefan Monnier <monnier@HIDDEN> Cc: larsi@HIDDEN, 59305 <at> debbugs.gnu.org, stefankangas@HIDDEN Received: via spool by 59305-submit <at> debbugs.gnu.org id=B59305.171464053321876 (code B ref 59305); Thu, 02 May 2024 09:03:01 +0000 Received: (at 59305) by debbugs.gnu.org; 2 May 2024 09:02:13 +0000 Received: from localhost ([127.0.0.1]:42507 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s2SKT-0005gm-FA for submit <at> debbugs.gnu.org; Thu, 02 May 2024 05:02:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1s2SKR-0005gg-Rb for 59305 <at> debbugs.gnu.org; Thu, 02 May 2024 05:02:12 -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 1s2SK0-00006u-6B; Thu, 02 May 2024 05:01:44 -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=cz7AR0/BnG49G9g+XHbxNqv9tYzuHX3kliytC3UuK4k=; b=qZmoQtbtYH0euvYL3T4a Kib8wokvRwyymNfXVnge5NjInluZVUrH7CW3OsXX0TRQWwtQWN+WxtgEDH4zaxC9sSAFIpyPubNA2 Da2ZdmaN1ZxDMSk7q15FHT/x2PavnDzOnjf9+AGH38LBI10lkRFIb6oCwvzEEgoEMmKQNHSqRvnzw 4S9BhPcdpHgmFR9D+xsIEO/A+gh5UwUszu9Jmlt+Hq8HODPXkIRZMc6q44Ay8CqyzqI/OrgDi/utW GRaVzBSyIs+uUcJ3mAhcIvsOtb154G3nSPCqG0du3PAcqY31sb9B7Xi1B5NJk9FWlx8sTTnkw+1fb a6zD0ooPc/5egw==; Date: Thu, 02 May 2024 12:01:41 +0300 Message-Id: <86cyq4mvt6.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <87bk5wqjka.fsf@HIDDEN> (message from Robert Pluim on Fri, 26 Apr 2024 16:34:29 +0200) References: <87edu3cml8.fsf@HIDDEN> <CADwFkmmLXvGvdZvo5G=rVGaL71ZQMNc3NXrj7WXaATM0qksSMQ@HIDDEN> <874junfonc.fsf@HIDDEN> <CADwFkmmp_nwiFSzaydskJWSi9uLS8gTJkewvF7cVBK8od6QsHg@HIDDEN> <87r0x1njll.fsf@HIDDEN> <87bk5wqjka.fsf@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) 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: Lars Ingebrigtsen <larsi@HIDDEN>, 59305 <at> debbugs.gnu.org > From: Robert Pluim <rpluim@HIDDEN> > Date: Fri, 26 Apr 2024 16:34:29 +0200 > > >>>>> On Thu, 15 Dec 2022 09:42:46 +0100, Robert Pluim <rpluim@HIDDEN> said: > > > Robert> Then perhaps we should just change the docstrings and manual to > Robert> explain that binding a key to a string of characters should use > Robert> `kmacro' (since `kbd' is not the right thing for ASCII-only entry) > > I was going to write 'Stefan why did you overwrite my patch', but itʼs > me who didnʼt follow up :-) > > Changing `kbd' to always return a vector, attractive as it is to the > purist in me, falls foul of existing code that expects eg `(kbd > "RET")' to return a string (and thatʼs just in Emacsʼ code). I guess > we could add an 'always produce a vector' argument to `kbd', but > perhaps just recommending `kmacro' is best, since itʼs a fairly niche > usage. > > This is against emacs-29 Stefan, any comments?
X-Loop: help-debbugs@HIDDEN Subject: bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key Resent-From: Stefan Monnier <monnier@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 02 May 2024 13:15:02 +0000 Resent-Message-ID: <handler.59305.B59305.171465565522498 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 59305 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Kangas <stefankangas@HIDDEN> Cc: Robert Pluim <rpluim@HIDDEN>, 59305 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN> Received: via spool by 59305-submit <at> debbugs.gnu.org id=B59305.171465565522498 (code B ref 59305); Thu, 02 May 2024 13:15:02 +0000 Received: (at 59305) by debbugs.gnu.org; 2 May 2024 13:14:15 +0000 Received: from localhost ([127.0.0.1]:43711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s2WGM-0005qo-Hp for submit <at> debbugs.gnu.org; Thu, 02 May 2024 09:14:14 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:22988) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1s2WGJ-0005qg-QA for 59305 <at> debbugs.gnu.org; Thu, 02 May 2024 09:14:13 -0400 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== 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) 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) From: Stefan Monnier <monnier@HIDDEN> In-Reply-To: <CADwFkmmLXvGvdZvo5G=rVGaL71ZQMNc3NXrj7WXaATM0qksSMQ@HIDDEN> (Stefan Kangas's message of "Thu, 24 Nov 2022 16:14:05 -0800") Message-ID: <jwvr0ekbcri.fsf-monnier+emacs@HIDDEN> References: <87edu3cml8.fsf@HIDDEN> <CADwFkmmLXvGvdZvo5G=rVGaL71ZQMNc3NXrj7WXaATM0qksSMQ@HIDDEN> Date: Thu, 02 May 2024 09:13:41 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.003 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-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 (---) >> 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 <foo> "C-a") remap that <foo> 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
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.