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

htmlz-mode does not follow elisp package format #1091

Closed
danielkrajnik opened this issue May 23, 2023 · 5 comments
Closed

htmlz-mode does not follow elisp package format #1091

danielkrajnik opened this issue May 23, 2023 · 5 comments

Comments

@danielkrajnik
Copy link

danielkrajnik commented May 23, 2023

I've wasted days trying to understand why htmlz-mode doesn't get loaded. Turned out that it wasn't prepared in package.el "format".

Why on earth would you not just load that simple file? Why is some arbitrary format needed? Please spare others all the effort required to comprehend mess that is emacs "documentation".

@progfolio
Copy link
Contributor

progfolio commented May 23, 2023

I've wasted days trying to understand why htmlz-mode doesn't get loaded. Turned out that it wasn't prepared in package.el "format".

I'm sorry to hear that.
It looks like there are several bugs in the way the package is authored:

  1. It doesn't declare it's dependencies in the package meta-data header via Package-Requires.
  2. It, instead, defines a new function with a prefix outside of its purview to "require" packages.
  3. It does not autoload any commands for the user.

Why on earth would you not just load that simple file?

Packages generally aren't loaded by the package manager for a number of reasons.
The main reason is users usually want to choose when to load their packages. Forcing a load can slow down Emacs start-up time, increase memory usage, etc. That decision doesn't belong to the package manager (If you've seen use-package or similar init macros, that's their wheelhouse. They often integrate with package managers, too).

However, properly formatted packages are "activated" by straight.el (and other elisp package managers). Activation involves adding the package's directory to load-path so that (require 'my-package) will work. It also typically involves loading an autoloads file. The autolaods being generated for htmlz-mode aren't helpful because the author didn't specify anything to autoload.

Why is some arbitrary format needed?

The format is not arbitrary. It's well documented:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Packaging.html

I'm sorry you ran into a package that does not follow that format, but that's a bug with the package, not the package manager. You should point out the issues detailed above to the package author on their issue tracker if you'd like to see them resolved.

@progfolio progfolio changed the title Allow to evaluate arbitrary .el file (that does not conform to package.el format). htmlz-mode does not follow elisp package format May 23, 2023
@raxod502
Copy link
Member

To add - straight.el isn't responsible for the Emacs packaging format. These were determined by the Emacs development team for package.el and you'd be best off providing feedback on emacs-devel if you have issues. In fact, straight.el is considerably more lax than the built-in package manager when it comes to formatting requirements for packages.

@danielkrajnik
Copy link
Author

danielkrajnik commented May 24, 2023

thanks for all the adivce, there's a lot to unpack here, but long story short, it was solved by adding a single
;;;###autoload
line over (define-minor-mode ...) line in that package. I've mentioned that to the author of that package, as well

Or at least I hope that was it...

@progfolio
Copy link
Contributor

Glad to hear it.
That solves the problem 3 mentioned in my comment above.
They'll still want to add proper "Package-Requires" metadata as described here:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Simple-Packages.html

so that straight and other package managers can properly install any dependencies of the package. This will also allow them to remove the "require-package" function they defined in lieu of letting a package manager use that data.

@danielkrajnik
Copy link
Author

True, I've mentioned it as well: 0xekez/htmlz-mode#3

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

No branches or pull requests

3 participants