I just saw this line near the top of the file use-package.el:
(declare-function package-installed-p 'package)
How can 'package be a useful 2nd argument, when the doc for declare-function says that the third argument should be a filename?
I just saw this line near the top of the file use-package.el:
(declare-function package-installed-p 'package)
How can 'package be a useful 2nd argument, when the doc for declare-function says that the third argument should be a filename?
It means the function is defined by the file providing the feature package which is package.el. It's the same as with(require 'foo) which will also load a file foo.elfrom theload-path.
I emailed JohnWiegley, and he said the following:
That code was contributed by another, but I'm fairly certain it's just using the symbol-name of the symbol. The same sort of thing works with eval-after-load:
(eval-after-load "foo" ...)
(eval-after-load 'foo ...)
How can
'packagebe a useful 2nd argument, when the doc fordeclare-functionsays that the third argument should be a filename?
It's a mistake in use-package.el, now fixed. If you run check-declare on the unfixed version you'll see in *Messages*:
Malformed declaration for `package-installed-p'
Malformed declaration for `(, command)'
The first is the 'package mistake, the second is a false positive on use-package code that generates a declare-function statement call.
The reason it's like this, is that check-declare-scan works by regexp rather than actually parse the lisp code, so it can't be 100% certain about which statements are real.