emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs Lisp Linter fail to identify function defined in a "use-packag


From: Emanuel Berg
Subject: Re: Emacs Lisp Linter fail to identify function defined in a "use-package" block
Date: Fri, 13 Oct 2023 03:47:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

> Well, here the discussion can go both ways! Because in a way
> it makes sense that every file `provide' its stuff, and
> every other file that wants to use it `require' it.

Yes, this is a huge problem if you want to tidy up one's Elisp
using elint. You get so many warnings this or that variable
isn't known to be defined, you check where it is defined but
that source file isn't `provide'd or in some cases (e.g.
`float-pi') it is incorrectly provided (i.e. it is defined in
float-sup.el but that file provides its services as
"lisp-float-type").

Note that this isn't elint's fault, on the contrary, the fault
is with those files. But what happens is the interesting
situation that one cannot use elint to tidy up one's Elisp,
because the Elisp of vanilla Emacs isn't tidy enough. Not good!

Yeah, all files should `require' everything they need and
provide itself in the end. This situation in itself isn't
optimal - well, as we have just seen, it is error prone -
since it can and should be automated, there is no need to rely
on humans to do this work, however now it isn't and that means
one must get it right manually.

> Update 1, elint is correctly seeing defuns in lexical
> let-closures, and there is no need to use `declare-function'
> for it do that as was incorrectly theorized the day before.
> This is interesting because the byte-compiler does not see
> those so there declare-function is needed.

Unfortunately, this isn't exactly true either. Both elint and
the byte-compiler are silent if a defun in a lexical
let-closure is just defined. However if and where it is
_used_, elint cannot see it, and `define-function' doesn't
help. define-function does shut up the byte-compiler in this
situation tho.

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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