Compare commits

...

4 Commits
v2.3.1 ... main

Author SHA1 Message Date
89dfaef38b Fix link replacement optimization
We are searching for a string literal for speed, so don’t treat it as a
regexp.

Fixes: fc8638759b ("feat: Limit link replacement scope")
Fixes: #2529
2025-07-01 00:28:11 -05:00
fc8638759b feat: Limit link replacement scope
Test for `roam:` link prefix to limit the number of times we need to
call `org-roam-link-replace-at-point`.
2025-06-29 19:44:00 -05:00
1958e035fc build: do not lock issues
Allow folks to revisit issues at any time if they want to restart the conversation.

See Discourse conversation: https://org-roam.discourse.group/t/org-roam-development-status-may-2025/3810/15

Amend: d099204129
2025-06-28 15:38:16 -07:00
1ea7e3077c fix: run org-roam-db-clear-file on file deletion via vc-delete-file 2025-06-26 14:54:27 -07:00
3 changed files with 20 additions and 32 deletions

View File

@ -71,12 +71,6 @@ jobs:
This pull request was automatically closed due to **6 months of inactivity** followed by 2 weeks notice. This pull request was automatically closed due to **6 months of inactivity** followed by 2 weeks notice.
**To reopen:**
- If still relevant, comment below or push new commits
- Or create a new PR with updated changes
If this PR is not reopened in 2 weeks, it will be locked.
# Timing (6 months + 2 weeks) # Timing (6 months + 2 weeks)
days-before-stale: 182 # ~6 months days-before-stale: 182 # ~6 months
days-before-close: 14 # 2 weeks notice days-before-close: 14 # 2 weeks notice
@ -97,26 +91,3 @@ jobs:
echo "2. Click 'Run workflow'" echo "2. Click 'Run workflow'"
echo "3. Leave 'Dry run mode' unchecked" echo "3. Leave 'Dry run mode' unchecked"
echo "4. Click 'Run workflow'" echo "4. Click 'Run workflow'"
lock:
runs-on: ubuntu-latest
needs: stale
# Only run lock job if NOT in dry run mode
if: github.event.inputs.dry_run != 'true'
steps:
# Lock issues/PRs that have been closed for 2 weeks or more
- name: Lock closed issues
uses: dessant/lock-threads@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
issue-inactive-days: 14
issue-lock-reason: 'resolved'
process-only: 'issues'
- name: Lock closed PRs
uses: dessant/lock-threads@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
pr-inactive-days: 14
pr-lock-reason: 'resolved'
process-only: 'prs'

View File

