GNU bug report logs -
#72313
31.0.50; Warning about cl-member possibly being undefined when using cl-pushnew
Previous Next
Reported by: Tassilo Horn <tsdh <at> gnu.org>
Date: Fri, 26 Jul 2024 20:30:02 UTC
Severity: normal
Found in version 31.0.50
Done: Tassilo Horn <tsdh <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):
Arash Esbati <arash <at> gnu.org> writes:
> Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs <at> gnu.org> writes:
>
>>> So the conclusion is to simply (require 'cl-lib) instead of
>>> (eval-when-compile (require 'cl-lib))? But how can the
>>> byte-compiler conclude that cl-member might not be defined at
>>> runtime given that it's an autoloaded function?
>>
>> It's autoloaded from `cl-seq` when `cl-lib` is loaded.
>> It's not autoloaded at startup.
What's that magic?
emacs -Q
(featurep 'cl-lib) ;=> nil
(describe-function 'cl-member) ; prints the help string to *Messages*
(featurep 'cl-lib) ;=> t
Do the help facilities load stuff on demand?
> How about this approach then?
>
> --8<---------------cut here---------------start------------->8---
> diff --git a/tex-info.el b/tex-info.el
> index dc69762e..0f77e057 100644
> --- a/tex-info.el
> +++ b/tex-info.el
> @@ -25,7 +25,8 @@
> ;;; Code:
>
> (eval-when-compile
> - (require 'cl-lib))
> + (require 'cl-lib)
> + (declare-function cl-member "cl-seq"))
>
> (require 'tex)
> --8<---------------cut here---------------end--------------->8---
Let's just require cl-lib. declare-function only silences the
byte-compiler and the usage of cl-member at runtime is a fact; no
cheating allowed. It's also an implementation detail we should not
bother with. Tomorrow, Stefan might have optimized it to use some
cl-memql-1-wazzup for the specific case we have here. :-)
Bye,
Tassilo
This bug report was last modified 350 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.