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

Radian advices on forge #540

Open
haji-ali opened this issue Dec 2, 2024 · 2 comments
Open

Radian advices on forge #540

haji-ali opened this issue Dec 2, 2024 · 2 comments

Comments

@haji-ali
Copy link
Contributor

haji-ali commented Dec 2, 2024

Radian has some advices that prevent the sqlite binary from being built when forge is loaded. Instead, delaying this to when forge-dispatch gets called.

The problem is that it also prevents the loading of the package emacsql-sqlite until forge-dispatch is called (even if the binary is already built), which breaks forge until then, e.g., issues are not displayed and any calls to forge fail.

One simple solution would be to require emacsql-sqlite instead of conditioning on it being loaded in radian--forge-get-repository-lazily, but I am wondering if there is a reason that this wasn't done in the first place.

@raxod502
Copy link
Member

raxod502 commented Dec 8, 2024

Oh, erm. It's been a while since I set this up. What I was trying to avoid was forcing EmacSQL to be compiled just for magit-status to be opened. I guess I didn't realize that there were other entry points to Forge other than the dispatch key.

Maybe ideally it would check if EmacSQL has been compiled already, and go ahead and load it if so, and otherwise delay it until the user tries to interact with a Forge feature?

@haji-ali
Copy link
Contributor Author

haji-ali commented Dec 10, 2024

I guess the point is that the variable emacsql-sqlite-executable is not defined until you load emacsql-sqlite.
I am not 100% sure why you require that emacsql-sqlite be loaded in radian--forge-get-repository-lazily, rather than requiring it, to access emacsql-sqlite-executable.

Also, I am not sure that such hack is necessary at all.

The compilation of the binary seems to be in emacsql-sqlite-ensure-binary
which is called by initialize-instance in emacs-sqlite
which is called by make-instance in closql-db
which is called by forge-db.

If you want to avoid auto-compilation of the binary in magit-status you can remove the function forge-connect-database-once from magit-status-mode-hook, which in turn calls forge-db.

Also, in emacs 29 and later, the connection emacsql-sqlite-builtin-connection is used by default (as returned by (emacsql-sqlite-default-connection)) which should use the built-in implementation of sqlite which actually doesn't compile any binaries.

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

No branches or pull requests

2 participants