alphapapa / makem.sh

Makefile-like script for linting and testing Emacs Lisp packages
GNU General Public License v3.0
163 stars 13 forks source link

makem.el:68:133 Warning: the function ‘project-files’ is not known to be defined #37

Closed progfolio closed 1 year ago

progfolio commented 2 years ago

When compiling in a clean environment, the following warning is emitted:

makem.el:68:133 Warning: the function ‘project-files’ is not known to be defined

This is because the reader in the transient definition for the "Exclude files" option calls:

(project-files (project-current))

project-current is autoloaded so project.el is properly loaded when the call to the (not autoloaded) function project-files happens, but the byte-compiler will complain about this as it does not know that. Probably best to explicitly require project to be safe.

progfolio commented 2 years ago

Actually, I get the same error when calling the transient command in an interactive session until I explicitly require project.el

akirak commented 2 years ago

@progfolio A proper way to fix the byte-compile warning would be to add a declare-function clause:

(declare-function project-files "project")

Also note that, as far as I remember, older versions of project.el did not have project-files generic function, but this should be detected by package-lint. Emacs 27.1 shipped project.el 0.6.

progfolio commented 2 years ago

@akirak: Silencing the byte compiler is not the proper fix here. Doing so will not prevent the following runtime error when trying to use makem's transient options to include/exclude files:

Symbol’s function definition is void: project-files

Ensuring project.el is loaded prior to those calls is the proper solution, which will also satisfy the byte compiler.

Also note that, as far as I remember, older versions of project.el did not have project-files generic function, but this should be detected by package-lint. Emacs 27.1 shipped project.el 0.6.

Looks like project-files was added in the following commit:

commit 55ec674f5090f420c8982f5206e6566b5a664340
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Date:   Sat Sep 22 11:46:35 2018 -0400

    * lisp/progmodes/project.el (project-files): New generic function.
    (project-search, project-query-replace): New commands.

Which should be present in emacs-27.1:

git tag --contains 55ec674f509
emacs-27.0.90
emacs-27.0.91
emacs-27.1
emacs-27.1-rc1
emacs-27.1-rc2
emacs-27.1.90
emacs-27.1.91
emacs-27.2
emacs-27.2-rc1
emacs-27.2-rc2
emacs-28.0.90
emacs-28.0.91
emacs-28.0.92
emacs-28.1
emacs-28.1.90
emacs-28.1.91