update packages
This commit is contained in:
@@ -2,11 +2,6 @@
|
||||
|
||||
;; Copyright © 2020-2025 Jethro Kuan <jethrokuan95@gmail.com>
|
||||
|
||||
;; Author: Jethro Kuan <jethrokuan95@gmail.com>
|
||||
;; URL: https://github.com/org-roam/org-roam
|
||||
;; Keywords: org-mode, roam, convenience
|
||||
;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.6") (emacsql "4.1.0") (magit-section "3.0.0"))
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
@@ -465,22 +460,23 @@ processing by `org-capture'.
|
||||
Note: During the capture process this function is run by
|
||||
`org-capture-set-target-location', as a (function ...) based
|
||||
capture target."
|
||||
(let ((id (cond ((run-hook-with-args-until-success 'org-roam-capture-preface-hook))
|
||||
(t (org-roam-capture--setup-target-location)))))
|
||||
(org-roam-capture--adjust-point-for-capture-type)
|
||||
(let ((template (org-capture-get :template)))
|
||||
(when (stringp template)
|
||||
(org-capture-put
|
||||
:template
|
||||
(org-roam-capture--fill-template template))))
|
||||
(org-roam-capture--put :id id)
|
||||
(org-roam-capture--put :finalize (or (org-capture-get :finalize)
|
||||
(org-roam-capture--get :finalize)))))
|
||||
(if-let* ((id (run-hook-with-args-until-success 'org-roam-capture-preface-hook)))
|
||||
(org-roam-capture--put :id id)
|
||||
(org-roam-capture--setup-target-location)
|
||||
;; Adjust point for plain captures to skip past metadata (e.g. properties drawer)
|
||||
(org-roam-capture--adjust-point-for-capture-type))
|
||||
(let ((template (org-capture-get :template)))
|
||||
(when (stringp template)
|
||||
(org-capture-put
|
||||
:template
|
||||
(org-roam-capture--fill-template template))))
|
||||
(org-roam-capture--put :finalize (or (org-capture-get :finalize)
|
||||
(org-roam-capture--get :finalize))))
|
||||
|
||||
(defun org-roam-capture--setup-target-location ()
|
||||
"Initialize the buffer, and goto the location of the new capture.
|
||||
Return the ID of the location."
|
||||
(let (p new-file-p)
|
||||
"Initialize the buffer, and goto the location of the new capture."
|
||||
(let ((target-entry-p t)
|
||||
p new-file-p id)
|
||||
(pcase (org-roam-capture--get-target)
|
||||
(`(file ,path)
|
||||
(setq path (org-roam-capture--target-truepath path)
|
||||
@@ -488,7 +484,8 @@ Return the ID of the location."
|
||||
(when new-file-p (org-roam-capture--put :new-file path))
|
||||
(set-buffer (org-capture-target-buffer path))
|
||||
(widen)
|
||||
(setq p (goto-char (point-min))))
|
||||
(setq p (goto-char (point-min))
|
||||
target-entry-p nil))
|
||||
(`(file+olp ,path ,olp)
|
||||
(setq path (org-roam-capture--target-truepath path)
|
||||
new-file-p (org-roam-capture--new-file-p path))
|
||||
@@ -504,9 +501,12 @@ Return the ID of the location."
|
||||
(set-buffer (org-capture-target-buffer path))
|
||||
(when new-file-p
|
||||
(org-roam-capture--put :new-file path)
|
||||
(insert (org-roam-capture--fill-template head 'ensure-newline)))
|
||||
(insert (org-roam-capture--fill-template head 'ensure-newline))
|
||||
(setq p (point-max)))
|
||||
(widen)
|
||||
(setq p (goto-char (point-min))))
|
||||
(unless new-file-p
|
||||
(setq p (goto-char (point-min))))
|
||||
(setq target-entry-p nil))
|
||||
(`(file+head+olp ,path ,head ,olp)
|
||||
(setq path (org-roam-capture--target-truepath path)
|
||||
new-file-p (org-roam-capture--new-file-p path))
|
||||
@@ -568,17 +568,45 @@ Return the ID of the location."
|
||||
(user-error "No node with title or id \"%s\"" title-or-id))))
|
||||
(set-buffer (org-capture-target-buffer (org-roam-node-file node)))
|
||||
(goto-char (org-roam-node-point node))
|
||||
(setq p (org-roam-node-point node)))))
|
||||
(setq p (org-roam-node-point node)
|
||||
target-entry-p (and (derived-mode-p 'org-mode) (org-at-heading-p))))))
|
||||
;; Setup `org-id' for the current capture target and return it back to the
|
||||
;; caller.
|
||||
(save-excursion
|
||||
(goto-char p)
|
||||
(if-let ((id (org-entry-get p "ID")))
|
||||
(setf (org-roam-node-id org-roam-capture--node) id)
|
||||
(org-entry-put p "ID" (org-roam-node-id org-roam-capture--node)))
|
||||
(prog1
|
||||
(org-id-get)
|
||||
(run-hooks 'org-roam-capture-new-node-hook)))))
|
||||
;; Unless it's an entry type, then we want to create an ID for the entry instead
|
||||
(pcase (org-capture-get :type)
|
||||
('entry
|
||||
(advice-add #'org-capture-place-entry :after #'org-roam-capture--create-id-for-entry)
|
||||
(org-roam-capture--put :new-node-p t)
|
||||
(setq id (org-roam-node-id org-roam-capture--node)))
|
||||
(_
|
||||
(save-excursion
|
||||
(goto-char p)
|
||||
(unless (org-entry-get p "ID")
|
||||
(org-roam-capture--put :new-node-p t))
|
||||
(setq id (or (org-entry-get p "ID")
|
||||
(org-roam-node-id org-roam-capture--node)))
|
||||
(setf (org-roam-node-id org-roam-capture--node) id)
|
||||
(org-entry-put p "ID" id))))
|
||||
(org-roam-capture--put :id id)
|
||||
(org-roam-capture--put :target-entry-p target-entry-p)
|
||||
(advice-add #'org-capture-place-template :before #'org-roam-capture--set-target-entry-p-a)
|
||||
(advice-add #'org-capture-place-template :after #'org-roam-capture-run-new-node-hook-a)))
|
||||
|
||||
(defun org-roam-capture--set-target-entry-p-a (_)
|
||||
"Correct `:target-entry-p' in Org-capture template based on `:target.'."
|
||||
(org-capture-put :target-entry-p (org-roam-capture--get :target-entry-p))
|
||||
(advice-remove #'org-capture-place-template #'org-roam-capture--set-target-entry-p-a))
|
||||
|
||||
(defun org-roam-capture-run-new-node-hook-a (_)
|
||||
"Advice to run after the Org-capture template is placed."
|
||||
(when (org-roam-capture--get :new-node-p)
|
||||
(run-hooks 'org-roam-capture-new-node-hook))
|
||||
(advice-remove #'org-capture-place-template #'org-roam-capture-run-new-node-hook-a))
|
||||
|
||||
(defun org-roam-capture--create-id-for-entry ()
|
||||
"Create the ID for the new entry."
|
||||
(org-entry-put (point) "ID" (org-roam-capture--get :id))
|
||||
(advice-remove #'org-capture-place-entry #'org-roam-capture--create-id-for-entry))
|
||||
|
||||
(defun org-roam-capture--get-target ()
|
||||
"Get the current capture :target for the capture template in use."
|
||||
@@ -656,36 +684,26 @@ POS is the current position of point (an integer) inside the
|
||||
currently active capture buffer, where the adjustment should
|
||||
start to begin from. If it's nil, then it will default to
|
||||
the current value of `point'."
|
||||
(or pos (setq pos (point)))
|
||||
(goto-char pos)
|
||||
(let ((location-type (if (= pos 1) 'beginning-of-file 'heading-at-point)))
|
||||
(and (eq location-type 'heading-at-point)
|
||||
(cl-assert (org-at-heading-p)))
|
||||
(pcase (org-capture-get :type)
|
||||
(`plain
|
||||
(cl-case location-type
|
||||
(beginning-of-file
|
||||
(if (org-capture-get :prepend)
|
||||
(let ((el (org-element-at-point)))
|
||||
(while (and (not (eobp))
|
||||
(memq (org-element-type el)
|
||||
'(drawer property-drawer keyword comment comment-block horizontal-rule)))
|
||||
(goto-char (org-element-property :end el))
|
||||
(setq el (org-element-at-point))))
|
||||
(goto-char (org-entry-end-position))))
|
||||
(heading-at-point
|
||||
(if (org-capture-get :prepend)
|
||||
(org-end-of-meta-data t)
|
||||
(goto-char (org-entry-end-position))))))))
|
||||
(goto-char (or pos (point)))
|
||||
(pcase (org-capture-get :type)
|
||||
(`plain
|
||||
(if (org-capture-get :prepend)
|
||||
(let ((el (org-element-at-point)))
|
||||
(while (and (not (eobp))
|
||||
(memq (org-element-type el)
|
||||
'(drawer property-drawer keyword comment comment-block horizontal-rule)))
|
||||
(goto-char (org-element-property :end el))
|
||||
(setq el (org-element-at-point))))
|
||||
(goto-char (org-entry-end-position)))))
|
||||
(point))
|
||||
|
||||
;;; Capture implementation
|
||||
(add-hook 'org-roam-capture-preface-hook #'org-roam-capture--try-capture-to-ref-h)
|
||||
(defun org-roam-capture--try-capture-to-ref-h ()
|
||||
"Try to capture to an existing node that match the ref."
|
||||
(when-let ((node (and (plist-get org-roam-capture--info :ref)
|
||||
(org-roam-node-from-ref
|
||||
(plist-get org-roam-capture--info :ref)))))
|
||||
(when-let* ((node (and (plist-get org-roam-capture--info :ref)
|
||||
(org-roam-node-from-ref
|
||||
(plist-get org-roam-capture--info :ref)))))
|
||||
(set-buffer (org-capture-target-buffer (org-roam-node-file node)))
|
||||
(goto-char (org-roam-node-point node))
|
||||
(widen)
|
||||
@@ -694,7 +712,7 @@ the current value of `point'."
|
||||
(add-hook 'org-roam-capture-new-node-hook #'org-roam-capture--insert-captured-ref-h)
|
||||
(defun org-roam-capture--insert-captured-ref-h ()
|
||||
"Insert the ref if any."
|
||||
(when-let ((ref (plist-get org-roam-capture--info :ref)))
|
||||
(when-let* ((ref (plist-get org-roam-capture--info :ref)))
|
||||
(org-roam-ref-add ref)))
|
||||
|
||||
;;;; Finalizers
|
||||
@@ -707,8 +725,8 @@ the current value of `point'."
|
||||
(defun org-roam-capture--finalize ()
|
||||
"Finalize the `org-roam-capture' process."
|
||||
(if org-note-abort
|
||||
(when-let ((new-file (org-roam-capture--get :new-file))
|
||||
(_ (yes-or-no-p "Delete file for aborted capture?")))
|
||||
(when-let* ((new-file (org-roam-capture--get :new-file))
|
||||
(_ (yes-or-no-p "Delete file for aborted capture?")))
|
||||
(when (find-buffer-visiting new-file)
|
||||
(kill-buffer (find-buffer-visiting new-file)))
|
||||
(delete-file new-file))
|
||||
@@ -736,7 +754,7 @@ This function is to be called in the Org-capture finalization process."
|
||||
(when-let* ((mkr (org-roam-capture--get :call-location))
|
||||
(buf (marker-buffer mkr)))
|
||||
(with-current-buffer buf
|
||||
(when-let ((region (org-roam-capture--get :region)))
|
||||
(when-let* ((region (org-roam-capture--get :region)))
|
||||
(delete-region (car region) (cdr region))
|
||||
(set-marker (car region) nil)
|
||||
(set-marker (cdr region) nil))
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
|
||||
;; Copyright © 2020-2025 Jethro Kuan <jethrokuan95@gmail.com>
|
||||
|
||||
;; Author: Jethro Kuan <jethrokuan95@gmail.com>
|
||||
;; URL: https://github.com/org-roam/org-roam
|
||||
;; Keywords: org-mode, roam, convenience
|
||||
;; Package-Requires: ((emacs "26.1"))
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
@@ -162,7 +157,7 @@ nodes." org-id-locations-file)
|
||||
(advice-add 'org-roam-capture--get-target :around #'org-roam-capture--get-if-new-target-a)
|
||||
(defun org-roam-capture--get-if-new-target-a (fn &rest args)
|
||||
"Get the current capture target using deprecated :if-new property."
|
||||
(if-let ((target (org-roam-capture--get :if-new)))
|
||||
(if-let* ((target (org-roam-capture--get :if-new)))
|
||||
(prog1 target
|
||||
(unless inhibit-warning-p
|
||||
(lwarn 'org-roam-capture :warning
|
||||
@@ -232,9 +227,29 @@ nodes." org-id-locations-file)
|
||||
'org-roam-mode-section-functions
|
||||
'org-roam-mode-sections "org-roam 2.2.0")
|
||||
|
||||
(define-obsolete-function-alias
|
||||
'org-roam-dolist-with-progress
|
||||
'dolist-with-progress-reporter "2025-11-07")
|
||||
|
||||
;;; Obsolete functions
|
||||
(make-obsolete 'org-roam-get-keyword 'org-collect-keywords "org-roam 2.0")
|
||||
|
||||
;;;###autoload
|
||||
(defun org-roam-db-autosync-enable ()
|
||||
"Activate `org-roam-db-autosync-mode'."
|
||||
(declare (obsolete org-roam-db-autosync-mode "2025-11-23"))
|
||||
(org-roam-db-autosync-mode +1))
|
||||
|
||||
(defun org-roam-db-autosync-disable ()
|
||||
"Deactivate `org-roam-db-autosync-mode'."
|
||||
(declare (obsolete org-roam-db-autosync-mode "2025-11-23"))
|
||||
(org-roam-db-autosync-mode -1))
|
||||
|
||||
(defun org-roam-db-autosync-toggle ()
|
||||
"Toggle `org-roam-db-autosync-mode' enabled/disabled."
|
||||
(declare (obsolete org-roam-db-autosync-mode "2025-11-23"))
|
||||
(org-roam-db-autosync-mode 'toggle))
|
||||
|
||||
(provide 'org-roam-compat)
|
||||
|
||||
;;; org-roam-compat.el ends here
|
||||
|
||||
@@ -280,10 +280,10 @@ EXTRA-FILES can be used to append extra files to the list."
|
||||
(defun org-roam-dailies--daily-note-p (&optional file)
|
||||
"Return t if FILE is an Org-roam daily-note, nil otherwise.
|
||||
If FILE is not specified, use the current buffer's file-path."
|
||||
(when-let ((path (expand-file-name
|
||||
(or file
|
||||
(buffer-file-name (buffer-base-buffer)))))
|
||||
(directory (expand-file-name org-roam-dailies-directory org-roam-directory)))
|
||||
(when-let* ((path (expand-file-name
|
||||
(or file
|
||||
(buffer-file-name (buffer-base-buffer)))))
|
||||
(directory (expand-file-name org-roam-dailies-directory org-roam-directory)))
|
||||
(setq path (expand-file-name path))
|
||||
(save-match-data
|
||||
(and
|
||||
@@ -338,11 +338,12 @@ In this case, interactive selection will be bypassed."
|
||||
(when goto (run-hooks 'org-roam-dailies-find-file-hook)))
|
||||
|
||||
(add-hook 'org-roam-capture-preface-hook #'org-roam-dailies--override-capture-time-h)
|
||||
|
||||
(defun org-roam-dailies--override-capture-time-h ()
|
||||
"Override the `:default-time' with the time from `:override-default-time'."
|
||||
(prog1 nil
|
||||
(when (org-roam-capture--get :override-default-time)
|
||||
(org-capture-put :default-time (org-roam-capture--get :override-default-time)))))
|
||||
(when (org-roam-capture--get :override-default-time)
|
||||
(org-capture-put :default-time (org-roam-capture--get :override-default-time)))
|
||||
nil)
|
||||
|
||||
;;; Bindings
|
||||
(defvar org-roam-dailies-map (make-sparse-keymap)
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
|
||||
;; Copyright © 2020-2025 Jethro Kuan <jethrokuan95@gmail.com>
|
||||
|
||||
;; Author: Jethro Kuan <jethrokuan95@gmail.com>
|
||||
;; URL: https://github.com/org-roam/org-roam
|
||||
;; Keywords: org-mode, roam, convenience
|
||||
;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.6") (emacsql "4.1.0") (magit-section "3.0.0"))
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
@@ -302,12 +297,12 @@ If HASH is non-nil, use that as the file's hash without recalculating it."
|
||||
|
||||
(defun org-roam-db-get-scheduled-time ()
|
||||
"Return the scheduled time at point in ISO8601 format."
|
||||
(when-let ((time (org-get-scheduled-time (point))))
|
||||
(when-let* ((time (org-get-scheduled-time (point))))
|
||||
(format-time-string "%FT%T" time)))
|
||||
|
||||
(defun org-roam-db-get-deadline-time ()
|
||||
"Return the deadline time at point in ISO8601 format."
|
||||
(when-let ((time (org-get-deadline-time (point))))
|
||||
(when-let* ((time (org-get-deadline-time (point))))
|
||||
(format-time-string "%FT%T" time)))
|
||||
|
||||
(defun org-roam-db-node-p ()
|
||||
@@ -367,7 +362,7 @@ INFO is the org-element parsed buffer."
|
||||
(org-with-point-at 1
|
||||
(when (and (= (org-outline-level) 0)
|
||||
(org-roam-db-node-p))
|
||||
(when-let ((id (org-id-get)))
|
||||
(when-let* ((id (org-id-get)))
|
||||
(let* ((file (buffer-file-name (buffer-base-buffer)))
|
||||
(title (org-roam-db--file-title))
|
||||
(pos (point))
|
||||
@@ -400,7 +395,7 @@ INFO is the org-element parsed buffer."
|
||||
|
||||
(cl-defun org-roam-db-insert-node-data ()
|
||||
"Insert node data for headline at point into the Org-roam cache."
|
||||
(when-let ((id (org-id-get)))
|
||||
(when-let* ((id (org-id-get)))
|
||||
(let* ((file (buffer-file-name (buffer-base-buffer)))
|
||||
(heading-components (org-heading-components))
|
||||
(pos (point))
|
||||
@@ -441,8 +436,8 @@ INFO is the org-element parsed buffer."
|
||||
|
||||
(defun org-roam-db-insert-tags ()
|
||||
"Insert tags for node at point into Org-roam cache."
|
||||
(when-let ((node-id (org-id-get))
|
||||
(tags (org-get-tags)))
|
||||
(when-let* ((node-id (org-id-get))
|
||||
(tags (org-get-tags)))
|
||||
(org-roam-db-query [:insert :into tags
|
||||
:values $v1]
|
||||
(mapcar (lambda (tag)
|
||||
@@ -558,7 +553,7 @@ INFO is the org-element parsed buffer."
|
||||
(secure-hash 'sha1 (current-buffer))))
|
||||
|
||||
;;;; Synchronization
|
||||
(defun org-roam-db-update-file (&optional file-path no-require)
|
||||
(defun org-roam-db-update-file (&optional file-path _deprecated-arg)
|
||||
"Update Org-roam cache for FILE-PATH.
|
||||
|
||||
If the file does not exist anymore, remove it from the cache.
|
||||
@@ -574,8 +569,7 @@ in `org-roam-db-sync'."
|
||||
:where (= file $s1)] file-path)))
|
||||
info)
|
||||
(unless (string= content-hash db-hash)
|
||||
(unless no-require
|
||||
(org-roam-require '(org-ref oc)))
|
||||
(require 'org-ref nil t)
|
||||
(org-roam-with-file file-path nil
|
||||
(emacsql-with-transaction (org-roam-db)
|
||||
(org-with-wide-buffer
|
||||
@@ -595,8 +589,7 @@ in `org-roam-db-sync'."
|
||||
(setq info (org-element-parse-buffer))
|
||||
(org-roam-db-map-links
|
||||
(list #'org-roam-db-insert-link))
|
||||
(when (fboundp 'org-cite-insert)
|
||||
(require 'oc) ;ensure feature is loaded
|
||||
(when (require 'oc nil t)
|
||||
(org-roam-db-map-citations
|
||||
info
|
||||
(list #'org-roam-db-insert-citation)))))))))
|
||||
@@ -609,7 +602,8 @@ If FORCE, force a rebuild of the cache from scratch."
|
||||
(org-roam-db--close) ;; Force a reconnect
|
||||
(when force (delete-file org-roam-db-location))
|
||||
(org-roam-db) ;; To initialize the database, no-op if already initialized
|
||||
(org-roam-require '(org-ref oc))
|
||||
(require 'org-ref nil t)
|
||||
(require 'oc nil t)
|
||||
(let* ((gc-cons-threshold org-roam-db-gc-threshold)
|
||||
(org-agenda-files nil)
|
||||
(org-roam-files (org-roam-list-files))
|
||||
@@ -622,13 +616,13 @@ If FORCE, force a rebuild of the cache from scratch."
|
||||
(push file modified-files)))
|
||||
(remhash file current-files))
|
||||
(emacsql-with-transaction (org-roam-db)
|
||||
(org-roam-dolist-with-progress (file (hash-table-keys current-files))
|
||||
(dolist-with-progress-reporter (file (hash-table-keys current-files))
|
||||
"Clearing removed files..."
|
||||
(org-roam-db-clear-file file))
|
||||
(org-roam-dolist-with-progress (file modified-files)
|
||||
(dolist-with-progress-reporter (file modified-files)
|
||||
"Processing modified files..."
|
||||
(condition-case err
|
||||
(org-roam-db-update-file file 'no-require)
|
||||
(org-roam-db-update-file file)
|
||||
(error
|
||||
(org-roam-db-clear-file file)
|
||||
(lwarn 'org-roam :error "Failed to process %s with error %s, skipping..."
|
||||
@@ -668,19 +662,6 @@ database, see `org-roam-db-sync' command."
|
||||
(with-current-buffer buf
|
||||
(remove-hook 'after-save-hook #'org-roam-db-autosync--try-update-on-save-h t)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-roam-db-autosync-enable ()
|
||||
"Activate `org-roam-db-autosync-mode'."
|
||||
(org-roam-db-autosync-mode +1))
|
||||
|
||||
(defun org-roam-db-autosync-disable ()
|
||||
"Deactivate `org-roam-db-autosync-mode'."
|
||||
(org-roam-db-autosync-mode -1))
|
||||
|
||||
(defun org-roam-db-autosync-toggle ()
|
||||
"Toggle `org-roam-db-autosync-mode' enabled/disabled."
|
||||
(org-roam-db-autosync-mode 'toggle))
|
||||
|
||||
(defun org-roam-db-autosync--delete-file-a (file &optional _trash)
|
||||
"Maintain cache consistency when file deletes.
|
||||
FILE is removed from the database."
|
||||
@@ -736,6 +717,14 @@ OLD-FILE is cleared from the database, and NEW-FILE-OR-DIR is added."
|
||||
(interactive)
|
||||
(prin1 (org-roam-node-at-point)))
|
||||
|
||||
(defun org-roam-db-explore ()
|
||||
"Explore the org-roam DB contents."
|
||||
(interactive)
|
||||
(require 'sqlite-mode nil t)
|
||||
(if (fboundp 'sqlite-mode-open-file)
|
||||
(sqlite-mode-open-file org-roam-db-location)
|
||||
(message "org-roam-db-explore: This command requires Emacs 29")))
|
||||
|
||||
(provide 'org-roam-db)
|
||||
|
||||
;;; org-roam-db.el ends here
|
||||
|
||||
@@ -52,7 +52,7 @@ See `org-html--reference' for DATUM, INFO and NAMED-ONLY."
|
||||
datum))
|
||||
(user-label
|
||||
(or user-label
|
||||
(when-let ((path (org-element-property :ID datum)))
|
||||
(when-let* ((path (org-element-property :ID datum)))
|
||||
;; see `org-html-link' for why we use "ID-"
|
||||
;; (search for "ID-" in ox-html.el)
|
||||
(concat "ID-" path)))))
|
||||
|
||||
@@ -60,15 +60,15 @@ It may be one of the following:
|
||||
(defcustom org-roam-graph-extra-config nil
|
||||
"Extra options passed to graphviz.
|
||||
Example:
|
||||
'((\"rankdir\" . \"LR\"))"
|
||||
:type '(alist)
|
||||
((\"rankdir\" . \"LR\"))"
|
||||
:type 'alist
|
||||
:group 'org-roam)
|
||||
|
||||
(defcustom org-roam-graph-edge-extra-config nil
|
||||
"Extra edge options passed to graphviz.
|
||||
Example:
|
||||
'((\"dir\" . \"back\"))"
|
||||
:type '(alist)
|
||||
((\"dir\" . \"back\"))"
|
||||
:type 'alist
|
||||
:group 'org-roam)
|
||||
|
||||
(defcustom org-roam-graph-node-extra-config
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
|
||||
;; Copyright © 2020-2025 Jethro Kuan <jethrokuan95@gmail.com>
|
||||
|
||||
;; Author: Jethro Kuan <jethrokuan95@gmail.com>
|
||||
;; URL: https://github.com/org-roam/org-roam
|
||||
;; Keywords: org-mode, roam, convenience
|
||||
;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.6") (magit-section "3.0.0"))
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
@@ -52,7 +47,7 @@ With optional argument MARKERP, return the position as a new marker."
|
||||
((symbolp id) (setq id (symbol-name id)))
|
||||
((numberp id) (setq id (number-to-string id))))
|
||||
(let ((node (org-roam-populate (org-roam-node-create :id id))))
|
||||
(when-let ((file (org-roam-node-file node)))
|
||||
(when-let* ((file (org-roam-node-file node)))
|
||||
(if markerp
|
||||
(let ((buffer (or (find-buffer-visiting file)
|
||||
(find-file-noselect file))))
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
|
||||
;; Copyright © 2022-2025 Jethro Kuan <jethrokuan95@gmail.com>
|
||||
|
||||
;; Author: Jethro Kuan <jethrokuan95@gmail.com>
|
||||
;; URL: https://github.com/org-roam/org-roam
|
||||
;; Keywords: org-mode, roam, convenience
|
||||
;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.6") (emacsql "4.1.0") (magit-section "3.0.0"))
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
|
||||
;; Copyright © 2020-2025 Jethro Kuan <jethrokuan95@gmail.com>
|
||||
|
||||
;; Author: Jethro Kuan <jethrokuan95@gmail.com>
|
||||
;; URL: https://github.com/org-roam/org-roam
|
||||
;; Keywords: org-mode, roam, convenience
|
||||
;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.6") (emacsql "4.1.0") (magit-section "3.0.0"))
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
@@ -156,9 +151,9 @@ If the property is already set, replace its value."
|
||||
(desc (match-string 2)))
|
||||
(when (string-prefix-p "file:" path)
|
||||
(setq path (expand-file-name (substring path 5)))
|
||||
(when-let ((node-id (caar (org-roam-db-query [:select [id] :from nodes
|
||||
:where (= file $s1)
|
||||
:and (= level 0)] path))))
|
||||
(when-let* ((node-id (caar (org-roam-db-query [:select [id] :from nodes
|
||||
:where (= file $s1)
|
||||
:and (= level 0)] path))))
|
||||
(set-match-data mdata)
|
||||
(replace-match (org-link-make-string (concat "id:" node-id)
|
||||
desc) nil t)))))))
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
|
||||
;; Copyright © 2020-2025 Jethro Kuan <jethrokuan95@gmail.com>
|
||||
|
||||
;; Author: Jethro Kuan <jethrokuan95@gmail.com>
|
||||
;; URL: https://github.com/org-roam/org-roam
|
||||
;; Keywords: org-mode, roam, convenience
|
||||
;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.6") (emacsql "4.1.0") (magit-section "3.0.0"))
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
@@ -184,7 +179,9 @@ information in a section-like manner (see
|
||||
`org-roam-mode-sections'), with which the user can
|
||||
interact with."
|
||||
:group 'org-roam
|
||||
(face-remap-add-relative 'header-line 'org-roam-header-line))
|
||||
(face-remap-add-relative 'header-line 'org-roam-header-line)
|
||||
;; https://github.com/meedstrom/org-node/issues/149
|
||||
(setq-local font-lock-defaults nil))
|
||||
|
||||
;;; Buffers
|
||||
(defvar org-roam-buffer-current-node nil
|
||||
@@ -213,11 +210,11 @@ which visits the thing at point."
|
||||
(defun org-roam-buffer-file-at-point (&optional assert)
|
||||
"Return the file at point in the current `org-roam-mode' based buffer.
|
||||
If ASSERT, throw an error."
|
||||
(if-let ((file (magit-section-case
|
||||
(org-roam-node-section (org-roam-node-file (oref it node)))
|
||||
(org-roam-grep-section (oref it file))
|
||||
(org-roam-preview-section (oref it file))
|
||||
(t (cl-assert (derived-mode-p 'org-roam-mode))))))
|
||||
(if-let* ((file (magit-section-case
|
||||
(org-roam-node-section (org-roam-node-file (oref it node)))
|
||||
(org-roam-grep-section (oref it file))
|
||||
(org-roam-preview-section (oref it file))
|
||||
(t (cl-assert (derived-mode-p 'org-roam-mode))))))
|
||||
file
|
||||
(when assert
|
||||
(user-error "No file at point"))))
|
||||
@@ -329,7 +326,7 @@ Valid states are `visible', `exists' and `none'."
|
||||
(defun org-roam-buffer-persistent-redisplay ()
|
||||
"Recompute contents of the persistent `org-roam-buffer'.
|
||||
Has no effect when there's no `org-roam-node-at-point'."
|
||||
(when-let ((node (org-roam-node-at-point)))
|
||||
(when-let* ((node (org-roam-node-at-point)))
|
||||
(unless (equal node org-roam-buffer-current-node)
|
||||
(setq org-roam-buffer-current-node node
|
||||
org-roam-buffer-current-directory org-roam-directory)
|
||||
@@ -392,7 +389,7 @@ the same time:
|
||||
other node) at POINT. Acts a child section of the previous
|
||||
one."
|
||||
(magit-insert-section section (org-roam-node-section)
|
||||
(let ((outline (if-let ((outline (plist-get properties :outline)))
|
||||
(let ((outline (if-let* ((outline (plist-get properties :outline)))
|
||||
(mapconcat #'org-link-display-format outline " > ")
|
||||
"Top")))
|
||||
(insert (concat (propertize (org-roam-node-title source-node)
|
||||
@@ -524,7 +521,7 @@ When SHOW-BACKLINK-P is not null, only show backlinks for which
|
||||
this predicate is not nil.
|
||||
|
||||
SECTION-HEADING is the string used as a heading for the backlink section."
|
||||
(when-let ((backlinks (seq-sort #'org-roam-backlinks-sort (org-roam-backlinks-get node :unique unique))))
|
||||
(when-let* ((backlinks (seq-sort #'org-roam-backlinks-sort (org-roam-backlinks-get node :unique unique))))
|
||||
(magit-insert-section (org-roam-backlinks)
|
||||
(magit-insert-heading section-heading)
|
||||
(dolist (backlink backlinks)
|
||||
@@ -582,8 +579,8 @@ Sorts by title."
|
||||
|
||||
(defun org-roam-reflinks-section (node)
|
||||
"The reflinks section for NODE."
|
||||
(when-let ((refs (org-roam-node-refs node))
|
||||
(reflinks (seq-sort #'org-roam-reflinks-sort (org-roam-reflinks-get node))))
|
||||
(when-let* ((refs (org-roam-node-refs node))
|
||||
(reflinks (seq-sort #'org-roam-reflinks-sort (org-roam-reflinks-get node))))
|
||||
(magit-insert-section (org-roam-reflinks)
|
||||
(magit-insert-heading "Reflinks:")
|
||||
(dolist (reflink reflinks)
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
|
||||
;; Copyright © 2020-2025 Jethro Kuan <jethrokuan95@gmail.com>
|
||||
|
||||
;; Author: Jethro Kuan <jethrokuan95@gmail.com>
|
||||
;; URL: https://github.com/org-roam/org-roam
|
||||
;; Keywords: org-mode, roam, convenience
|
||||
;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.6") (magit-section "3.0.0"))
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
@@ -32,6 +27,7 @@
|
||||
;;
|
||||
;;; Code:
|
||||
(require 'crm)
|
||||
(require 'subr-x)
|
||||
(require 'org-roam)
|
||||
|
||||
;;; Options
|
||||
@@ -65,10 +61,10 @@ and then reference it here or in the capture templates as
|
||||
|
||||
\"length\" is an optional specifier and declares how many
|
||||
characters can be used to display the value of the corresponding
|
||||
field. If it's not specified, the field will be inserted as is,
|
||||
i.e. it won't be aligned nor trimmed. If it's an integer, the
|
||||
field. If it\\='s not specified, the field will be inserted as is,
|
||||
i.e. it won\\='t be aligned nor trimmed. If it\\='s an integer, the
|
||||
field will be aligned accordingly and all the exceeding
|
||||
characters will be trimmed out. If it's \"*\", the field will use
|
||||
characters will be trimmed out. If it\\='s \"*\", the field will use
|
||||
as many characters as possible and will be aligned accordingly.
|
||||
|
||||
A closure can also be assigned to this variable in which case the
|
||||
@@ -83,11 +79,11 @@ following function shows the title and base filename of the node:
|
||||
\"formats the node\"
|
||||
(format \"%-40s %s\"
|
||||
(if (org-roam-node-title node)
|
||||
(propertize (org-roam-node-title node) 'face 'org-todo)
|
||||
(propertize (org-roam-node-title node) \\='face \\='org-todo)
|
||||
\"\")
|
||||
(file-name-nondirectory (org-roam-node-file node))))
|
||||
|
||||
\q(setq org-roam-node-display-template 'my--org-roam-format)"
|
||||
\(setq org-roam-node-display-template \\='my--org-roam-format)"
|
||||
:group 'org-roam
|
||||
:type '(choice string function))
|
||||
|
||||
@@ -189,55 +185,29 @@ Replaced by `id' automatically when `org-roam-link-auto-replace' is non-nil.")
|
||||
id level point todo priority scheduled deadline title properties olp
|
||||
tags aliases refs)
|
||||
|
||||
;; Shim `string-glyph-compose' and `string-glyph-decompose' for Emacs versions that do not have it.
|
||||
;; The functions were introduced in emacs commit 3f096eb3405b2fce7c35366eb2dcf025dda55783 and the
|
||||
;; (original) functions behind them aren't autoloaded anymore.
|
||||
(dolist (sym.replace
|
||||
'((string-glyph-compose . ucs-normalize-NFC-string)
|
||||
(string-glyph-decompose . ucs-normalize-NFD-string)))
|
||||
(let ((emacs-29-symbol (car sym.replace))
|
||||
(previous-implementation (cdr sym.replace)))
|
||||
(unless (fboundp emacs-29-symbol)
|
||||
(defalias emacs-29-symbol previous-implementation))))
|
||||
|
||||
(cl-defmethod org-roam-node-slug ((node org-roam-node))
|
||||
"Return the slug of NODE."
|
||||
(let ((title (org-roam-node-title node))
|
||||
(slug-trim-chars '(;; Combining Diacritical Marks https://www.unicode.org/charts/PDF/U0300.pdf
|
||||
768 ; U+0300 COMBINING GRAVE ACCENT
|
||||
769 ; U+0301 COMBINING ACUTE ACCENT
|
||||
770 ; U+0302 COMBINING CIRCUMFLEX ACCENT
|
||||
771 ; U+0303 COMBINING TILDE
|
||||
772 ; U+0304 COMBINING MACRON
|
||||
774 ; U+0306 COMBINING BREVE
|
||||
775 ; U+0307 COMBINING DOT ABOVE
|
||||
776 ; U+0308 COMBINING DIAERESIS
|
||||
777 ; U+0309 COMBINING HOOK ABOVE
|
||||
778 ; U+030A COMBINING RING ABOVE
|
||||
779 ; U+030B COMBINING DOUBLE ACUTE ACCENT
|
||||
780 ; U+030C COMBINING CARON
|
||||
795 ; U+031B COMBINING HORN
|
||||
803 ; U+0323 COMBINING DOT BELOW
|
||||
804 ; U+0324 COMBINING DIAERESIS BELOW
|
||||
805 ; U+0325 COMBINING RING BELOW
|
||||
807 ; U+0327 COMBINING CEDILLA
|
||||
813 ; U+032D COMBINING CIRCUMFLEX ACCENT BELOW
|
||||
814 ; U+032E COMBINING BREVE BELOW
|
||||
816 ; U+0330 COMBINING TILDE BELOW
|
||||
817 ; U+0331 COMBINING MACRON BELOW
|
||||
)))
|
||||
(cl-flet* ((nonspacing-mark-p (char) (memq char slug-trim-chars))
|
||||
(strip-nonspacing-marks (s) (string-glyph-compose
|
||||
(apply #'string
|
||||
(seq-remove #'nonspacing-mark-p
|
||||
(string-glyph-decompose s)))))
|
||||
(cl-replace (title pair) (replace-regexp-in-string (car pair) (cdr pair) title)))
|
||||
(let* ((pairs `(("[^[:alnum:][:digit:]]" . "_") ;; convert anything not alphanumeric
|
||||
("__*" . "_") ;; remove sequential underscores
|
||||
("^_" . "") ;; remove starting underscore
|
||||
("_$" . ""))) ;; remove ending underscore
|
||||
(slug (-reduce-from #'cl-replace (strip-nonspacing-marks title) pairs)))
|
||||
(downcase slug)))))
|
||||
(org-roam-node-slugify (org-roam-node-title node)))
|
||||
|
||||
(defun org-roam-node-slugify (title)
|
||||
"Slugify TITLE."
|
||||
(require 'ucs-normalize)
|
||||
(let ((slug-trim-chars
|
||||
;; Combining Diacritical Marks https://www.unicode.org/charts/PDF/U0300.pdf
|
||||
;; For why these specific glyphs: https://github.com/org-roam/org-roam/pull/1460
|
||||
'( #x300 #x301 #x302 #x303 #x304 #x306 #x307
|
||||
#x308 #x309 #x30A #x30B #x30C #x31B #x323
|
||||
#x324 #x325 #x327 #x32D #x32E #x330 #x331)))
|
||||
(thread-last title
|
||||
(ucs-normalize-NFD-string) ;; aka. `string-glyph-decompose' from Emacs 29
|
||||
(seq-remove (lambda (char) (memq char slug-trim-chars)))
|
||||
(apply #'string)
|
||||
(ucs-normalize-NFC-string) ;; aka. `string-glyph-compose' from Emacs 29
|
||||
(replace-regexp-in-string "[^[:alnum:]]" "_") ;; convert anything not alphanumeric
|
||||
(replace-regexp-in-string "__*" "_") ;; remove sequential underscores
|
||||
(replace-regexp-in-string "^_" "") ;; remove starting underscore
|
||||
(replace-regexp-in-string "_$" "") ;; remove ending underscore
|
||||
(downcase))))
|
||||
|
||||
(cl-defmethod org-roam-node-formatted ((node org-roam-node))
|
||||
"Return a formatted string for NODE."
|
||||
@@ -274,7 +244,7 @@ populated."
|
||||
(org-roam-up-heading-or-point-min)
|
||||
(funcall outline-level)))))
|
||||
(org-roam-up-heading-or-point-min))
|
||||
(when-let ((id (org-id-get)))
|
||||
(when-let* ((id (org-id-get)))
|
||||
(org-roam-populate
|
||||
(org-roam-node-create
|
||||
:id id
|
||||
@@ -294,7 +264,8 @@ Return nil if a node with ID does not exist."
|
||||
Return nil if the node does not exist.
|
||||
Throw an error if multiple choices exist.
|
||||
|
||||
If NOCASE is non-nil, the query is case insensitive. It is case sensitive otherwise."
|
||||
If NOCASE is non-nil, the query is case insensitive.
|
||||
It is case sensitive otherwise."
|
||||
(let ((matches (seq-uniq
|
||||
(append
|
||||
(org-roam-db-query (vconcat [:select [id] :from nodes
|
||||
@@ -326,15 +297,15 @@ Return nil if there's no node with such REF."
|
||||
(setq type "cite"
|
||||
path (substring ref 1))))
|
||||
(when (and type path)
|
||||
(when-let ((id (caar (org-roam-db-query
|
||||
[:select [nodes:id]
|
||||
:from refs
|
||||
:left-join nodes
|
||||
:on (= refs:node-id nodes:id)
|
||||
:where (= refs:type $s1)
|
||||
:and (= refs:ref $s2)
|
||||
:limit 1]
|
||||
type path))))
|
||||
(when-let* ((id (caar (org-roam-db-query
|
||||
[:select [nodes:id]
|
||||
:from refs
|
||||
:left-join nodes
|
||||
:on (= refs:node-id nodes:id)
|
||||
:where (= refs:type $s1)
|
||||
:and (= refs:ref $s2)
|
||||
:limit 1]
|
||||
type path))))
|
||||
(org-roam-populate (org-roam-node-create :id id)))))))
|
||||
|
||||
(cl-defmethod org-roam-populate ((node org-roam-node))
|
||||
@@ -342,13 +313,13 @@ Return nil if there's no node with such REF."
|
||||
Uses the ID, and fetches remaining details from the database.
|
||||
This can be quite costly: avoid, unless dealing with very few
|
||||
nodes."
|
||||
(when-let ((node-info (car (org-roam-db-query [:select [
|
||||
file level pos todo priority
|
||||
scheduled deadline title properties olp]
|
||||
:from nodes
|
||||
:where (= id $s1)
|
||||
:limit 1]
|
||||
(org-roam-node-id node)))))
|
||||
(when-let* ((node-info (car (org-roam-db-query [:select [
|
||||
file level pos todo priority
|
||||
scheduled deadline title properties olp]
|
||||
:from nodes
|
||||
:where (= id $s1)
|
||||
:limit 1]
|
||||
(org-roam-node-id node)))))
|
||||
(pcase-let* ((`(,file ,level ,pos ,todo ,priority ,scheduled ,deadline ,title ,properties ,olp) node-info)
|
||||
(`(,atime ,mtime ,file-title) (car (org-roam-db-query [:select [atime mtime title]
|
||||
:from files
|
||||
@@ -558,7 +529,8 @@ and when nil is returned the node will be filtered out.
|
||||
SORT-FN is a function to sort nodes. See `org-roam-node-read-sort-by-file-mtime'
|
||||
for an example sort function.
|
||||
If REQUIRE-MATCH, the minibuffer prompt will require a match.
|
||||
PROMPT is a string to show at the beginning of the mini-buffer, defaulting to \"Node: \""
|
||||
PROMPT is a string to show at the beginning of the mini-buffer,
|
||||
defaulting to \"Node: \""
|
||||
(let* ((nodes (org-roam-node-read--completions filter-fn sort-fn))
|
||||
(prompt (or prompt "Node: "))
|
||||
(node (completing-read
|
||||
@@ -775,7 +747,7 @@ The INFO, if provided, is passed to the underlying `org-roam-capture-'."
|
||||
(defun org-roam-link-follow-link (title-or-alias)
|
||||
"Navigate \"roam:\" link to find and open the node with TITLE-OR-ALIAS.
|
||||
Assumes that the cursor was put where the link is."
|
||||
(if-let ((node (org-roam-node-from-title-or-alias title-or-alias)))
|
||||
(if-let* ((node (org-roam-node-from-title-or-alias title-or-alias)))
|
||||
(progn
|
||||
(when org-roam-link-auto-replace
|
||||
(org-roam-link-replace-at-point))
|
||||
@@ -916,10 +888,15 @@ and no extra content before the first heading."
|
||||
(org-with-point-at 1 (org-at-heading-p))))
|
||||
|
||||
(defun org-roam-promote-entire-buffer ()
|
||||
"Promote the current buffer.
|
||||
"Promote the current buffer, and save.
|
||||
Converts a file containing a single level-1 headline node to a file
|
||||
node."
|
||||
(interactive)
|
||||
(org-roam--promote-entire-buffer-internal)
|
||||
(org-roam-db-update-file))
|
||||
|
||||
(defun org-roam--promote-entire-buffer-internal ()
|
||||
"Promote the current buffer."
|
||||
(unless (org-roam--buffer-promoteable-p)
|
||||
(user-error "Cannot promote: multiple root headings or there is extra file-level text"))
|
||||
(org-with-point-at 1
|
||||
@@ -930,8 +907,7 @@ node."
|
||||
(org-roam-end-of-meta-data t)
|
||||
(insert "#+title: " title "\n")
|
||||
(when tags (org-roam-tag-add tags))
|
||||
(org-map-region #'org-promote (point-min) (point-max))
|
||||
(org-roam-db-update-file))))
|
||||
(org-map-region #'org-promote (point-min) (point-max)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-roam-refile (node)
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
;; -*- no-byte-compile: t; lexical-binding: nil -*-
|
||||
(define-package "org-roam" "20250701.528"
|
||||
(define-package "org-roam" "20251125.729"
|
||||
"A database abstraction layer for Org-mode."
|
||||
'((emacs "26.1")
|
||||
(compat "30.1")
|
||||
(dash "2.13")
|
||||
(org "9.6")
|
||||
(emacsql "4.1.0")
|
||||
(magit-section "3.0.0"))
|
||||
:url "https://github.com/org-roam/org-roam"
|
||||
:commit "89dfaef38b6caa3027f20f96a551dc8f194ac533"
|
||||
:revdesc "89dfaef38b6c"
|
||||
:commit "f4ba41cf3d59084e182a5186d432afc9aa3fc423"
|
||||
:revdesc "f4ba41cf3d59"
|
||||
:keywords '("org-mode" "roam" "convenience")
|
||||
:authors '(("Jethro Kuan" . "jethrokuan95@gmail.com"))
|
||||
:maintainers '(("Jethro Kuan" . "jethrokuan95@gmail.com")))
|
||||
|
||||
@@ -158,7 +158,7 @@ It should contain the FILE key, pointing to the path of the file to open.
|
||||
Example protocol string:
|
||||
|
||||
org-protocol://roam-node?node=uuid"
|
||||
(when-let ((node (plist-get info :node)))
|
||||
(when-let* ((node (plist-get info :node)))
|
||||
(raise-frame)
|
||||
(org-roam-node-visit (org-roam-populate (org-roam-node-create :id node)) nil 'force))
|
||||
nil)
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
|
||||
;; Copyright © 2020-2025 Jethro Kuan <jethrokuan95@gmail.com>
|
||||
|
||||
;; Author: Jethro Kuan <jethrokuan95@gmail.com>
|
||||
;; URL: https://github.com/org-roam/org-roam
|
||||
;; Keywords: org-mode, roam, convenience
|
||||
;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.6"))
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
@@ -33,11 +28,6 @@
|
||||
|
||||
(require 'org-roam)
|
||||
|
||||
(defun org-roam-require (libs)
|
||||
"Require LIBS."
|
||||
(dolist (lib libs)
|
||||
(require lib nil 'noerror)))
|
||||
|
||||
;;; String utilities
|
||||
;; TODO Refactor this.
|
||||
(defun org-roam-replace-string (old new s)
|
||||
@@ -99,23 +89,6 @@ FN must take two arguments: the key and the value."
|
||||
plist-index (cdr plist-index)))))
|
||||
plist)
|
||||
|
||||
(defmacro org-roam-dolist-with-progress (spec msg &rest body)
|
||||
"Loop over a list and report progress in the echo area.
|
||||
Like `dolist-with-progress-reporter', but falls back to `dolist'
|
||||
if the function does not yet exist.
|
||||
|
||||
Evaluate BODY with VAR bound to each car from LIST, in turn.
|
||||
Then evaluate RESULT to get return value, default nil.
|
||||
|
||||
MSG is a progress reporter object or a string. In the latter
|
||||
case, use this string to create a progress reporter.
|
||||
|
||||
SPEC is a list, as per `dolist'."
|
||||
(declare (indent 2))
|
||||
(if (fboundp 'dolist-with-progress-reporter)
|
||||
`(dolist-with-progress-reporter ,spec ,msg ,@body)
|
||||
`(dolist ,spec ,@body)))
|
||||
|
||||
;;; File utilities
|
||||
(defun org-roam-descendant-of-p (a b)
|
||||
"Return t if A is descendant of B."
|
||||
@@ -206,6 +179,17 @@ value (possibly nil). Adapted from `s-format'."
|
||||
;;; Fontification
|
||||
(defvar org-ref-buffer-hacked)
|
||||
|
||||
(defvar org-roam-fontification-buffer "*org-roam-fontification-buffer*"
|
||||
"The buffer helps to increase the speed of org-roam-buffer fontification.")
|
||||
|
||||
(defun org-roam-get-fontification-buffer-create ()
|
||||
"Get or create the `org-roam-fontification-buffer'.
|
||||
This buffer used to fontify multiple backlink previews efficiently (`org-mode' is booted just once)."
|
||||
(with-current-buffer (get-buffer-create org-roam-fontification-buffer)
|
||||
(unless (derived-mode-p 'org-mode)
|
||||
(org-mode))
|
||||
(current-buffer)))
|
||||
|
||||
(defun org-roam-fontify-like-in-org-mode (s)
|
||||
"Fontify string S like in Org mode.
|
||||
Like `org-fontify-like-in-org-mode', but supports `org-ref'."
|
||||
@@ -225,10 +209,10 @@ Like `org-fontify-like-in-org-mode', but supports `org-ref'."
|
||||
;;
|
||||
;; `org-ref-buffer-hacked' is a buffer-local variable, therefore we inline
|
||||
;; `org-fontify-like-in-org-mode' here
|
||||
(with-temp-buffer
|
||||
(with-current-buffer (org-roam-get-fontification-buffer-create)
|
||||
(erase-buffer)
|
||||
(insert s)
|
||||
(let ((org-ref-buffer-hacked t))
|
||||
(org-mode)
|
||||
(setq-local org-fold-core-style 'overlays)
|
||||
(font-lock-ensure)
|
||||
(buffer-string))))
|
||||
@@ -429,7 +413,7 @@ straight.el on Windows.
|
||||
See <https://github.com/raxod502/straight.el/issues/520>."
|
||||
(when (and (bound-and-true-p straight-symlink-emulation-mode)
|
||||
(fboundp 'straight-chase-emulated-symlink))
|
||||
(when-let ((target (straight-chase-emulated-symlink filename)))
|
||||
(when-let* ((target (straight-chase-emulated-symlink filename)))
|
||||
(unless (eq target 'broken)
|
||||
(setq filename target))))
|
||||
(file-chase-links filename))
|
||||
@@ -450,7 +434,7 @@ See <https://github.com/raxod502/straight.el/issues/520>."
|
||||
(insert (format "- Org: %s\n" (org-version nil 'full)))
|
||||
(insert (format "- Org-roam: %s" (org-roam-version)))
|
||||
(insert (format "- sqlite-connector: %s"
|
||||
(if-let ((conn (org-roam-db--get-connection)))
|
||||
(if-let* ((conn (org-roam-db--get-connection)))
|
||||
(eieio-object-class conn)
|
||||
"not connected")))))
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
;; Author: Jethro Kuan <jethrokuan95@gmail.com>
|
||||
;; URL: https://github.com/org-roam/org-roam
|
||||
;; Keywords: org-mode, roam, convenience
|
||||
;; Package-Version: 20250701.528
|
||||
;; Package-Revision: 89dfaef38b6c
|
||||
;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.6") (emacsql "4.1.0") (magit-section "3.0.0"))
|
||||
;; Package-Version: 20251125.729
|
||||
;; Package-Revision: f4ba41cf3d59
|
||||
;; Package-Requires: ((emacs "26.1") (compat "30.1") (dash "2.13") (org "9.6") (emacsql "4.1.0") (magit-section "3.0.0"))
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
@@ -78,6 +78,8 @@
|
||||
(require 'seq)
|
||||
(require 'cl-lib)
|
||||
|
||||
(require 'compat)
|
||||
|
||||
(require 'magit-section)
|
||||
|
||||
(require 'emacsql)
|
||||
@@ -142,7 +144,7 @@ responsibility to ensure that."
|
||||
:group 'org-roam)
|
||||
|
||||
(defcustom org-roam-file-exclude-regexp (list org-attach-id-dir)
|
||||
"Files matching this regular expression or list of regular expressions are excluded from the Org-roam."
|
||||
"Files matching this regexp or list of regexps are excluded from Org-roam."
|
||||
:type '(choice
|
||||
(repeat
|
||||
(string :tag "Regular expression matching files to ignore"))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
This is org-roam.info, produced by makeinfo version 7.1.1 from
|
||||
This is org-roam.info, produced by makeinfo version 7.2 from
|
||||
org-roam.texi.
|
||||
|
||||
Copyright (C) 2020-2025 Jethro Kuan <jethrokuan95@gmail.com>
|
||||
@@ -187,7 +187,6 @@ Appendix
|
||||
* Note-taking Workflows::
|
||||
* Ecosystem::
|
||||
|
||||
|
||||
|
||||
File: org-roam.info, Node: Introduction, Next: Target Audience, Prev: Top, Up: Top
|
||||
|
||||
@@ -1496,7 +1495,6 @@ This protocol finds or creates a new note with a given ‘ROAM_REFS’:
|
||||
|
||||
| ||||