emacs-devel
[Top][All Lists]
Advanced

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

cl-lib warnings (was: bug#60102: Move gv-expander of substring to cl-lib


From: Stefan Monnier
Subject: cl-lib warnings (was: bug#60102: Move gv-expander of substring to cl-lib)
Date: Tue, 20 Dec 2022 13:42:32 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

>> The `gv-expander` of `substring` uses the `cl--set-substring` function
>> that's defined only in `cl-lib`, so currently, you can compile
>>
>>     (setf (substring ...) ...)
>>
>> without requiring `cl-lib` but at run time it will tend to signal
>> a `void-function` error.
>> We could autoload `cl--set-substring`, but I think a better choice is to
>> move this `gv-expander` to `cl-lib.el`.
>
> I tried your patch by evaluating `(tab-bar-make-keymap-1)`,
> but it still fails with:

My match was indeed motivated by the `tar-bar.el` code, but it doesn't
fix the `tab-bar.el` code, indeed.

The problem of the `tab-bar.el` code is (well, was, since I changed it
in the mean time) that `(setf (substring ...) ...)` needs `cl-lib` but
`tab-bar.el` doesn't `(require 'cl-lib)`.

It is compounded by the fact that `cl-lib` is preloaded in
`src/bootstrap-emacs`, so we don't get a compiler warning about
the possibility that `cl--set-substring` won't be available at runtime,
since `tab-bar.el` is preloaded and hence compiled by `src/bootstrap-emacs`.

And even if you try to recompile it with `src/emacs`, you still
won't get a compilation warning if you're using the native compiler,
because the native compiler itself requires `cl-lib`.

IOW, it's becoming difficult to be warned by the compiler about missing
`(require 'cl-lib)` :-(

Looking at historical evolution, I think the sanest way to fix this is
to preload `cl-lib`.


        Stefan




reply via email to

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