mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
refactor: remove emacsql-sqlite backend option
This option is no longer supported in emacsql 4.0 and was throwing
linter errors in CI.
Ref: 7a79c2be3d
This commit is contained in:
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@ -36,7 +36,11 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
emacs_version:
|
emacs_version:
|
||||||
- 27.1
|
# REVIEW: we do not yet have the bootstrapping in place to test
|
||||||
|
# versions of emacs without built-in sqlite (pre 29.1)
|
||||||
|
# - 27.2
|
||||||
|
# - 28.2
|
||||||
|
- 29.4
|
||||||
- snapshot
|
- snapshot
|
||||||
steps:
|
steps:
|
||||||
- uses: purcell/setup-emacs@master
|
- uses: purcell/setup-emacs@master
|
||||||
|
@ -268,40 +268,6 @@ file:
|
|||||||
install-info /path/to/my/info/files/org-roam.info /path/to/my/info/files/dir
|
install-info /path/to/my/info/files/org-roam.info /path/to/my/info/files/dir
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Installation Troubleshooting
|
|
||||||
*** C Compiler
|
|
||||||
Org-roam relies on an Emacs package called ~emacsql~ and ~emacsql-sqlite~ to
|
|
||||||
work with the ~sqlite~ database. Both of them should be installed automatically
|
|
||||||
in your Emacs environment as a prerequisite for Org-roam when you install it.
|
|
||||||
|
|
||||||
~emacsql-sqlite~ requires a C compiler (e.g. ~gcc~ or ~clang~) to be present in
|
|
||||||
your computer. How to install a C compiler depends on the OS that you use.
|
|
||||||
|
|
||||||
**** C Compiler for Windows
|
|
||||||
|
|
||||||
One of the easiest ways to install a C compiler in Windows is to use [[https://www.msys2.org/][MSYS2]] as at the time of this writing:
|
|
||||||
|
|
||||||
1. Download and use the installer in the official MSYS2 website
|
|
||||||
2. Run MSYS2 and in its terminal, type the following and answer "Y" to
|
|
||||||
proceed -- this will install ~gcc~ in your PC:
|
|
||||||
|
|
||||||
#+BEGIN_SRC bash
|
|
||||||
pacman -S gcc
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
4. On Windows, add ~C:\msys64\usr\bin~ (command =where gcc= in MSYS2 terminal
|
|
||||||
can tell you the correct path) to ~PATH~ in your environmental variables
|
|
||||||
|
|
||||||
5. Launch Emacs and call ~M-x org-roam-db-autosync-mode~ (launch Emacs after
|
|
||||||
defining the path, so that Emacs can recognize it)
|
|
||||||
|
|
||||||
This will automatically start compiling ~emacsql-sqlite~; you should see a
|
|
||||||
message in minibuffer. It may take a while until compilation completes. Once
|
|
||||||
complete, you should see a new file ~emacsql-sqlite.exe~ created in a subfolder
|
|
||||||
named ~sqlite~ under ~emacsql-sqlite~ installation folder. It's typically in
|
|
||||||
your Emacs configuration folder like this:
|
|
||||||
~/.config/emacs/elpa/emacsql-sqlite-20190727.1710/sqlite~
|
|
||||||
|
|
||||||
* Getting Started
|
* Getting Started
|
||||||
** The Org-roam Node
|
** The Org-roam Node
|
||||||
|
|
||||||
@ -459,18 +425,18 @@ can set ~org-roam-node-display-template~ as such:
|
|||||||
** How to cache
|
** How to cache
|
||||||
|
|
||||||
Org-roam uses a sqlite database to perform caching, but there are multiple Emacs
|
Org-roam uses a sqlite database to perform caching, but there are multiple Emacs
|
||||||
libraries that can be used. The default used by Org-roam is ~emacs-sqlite~.
|
libraries that can be used. The default used by Org-roam is
|
||||||
Below the pros and cons of each package is used:
|
[[https://github.com/magit/emacsql/blob/main/emacsql-sqlite-builtin.el][~emacs-sqlite-builtin~]]. Below the pros and cons of each package is used:
|
||||||
|
|
||||||
[[https://github.com/skeeto/emacsql][**emacs-sqlite**]]
|
[[https://melpa.org/#/emacsql-sqlite-builtin][**emacsql-sqlite-builtin**]]
|
||||||
|
|
||||||
The default option used by Org-roam. This library is the most mature and
|
~emacsql-sqlite-builtin~ uses the in-built SQLite support for Emacs 29 and
|
||||||
well-supported and is imported by default in Org-roam.
|
later. This is the default option if you are using a version of Emacs that
|
||||||
|
supports it.
|
||||||
|
|
||||||
One downside of using ~emacs-sqlite~ is that using it requires compilation and
|
#+begin_src emacs-lisp
|
||||||
can cause issues in some environments (especially Windows). If you have issues
|
(setq org-roam-database-connector 'sqlite-builtin)
|
||||||
producing the customized binary required by ~emacs-sqlite~, consider using
|
#+end_src
|
||||||
~emacs-sqlite3~.
|
|
||||||
|
|
||||||
[[https://github.com/cireu/emacsql-sqlite3][**emacs-sqlite3**]]
|
[[https://github.com/cireu/emacsql-sqlite3][**emacs-sqlite3**]]
|
||||||
|
|
||||||
@ -489,24 +455,12 @@ To use ~emacsql-sqlite3~, ensure that the package is installed, and set:
|
|||||||
[[https://melpa.org/#/emacsql-sqlite-module][**emacssql-sqlite-module**]] (previously emacsql-libsqlite3)
|
[[https://melpa.org/#/emacsql-sqlite-module][**emacssql-sqlite-module**]] (previously emacsql-libsqlite3)
|
||||||
|
|
||||||
~emacs-sqlite-module~ is a relatively young package which uses an Emacs module that
|
~emacs-sqlite-module~ is a relatively young package which uses an Emacs module that
|
||||||
exposes parts of the SQLite C API to Emacs Lisp, instead of using subprocess as
|
exposes parts of the SQLite C API to Emacs Lisp.
|
||||||
~emacsql-sqlite~ does. It is expected to be a more performant drop-in
|
|
||||||
replacement for ~emacs-sqlite~.
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(setq org-roam-database-connector 'sqlite-module)
|
(setq org-roam-database-connector 'sqlite-module)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
[[https://melpa.org/#/emacsql-sqlite-builtin][**emacsql-sqlite-builtin**]]
|
|
||||||
|
|
||||||
~emacsql-sqlite-builtin~ uses the in-built SQLite support for Emacs 29 and
|
|
||||||
later. This is the recommended option if you are using a version of Emacs that
|
|
||||||
supports it.
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(setq org-roam-database-connector 'sqlite-builtin)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** What to cache
|
** What to cache
|
||||||
|
|
||||||
By default, all nodes (any headline or file with an ID) are cached by Org-roam.
|
By default, all nodes (any headline or file with an ID) are cached by Org-roam.
|
||||||
@ -1672,21 +1626,6 @@ to the publishing directory. Example code follows:
|
|||||||
(kill-buffer (file-name-nondirectory svg))
|
(kill-buffer (file-name-nondirectory svg))
|
||||||
(setq my-publish-time 0)))))
|
(setq my-publish-time 0)))))
|
||||||
#+end_src
|
#+end_src
|
||||||
** I'm seeing this "Selecting deleted buffer" error. What do I do?
|
|
||||||
|
|
||||||
The "selecting deleted buffer" error usually occurs when you don't have a
|
|
||||||
working ~emacsql-sqlite~ executable. Org-roam relies on this executable to
|
|
||||||
function properly, and doesn't catch this error. This issue is most commonly
|
|
||||||
seen on Windows setups. You can browse through the various GitHub issues posted
|
|
||||||
about this [[https://github.com/org-roam/org-roam/issues?q=is%3Aissue+selecting+deleted][here]].
|
|
||||||
|
|
||||||
To fix this, you can try the following:
|
|
||||||
|
|
||||||
1. If on Windows, try replacing your system binary with [[https://github.com/nobiot/emacsql-sqlite.exe][this one]] that has been proven
|
|
||||||
to work
|
|
||||||
2. Use the ~emacsql-sqlite3~ option rather than compiling your own emacsql
|
|
||||||
binary (see [[*How to cache][How to cache]]).
|
|
||||||
|
|
||||||
* Developer's Guide to Org-roam
|
* Developer's Guide to Org-roam
|
||||||
** Org-roam's Design Principle
|
** Org-roam's Design Principle
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -41,18 +41,15 @@
|
|||||||
(functionp 'emacsql-sqlite-builtin))
|
(functionp 'emacsql-sqlite-builtin))
|
||||||
(functionp 'sqlite-open))
|
(functionp 'sqlite-open))
|
||||||
'sqlite-builtin
|
'sqlite-builtin
|
||||||
'sqlite)
|
'sqlite-module)
|
||||||
"The database connector used by Org-roam.
|
"The database connector used by Org-roam.
|
||||||
This must be set before `org-roam' is loaded. To use an alternative
|
This must be set before `org-roam' is loaded. To use an alternative
|
||||||
connector you must install the respective package explicitly.
|
connector you must install the respective package explicitly.
|
||||||
The default is `sqlite', which uses the `emacsql-sqlite' library
|
If you are using Emacs 29 or newer, then the default connector is
|
||||||
that is being maintained in the same repository as `emacsql'
|
|
||||||
itself.
|
|
||||||
If you are using Emacs 29, then the recommended connector is
|
|
||||||
`sqlite-builtin', which uses the new builtin support for SQLite.
|
`sqlite-builtin', which uses the new builtin support for SQLite.
|
||||||
You need to install the `emacsql-sqlite-builtin' package to use
|
You need to install the `emacsql-sqlite-builtin' package to use
|
||||||
this connector.
|
this connector.
|
||||||
If you are using an older Emacs release, then the recommended
|
If you are using an older Emacs release, then the default
|
||||||
connector is `sqlite-module', which uses the module provided by
|
connector is `sqlite-module', which uses the module provided by
|
||||||
the `sqlite3' package. This is very similar to the previous
|
the `sqlite3' package. This is very similar to the previous
|
||||||
connector and the built-in support in Emacs 29 derives from this
|
connector and the built-in support in Emacs 29 derives from this
|
||||||
@ -67,7 +64,7 @@ the official `sqlite3' cli tool, which is not intended
|
|||||||
to be used like this. See https://nullprogram.com/blog/2014/02/06/."
|
to be used like this. See https://nullprogram.com/blog/2014/02/06/."
|
||||||
:package-version '(forge . "0.3.0")
|
:package-version '(forge . "0.3.0")
|
||||||
:group 'org-roam
|
:group 'org-roam
|
||||||
:type '(choice (const sqlite)
|
:type '(choice
|
||||||
(const sqlite-builtin)
|
(const sqlite-builtin)
|
||||||
(const sqlite-module)
|
(const sqlite-module)
|
||||||
(const :tag "libsqlite3 (OBSOLETE)" libsqlite3)
|
(const :tag "libsqlite3 (OBSOLETE)" libsqlite3)
|
||||||
@ -156,7 +153,6 @@ ROAM_REFS."
|
|||||||
(gethash (expand-file-name (file-name-as-directory org-roam-directory))
|
(gethash (expand-file-name (file-name-as-directory org-roam-directory))
|
||||||
org-roam-db--connection))
|
org-roam-db--connection))
|
||||||
|
|
||||||
(declare-function emacsql-sqlite "ext:emacsql-sqlite")
|
|
||||||
(declare-function emacsql-sqlite3 "ext:emacsql-sqlite3")
|
(declare-function emacsql-sqlite3 "ext:emacsql-sqlite3")
|
||||||
(declare-function emacsql-libsqlite3 "ext:emacsql-libsqlite3")
|
(declare-function emacsql-libsqlite3 "ext:emacsql-libsqlite3")
|
||||||
(declare-function emacsql-sqlite-builtin "ext:emacsql-sqlite-builtin")
|
(declare-function emacsql-sqlite-builtin "ext:emacsql-sqlite-builtin")
|
||||||
@ -165,10 +161,6 @@ ROAM_REFS."
|
|||||||
(defun org-roam-db--conn-fn ()
|
(defun org-roam-db--conn-fn ()
|
||||||
"Return the function for creating the database connection."
|
"Return the function for creating the database connection."
|
||||||
(cl-case org-roam-database-connector
|
(cl-case org-roam-database-connector
|
||||||
(sqlite
|
|
||||||
(progn
|
|
||||||
(require 'emacsql-sqlite)
|
|
||||||
#'emacsql-sqlite))
|
|
||||||
(sqlite-builtin
|
(sqlite-builtin
|
||||||
(progn
|
(progn
|
||||||
(require 'emacsql-sqlite-builtin)
|
(require 'emacsql-sqlite-builtin)
|
||||||
|
@ -80,6 +80,7 @@
|
|||||||
(require 'magit-section)
|
(require 'magit-section)
|
||||||
|
|
||||||
(require 'emacsql)
|
(require 'emacsql)
|
||||||
|
;; emacsql-sqlite provides an interface to a chosen emacsql SQLite backend (e.g. emacs-sqlite-builtin)
|
||||||
(require 'emacsql-sqlite)
|
(require 'emacsql-sqlite)
|
||||||
|
|
||||||
(require 'org)
|
(require 'org)
|
||||||
|
Reference in New Issue
Block a user