fix(org): org-roam: remove emacsql-sqlite hacks

emacs-sqlite.el was removed upstream in magit/emacsql@8ebf559, and the
custom sqlite executable is no longer built as of magit/emacsql@7a79c2b,
which renders these two advice mostly unnecessary (plus they throw
void-function `emacsql-sqlite-ensure-binary` errors).

Fix: #8167
Ref: org-roam/org-roam#2485
Ref: magit/emacsql@8ebf559f58
Ref: magit/emacsql@7a79c2be3d
This commit is contained in:
Henrik Lissner
2024-11-19 00:29:53 -05:00
parent 87a024ee90
commit 90ede31698

View File

@ -27,22 +27,11 @@ of org-mode to properly utilize ID links.")
:init
(doom-load-packages-incrementally
'(ansi-color dash f rx seq magit-section emacsql emacsql-sqlite))
'(ansi-color dash f rx seq magit-section emacsql))
;; Don't display warning message dedicated for v1 users. Need to be set early.
(setq org-roam-v2-ack t)
(defadvice! +org-roam-suppress-sqlite-build-a (fn &rest args)
"Suppress automatic building of sqlite3 binary when loading `org-roam'.
This is a blocking operation that can take a while to complete
and better be deferred when there will be an actual demand for
the database. See `+org-init-roam-h' for the launch process."
:around #'emacsql-sqlite-ensure-binary
(if (not (boundp 'org-roam-db-version))
(apply fn args)
(advice-remove #'emacsql-sqlite-ensure-binary #'+org-roam-suppress-sqlite-build-a)
nil))
:config
(defun +org-init-roam-h ()
"Setup `org-roam' but don't immediately initialize its database.
@ -55,18 +44,6 @@ Instead, initialize it when it will be actually needed."
In case of failure, fail gracefully."
:before #'org-roam-db-query
(message "Initializing org-roam database...")
(let ((run-cleanup-p t))
(unwind-protect
;; Try to build the binary if it doesn't exist. In case of failure
;; this will error, run the cleanup and exit, and in case of success
;; this will return nil and sync the database.
(setq run-cleanup-p (emacsql-sqlite-ensure-binary))
(when run-cleanup-p
(setq org-roam--sqlite-available-p nil)
(org-roam-teardown)
(message (concat "EmacSQL failied to build SQLite binary for org-roam; "
"see *Compile-Log* buffer for details.\n"
"To try reinitialize org-roam, run \"M-x org-roam-setup\"")))))
(advice-remove 'org-roam-db-query #'+org-roam-try-init-db-a)
(org-roam-db-sync))