Skip to content

emacsql-sqlite-builtin: Fix declare-functions#130

Merged
tarsius merged 2 commits intomagit:mainfrom
basil-conto:blc/decl
Mar 20, 2025
Merged

emacsql-sqlite-builtin: Fix declare-functions#130
tarsius merged 2 commits intomagit:mainfrom
basil-conto:blc/decl

Conversation

@basil-conto
Copy link
Contributor

All three sqlite-* functions used are defined in src/sqlite.c, not lisp/sqlite.el, which defines only the macro with-sqlite-transaction.


BTW, I'm curious: what is the reasoning behind having (require 'sqlite) and (require 'sqlite nil t) in emacsql-sqlite-builtin.el?

I see that emacsql-sqlite.el checks sqlite-available-p before loading emacsql-sqlite-builtin.el. This handles cases like Emacs 29+ without SQLite support, in which case sqlite.el exists but sqlite-open etc. are not defined, and cases on Windows where sqlite-open etc. were defined at compile time, but the SQLite library is not found at run time.

So at first glance the (require (quote sqlite)) in emacsql-sqlite-builtin.el seems to me equivalent to signalling an error on Emacs < 29, regardless of SQLite support. Is that the intention, or is there some other thinking behind it?

Also, (require 'sqlite nil t) doesn't currently do anything (since EmacSQL doesn't use with-sqlite-transaction). Is the require there for less typing down the road, when more things are added to sqlite.el? Or is there some other thinking here as well?

Thanks!

basil-conto and others added 2 commits March 20, 2025 15:47
All three sqlite-* functions used are defined in src/sqlite.c, not
lisp/sqlite.el, which defines only the macro
with-sqlite-transaction.
This lisp library only defines a macro that we do not use.
The actual built-in SQLite support does not have to loaded
explicitly.

Re magit#130.
@tarsius tarsius merged commit f48d1d6 into magit:main Mar 20, 2025
26 checks passed
@tarsius
Copy link
Member

tarsius commented Mar 20, 2025

Thanks!

Requiring sqlite did not serve any real purpose so I stopped doing that.

@basil-conto basil-conto deleted the blc/decl branch March 20, 2025 15:18
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

Successfully merging this pull request may close these issues.

2 participants