EmilySeville7cfg · 2022-08-22 07:30
Why `flycheck` warns me about undefined `cl-parse-integer` but code still works? I expected to see any runtime error. I have emacs 28.1.
​
https://preview.redd.it/879ootdaw7j91.png?width=1920&format=png&auto=webp&s=389e2a53e821372ec862485a88253829c8b77136
Here is my [.emacs](https://github.com/EmilySeville7cfg/personal-editor-configs/blob/main/Emacs/.emacs) config.
lebensterben · 2022-08-22 07:48
it works because the symbol is defined at runtime.
flycheck uses static analysis and there's no way to tell if the symbol is valid unless it's defined.
you need either write (require 'cl-lib) or (declare-function cl-parse-integer "cl-lib" (string &key start end radix junk-allowed))
7890yuiop · 2022-08-22 09:48
flycheck is potentially byte-compiling in a separate/clean instance of Emacs, in which case it will see problems that you are masking on account of your config also loading other code which happens to define `cl-parse-integer` along the way.
EmilySeville7cfg · 2022-08-22 11:16
How can I make my program execution to fail without `(require 'cl-lib)`? I want to prove myself that `require` in this case not just for warning disable.
lebensterben · 2022-08-22 21:19
I already explained.
accoil · 2022-08-23 20:18
`cl-lib` is common, so one of your packages is probably already requiring it. To test this you need to load emacs without your config with`emacs -Q`. Then try executing `(cl-lib-parse-integer "123")`. It won't run until you also execute `(require 'cl-lib)`.