@ -655,12 +655,14 @@ database, see `org-roam-db-sync' command."
(add-hook 'kill-emacs-hook #'org-roam-db--close-all) (add-hook 'kill-emacs-hook #'org-roam-db--close-all)
(advice-add #'rename-file :after #'org-roam-db-autosync--rename-file-a) (advice-add #'rename-file :after #'org-roam-db-autosync--rename-file-a)
(advice-add #'delete-file :before #'org-roam-db-autosync--delete-file-a) (advice-add #'delete-file :before #'org-roam-db-autosync--delete-file-a)
(advice-add #'vc-delete-file :around #'org-roam-db-autosync--vc-delete-file-a)
(org-roam-db-sync)) (org-roam-db-sync))
(t (t
(remove-hook 'find-file-hook #'org-roam-db-autosync--setup-file-h) (remove-hook 'find-file-hook #'org-roam-db-autosync--setup-file-h)
(remove-hook 'kill-emacs-hook #'org-roam-db--close-all) (remove-hook 'kill-emacs-hook #'org-roam-db--close-all)
(advice-remove #'rename-file #'org-roam-db-autosync--rename-file-a) (advice-remove #'rename-file #'org-roam-db-autosync--rename-file-a)
(advice-remove #'delete-file #'org-roam-db-autosync--delete-file-a) (advice-remove #'delete-file #'org-roam-db-autosync--delete-file-a)
(advice-remove #'vc-delete-file #'org-roam-db-autosync--vc-delete-file-a)
(org-roam-db--close-all) (org-roam-db--close-all)
;; Disable local hooks for all org-roam buffers ;; Disable local hooks for all org-roam buffers
(dolist (buf (org-roam-buffer-list)) (dolist (buf (org-roam-buffer-list))
@ -688,6 +690,17 @@ FILE is removed from the database."
(org-roam-file-p file)) (org-roam-file-p file))
(org-roam-db-clear-file (expand-file-name file)))) (org-roam-db-clear-file (expand-file-name file))))
(defun org-roam-db-autosync--vc-delete-file-a (fun file)
"Maintain cache consistency on file deletion by FUN.
FILE is removed from the database."
(let ((org-roam-file-p (and (not (auto-save-file-name-p file))
(not (backup-file-name-p file))
(org-roam-file-p file))))
(apply fun `(,file))
(when (and org-roam-file-p
(not (file-exists-p file)))
(org-roam-db-clear-file (expand-file-name file)))))
(defun org-roam-db-autosync--rename-file-a (old-file new-file-or-dir &rest _args) (defun org-roam-db-autosync--rename-file-a (old-file new-file-or-dir &rest _args)
"Maintain cache consistency of file rename. "Maintain cache consistency of file rename.
OLD-FILE is cleared from the database, and NEW-FILE-OR-DIR is added." OLD-FILE is cleared from the database, and NEW-FILE-OR-DIR is added."

View File

@ -167,6 +167,10 @@ This path is relative to `org-roam-directory'."
:group 'org-roam :group 'org-roam
:type 'string) :type 'string)
(defvar org-roam-link-type "roam"
"Link type for org-roam nodes.
Replaced by `id' automatically when `org-roam-link-auto-replace' is non-nil.")
(defvar org-roam-node-history nil (defvar org-roam-node-history nil
"Minibuffer history of nodes.") "Minibuffer history of nodes.")
@ -768,7 +772,7 @@ The INFO, if provided, is passed to the underlying `org-roam-capture-'."
(deactivate-mark))) (deactivate-mark)))
;;;;; [roam:] link ;;;;; [roam:] link
(org-link-set-parameters "roam" :follow #'org-roam-link-follow-link) (org-link-set-parameters org-roam-link-type :follow #'org-roam-link-follow-link)
(defun org-roam-link-follow-link (title-or-alias) (defun org-roam-link-follow-link (title-or-alias)
"Navigate \"roam:\" link to find and open the node with 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." Assumes that the cursor was put where the link is."
@ -797,7 +801,7 @@ Assumes that the cursor was put where the link is."
node) node)
(goto-char (org-element-property :begin link)) (goto-char (org-element-property :begin link))
(when (and (org-in-regexp org-link-any-re 1) (when (and (org-in-regexp org-link-any-re 1)
(string-equal type "roam") (string-equal type org-roam-link-type)
(setq node (save-match-data (org-roam-node-from-title-or-alias path)))) (setq node (save-match-data (org-roam-node-from-title-or-alias path))))
(replace-match (org-link-make-string (replace-match (org-link-make-string
(concat "id:" (org-roam-node-id node)) (concat "id:" (org-roam-node-id node))
@ -807,7 +811,7 @@ Assumes that the cursor was put where the link is."
"Replace all \"roam:\" links in buffer with \"id:\" links." "Replace all \"roam:\" links in buffer with \"id:\" links."
(interactive) (interactive)
(org-with-point-at 1 (org-with-point-at 1
(while (re-search-forward org-link-bracket-re nil t) (while (search-forward (concat "[[" org-roam-link-type ":") nil t)
(org-roam-link-replace-at-point)))) (org-roam-link-replace-at-point))))
(add-hook 'org-roam-find-file-hook #'org-roam--replace-roam-links-on-save-h) (add-hook 'org-roam-find-file-hook #'org-roam--replace-roam-links-on-save-h)