Skip to content

Commit

Permalink
Add kludge to deal with the appearance of forge-forgejo.el
Browse files Browse the repository at this point in the history
"package.el" does not compile packages in a clean environment, so if
a package is already loaded when it is being updated, all kinds of
breakage can happen (including but by far not limited to the current
issue).

Forge also does a nasty thing; "forge.el" first `provide's its feature
and then `require's the various back-end libraries, including the newly
added "forge-forgejo.el".  This makes it possible to (require 'forge)
in the back-end libraries, and at the same time for other libraries to
depend on "forge.el" taking care of loading the back-end libraries.

If `forge' is already loaded then (require 'forge) does nothing when a
library that contains that is being compiled.  That also means that the
newly added (require 'forge-forgejo) in that library is not evaluated.
"forge-commands.el" contains code that errors at compile-time if a
referenced type is unknown, `forge-forgejo-repository' in this case.

We inject an additional (require 'forge-forgejo) in "forge-commands.el"
to make sure the type is known during compilation, even when upgrading
from a Forge version that didn't have that library and that version is
already loaded in the current Emacs session.

Closes #743.
  • Loading branch information
tarsius committed Jan 18, 2025
1 parent f8814b1 commit 4e8b837
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lisp/forge-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,9 @@ commit, and for a file."
(cl-defmethod forge-get-url ((notify forge-notification))
(oref notify url))

;; Transitional kludge for the infamous package.el defect.
(require 'forge-forgejo)

(cl-defmethod forge-format-blob-lines ((repo forge-repository) line end)
(cl-etypecase repo ;Third-party classes require separate methods.
((or forge-github-repository
Expand Down

1 comment on commit 4e8b837

@shipmints
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you and for the detailed explanation. Very helpful to understand the complexities with package updates for the future.

Please sign in to comment.