bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60867: 29.0.60; keymap-set-after does not accept the AFTER=t argumen


From: Daniel Mendler
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@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]