GNU bug report logs - #60867
29.0.60; keymap-set-after does not accept the AFTER=t argument

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Mon, 16 Jan 2023 18:21:01 UTC

Severity: normal

Tags: fixed

Found in version 29.0.60

Fixed in version 29.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Daniel Mendler <mail <at> daniel-mendler.de>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 60867 <at> debbugs.gnu.org
Subject: bug#60867: 29.0.60; keymap-set-after does not accept the AFTER=t argument
Date: Thu, 19 Jan 2023 16:38:38 +0100

On 1/19/23 16:27, Robert Pluim wrote:
>>>>>> On Thu, 19 Jan 2023 12:19:19 +0100, Daniel Mendler <mail <at> daniel-mendler.de> said:
> 
>     Daniel> On 1/19/23 12:05, Robert Pluim wrote:
> 
>     Daniel> My point is that it would be expected from `key-parse' that it is
>     Daniel> equally strict as the other keymap functions, otherwise we miss bugs
>     Daniel> where `key-parse' wasn't used properly. Furthermore we would avoid all
>     Daniel> these `key-valid-p` and `keymap--check' calls, as I mentioned.
> 
> `key-parse' should perhaps be renamed to `key--parse' as itʼs very
> much internal.

Yes, that would be another possibility. I also thought about that, but
having key-parse public seems useful for packages. There should be an
official way to convert from the string to the internal key representation.

My only gripe with key-parse in its current form is really that it is
not strict enough. Another possibility in case we don't want to
introduce a NOERROR/LAX argument:

key-parse (strict) calls key-valid-p and key--parse-lax
kbd calls key--parse-lax

>     Daniel> Of course `kbd' should stay as lax as it has always been.
> 
>     Daniel> It is mostly used internally. There are only 9 call sites in the Emacs code.
> 
>     >> Iʼll make
>     >> that change locally and see what happens. (Update: it did not go well,
>     >> there are test-suite failures).
> 
>     Daniel> This is hardly an argument. You should check all the call sites and
>     Daniel> adjust accordingly. In particular `kbd' must pass 'noerror. I would
>     Daniel> expect this to be a pretty small patch given the small number of call sites.
> 
> The test suite shows what peopleʼs assumptions are, so such failures
> are valuable. It may be enough to use 'noerror in `kbd', indeed, but I
> havenʼt checked that yet. Or maybe the test suite needs adjusting.

Yes, of course. But I assume that in this case the failure is not coming
from direct calls to key-parse but from calls to kbd etc. The key-parse
itself doesn't seem to be really tested in the Emacs test suite.

I also maintain a test suite as part of the Compat package for newly
introduced APIs. There I also have tests, which could be upstreamed to
the Emacs test suite if there is interest, since some functions lack
tests there. See
https://github.com/emacs-compat/compat/blob/master/compat-tests.el

Daniel




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

Previous Next


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