GNU bug report logs - #64927
30.0.50; kill-ring with no X

Previous Next

Package: emacs;

Reported by: Colin Baxter <m43cap <at> yandex.com>

Date: Sat, 29 Jul 2023 09:48:02 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #32 received at 64927 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: m43cap <at> yandex.com, larsi <at> gnus.org, 64927 <at> debbugs.gnu.org
Subject: Re: bug#64927: 30.0.50; kill-ring with no X
Date: Thu, 03 Aug 2023 17:13:13 -0400
>> 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





This bug report was last modified 2 years and 21 days ago.

Previous Next


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