Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package-Requires header can span multiple lines #282

Open
tarsius opened this issue Jan 21, 2025 · 5 comments
Open

Package-Requires header can span multiple lines #282

tarsius opened this issue Jan 21, 2025 · 5 comments

Comments

@tarsius
Copy link
Contributor

tarsius commented Jan 21, 2025

In magit.el I use this, for example:

;; Package-Requires: (
;;     (emacs "27.1")
;;     (compat "30.0.1.0")
;;     (dash "2.19.1")
;;     (magit-section "4.2.0")
;;     (seq "2.24")
;;     (transient "0.8.2")
;;     (with-editor "3.4.3"))

(The trick is to put the open parenthesis on the same line as the keyword.)

With package-lint that results in:

magit.el:21:0: error: Couldn't parse "Package-Requires" header: \
  End of file during parsing
@purcell
Copy link
Owner

purcell commented Feb 4, 2025

Does that also work in older Emacsen, e.g. back to 24?

@purcell
Copy link
Owner

purcell commented Feb 4, 2025

ie. is it valid syntax for package.el, lm-maint etc in those older versions?

@tarsius
Copy link
Contributor Author

tarsius commented Feb 4, 2025

This was added in e8c46c2b6f76cc055366041b6112d61dd5f2dcf4, see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36301. So the first Emacs release to support it is 27.1.

Recently (bb5399e3cd75450db6db9b3c5829f7bd87ca1308, upcoming 30.1) this was moved to a new lm-package-requires function.

If a package specifies that it needs at least 27 or later, then multi-line Package-Requires, should not result in a linting warning. If it uses a multi-line value but does not also specify that 27.1 or later is required, then that should result in a warning.

@purcell
Copy link
Owner

purcell commented Feb 5, 2025

If a package specifies that it needs at least 27 or later, then multi-line Package-Requires, should not result in a linting warning. If it uses a multi-line value but does not also specify that 27.1 or later is required, then that should result in a warning.

I don't really agree — you can't guarantee that package headers won't be parsed by older Emacsen, and in those versions you want Emacs to say, "Emacs 27 is not installable", not "Malformed header". This is why we have a lint warning (error, even?) about Package-Requires entries that don't have versions, e.g. (seq).

@tarsius
Copy link
Contributor Author

tarsius commented Feb 5, 2025

It's not guaranteed that this won't happen, but it is fairly unlikely. Nowadays, Melpa (and [Non]GNU Elpa) generate a *-pkg.el file and distribute a tarball, even for packages that consist of nothing but a single library. package.el will then only look at that file and ignore the library headers.

Old package-install-file and package-install-from-buffer would fail though.

It's up to you of course, but I think this should downgraded to a warning.

(This would be a non-issue if they started distributing new releases of package.el on GNU Elpa. I suggested that on emacs-devel before, but the response didn't make me hopeful.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants