mirror of
https://github.com/org-roam/org-roam
synced 2025-08-03 12:27:23 -05:00
(chore): Cleanup for MELPA release (#236)
This commit is contained in:
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
;; Copyright © 2020 Jethro Kuan <jethrokuan95@gmail.com>
|
;; Copyright © 2020 Jethro Kuan <jethrokuan95@gmail.com>
|
||||||
;; Author: Jethro Kuan <jethrokuan95@gmail.com>
|
;; Author: Jethro Kuan <jethrokuan95@gmail.com>
|
||||||
|
;; URL: https://github.com/jethrokuan/org-roam
|
||||||
|
;; Keywords: org-mode, roam, convenience
|
||||||
|
;; Version: 0.1.2
|
||||||
|
;; Package-Requires: ((emacs "26.1") (org "9.0"))
|
||||||
|
|
||||||
;; This file is NOT part of GNU Emacs.
|
;; This file is NOT part of GNU Emacs.
|
||||||
|
|
||||||
@ -78,6 +82,9 @@ It opens or creates a note with the given ref.
|
|||||||
(defun org-roam-protocol-open-file (info)
|
(defun org-roam-protocol-open-file (info)
|
||||||
"This handler simply opens the file with emacsclient.
|
"This handler simply opens the file with emacsclient.
|
||||||
|
|
||||||
|
INFO is an alist containing additional information passed by the protocol URL.
|
||||||
|
It should contain the FILE key, pointing to the path of the file to open.
|
||||||
|
|
||||||
Example protocol string:
|
Example protocol string:
|
||||||
|
|
||||||
org-protocol://roam-file?file=/path/to/file.org"
|
org-protocol://roam-file?file=/path/to/file.org"
|
||||||
|
15
org-roam.el
15
org-roam.el
@ -137,6 +137,9 @@ If nil, always ask for filename."
|
|||||||
org-roam--db-connection))
|
org-roam--db-connection))
|
||||||
|
|
||||||
(defun org-roam-db ()
|
(defun org-roam-db ()
|
||||||
|
"Entrypoint to the Org-roam sqlite database.
|
||||||
|
Initializes and stores the database, and the database connection.
|
||||||
|
Performs a database upgrade when required."
|
||||||
(unless (and (org-roam--get-db-connection)
|
(unless (and (org-roam--get-db-connection)
|
||||||
(emacsql-live-p (org-roam--get-db-connection)))
|
(emacsql-live-p (org-roam--get-db-connection)))
|
||||||
(let* ((db-file (org-roam--get-db))
|
(let* ((db-file (org-roam--get-db))
|
||||||
@ -154,12 +157,12 @@ If nil, always ask for filename."
|
|||||||
((> version org-roam--db-version)
|
((> version org-roam--db-version)
|
||||||
(emacsql-close conn)
|
(emacsql-close conn)
|
||||||
(user-error
|
(user-error
|
||||||
"The Org-roam database was created with a newer Org-roam version. %s"
|
"The Org-roam database was created with a newer Org-roam version. "
|
||||||
"You need to update the Org-roam package.")
|
"You need to update the Org-roam package"))
|
||||||
((< version org-roam--db-version)
|
((< version org-roam--db-version)
|
||||||
(emacsql-close conn)
|
(emacsql-close conn)
|
||||||
(error "BUG: The Org-roam database scheme changed %s"
|
(error "BUG: The Org-roam database scheme changed %s"
|
||||||
"and there is no upgrade path"))))))))
|
"and there is no upgrade path")))))))
|
||||||
(org-roam--get-db-connection))
|
(org-roam--get-db-connection))
|
||||||
|
|
||||||
;;;; Entrypoint: (org-roam-sql)
|
;;;; Entrypoint: (org-roam-sql)
|
||||||
@ -223,7 +226,7 @@ If nil, always ask for filename."
|
|||||||
(defun org-roam--db-ensure-built ()
|
(defun org-roam--db-ensure-built ()
|
||||||
"Ensures that org-roam cache is built."
|
"Ensures that org-roam cache is built."
|
||||||
(unless (org-roam--db-initialized-p)
|
(unless (org-roam--db-initialized-p)
|
||||||
(error "[Org-roam] your cache isn't built yet! Please run org-roam-build-cache.")))
|
(error "[Org-roam] your cache isn't built yet! Please run org-roam-build-cache")))
|
||||||
|
|
||||||
;;;;; Clearing
|
;;;;; Clearing
|
||||||
(defun org-roam--db-clear ()
|
(defun org-roam--db-clear ()
|
||||||
@ -698,7 +701,7 @@ This function is used solely in Org-roam's capture templates: see
|
|||||||
(set-buffer (org-capture-target-buffer file-path))
|
(set-buffer (org-capture-target-buffer file-path))
|
||||||
(widen)
|
(widen)
|
||||||
(goto-char (point-max))))
|
(goto-char (point-max))))
|
||||||
(_ (error "Invalid org-roam-capture-context."))))
|
(_ (error "Invalid org-roam-capture-context"))))
|
||||||
|
|
||||||
(defun org-roam-capture (&optional goto keys)
|
(defun org-roam-capture (&optional goto keys)
|
||||||
"Create a new file using an Org-roam template, and returns the
|
"Create a new file using an Org-roam template, and returns the
|
||||||
@ -835,7 +838,7 @@ INFO is an alist containing additional information."
|
|||||||
buffer))
|
buffer))
|
||||||
roam-buffers)))
|
roam-buffers)))
|
||||||
(unless roam-buffers
|
(unless roam-buffers
|
||||||
(user-error "No roam buffers."))
|
(user-error "No roam buffers"))
|
||||||
(when-let ((name (completing-read "Choose a buffer: " names-and-buffers)))
|
(when-let ((name (completing-read "Choose a buffer: " names-and-buffers)))
|
||||||
(switch-to-buffer (cdr (assoc name names-and-buffers))))))
|
(switch-to-buffer (cdr (assoc name names-and-buffers))))))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user