From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: m43cap@yandex.com, larsi@gnus.org, 64927@debbugs.gnu.org
Subject: bug#64927: 30.0.50; kill-ring with no X
Date: Thu, 03 Aug 2023 17:13:13 -0400 [thread overview]
Message-ID: <jwvsf8z4z6v.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83tttgvv6g.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 03 Aug 2023 21:26:47 +0300")
>> The best we can do is to use `key-valid-p` as a best-effort test to
>> decide whether we're in the presence of the new or the old format, but
>> it will inevitably suffer from false positives/negatives.
>
> Not sure I understand: if key-valid-p returns nil, what do you suggest
> to do with "keys" such as those produced in the scenario of this bug
> report?
I suggest we do:
diff --git a/src/keymap.c b/src/keymap.c
index da2af98c2d6..eec3e884935 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1066,7 +1066,7 @@ possibly_translate_key_sequence (Lisp_Object key, ptrdiff_t *length)
build_string ("`key-valid-p' is not defined, so this syntax can't be used: %s"),
key);
if (NILP (call1 (Qkey_valid_p, AREF (key, 0))))
- xsignal2 (Qerror, build_string ("Invalid `key-parse' syntax: %S"), key);
+ return key;
key = call1 (Qkey_parse, AREF (key, 0));
*length = CHECK_VECTOR_OR_STRING (key);
if (*length == 0)
With this change,
(let ((map (make-sparse-keymap))) (define-key map ["he"] 'hello) map)
returns (keymap ("he" . hello)) as before, and emits a message:
Key sequence contains invalid event he
whereas
(let ((map (make-sparse-keymap))) (define-key map ["h e"] 'hello) map)
returns (keymap (104 keymap (101 . hello))).
I think this new [KBDSTRING] syntax was probably a mistake, in
retrospect: it made sense at the time, but we should have removed it
afterwards when we introduced the new `key-*` functions.
Stefan
next prev parent reply other threads:[~2023-08-03 21:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-29 9:47 bug#64927: 30.0.50; kill-ring with no X Colin Baxter
2023-07-29 11:25 ` Colin Baxter
2023-08-03 9:51 ` Eli Zaretskii
2023-08-03 15:11 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-03 16:00 ` Eli Zaretskii
2023-08-03 16:06 ` Eli Zaretskii
2023-08-03 16:30 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-03 18:26 ` Eli Zaretskii
2023-08-03 21:13 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-08-04 6:14 ` Colin Baxter
2023-08-04 6:38 ` Eli Zaretskii
2023-08-03 19:55 ` Colin Baxter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvsf8z4z6v.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=64927@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=larsi@gnus.org \
--cc=m43cap@yandex.com \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).