branch: externals/org-gnosis
commit 7db779c55919163c2fdd833e5a0c2640af05df94
Author: Thanos Apollo <[email protected]>
Commit: Thanos Apollo <[email protected]>

    [fix] require emacsql-sqlite-builtin to fix cl-generic dispatch.
    
    On Emacs 29+ with builtin sqlite, emacsql-sqlite-open lazily
    autoloads emacsql-sqlite-builtin which defines specialized
    cl-generic methods for emacsql.  When the first emacsql call
    happens in the same form as the connection open (e.g. in
    org-gnosis-db-init-if-needed), the generic dispatcher may use
    the stale base-class method which calls process-buffer on a
    non-process connection, causing wrong-type-argument errors.
    
    Pre-loading the builtin backend ensures its methods are
    registered before any emacsql call.  The require is soft
    (nil t) so it's a no-op on Emacs < 29 without builtin sqlite.
---
 org-gnosis.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/org-gnosis.el b/org-gnosis.el
index 3904352bf8..34589da013 100644
--- a/org-gnosis.el
+++ b/org-gnosis.el
@@ -58,6 +58,9 @@
 
 (require 'cl-lib)
 (require 'emacsql-sqlite)
+;; Pre-load the builtin backend when available (Emacs 29+) to ensure
+;; cl-generic dispatches specialized methods for builtin connections.
+(require 'emacsql-sqlite-builtin nil t)
 (require 'org-element)
 
 (defgroup org-gnosis nil

Reply via email to