Suggest current node as default for rewrite commands

This commit is contained in:
Chris Barrett
2022-08-18 13:32:20 +12:00
parent 031d724246
commit 5dbfc71ed8

View File

@@ -131,8 +131,8 @@ NODE is the node to update.
NEW-TITLE is the new title to use. All backlinks will have their NEW-TITLE is the new title to use. All backlinks will have their
descriptions updated to this value." descriptions updated to this value."
(interactive (let* ((node (org-roam-node-read (-some->> (org-roam-node-at-point) (org-roam-node-title)) (interactive (let* ((suggested-title (-some->> (org-roam-node-at-point) (org-roam-node-title)))
nil nil t "Rename: "))) (node (org-roam-node-read suggested-title nil nil t "Rename: ")))
(list node (read-string "New title: " (org-roam-node-title node))))) (list node (read-string "New title: " (org-roam-node-title node)))))
(org-roam-node-visit node) (org-roam-node-visit node)
(org-save-all-org-buffers) (org-save-all-org-buffers)
@@ -161,7 +161,8 @@ FROM is the node which will be unlinked.
TO is the node to change those references to point to. TO is the node to change those references to point to.
LINK-DESC is the description to use for the updated links." LINK-DESC is the description to use for the updated links."
(interactive (let* ((from (org-roam-node-read nil nil nil t "Remove: ")) (interactive (let* ((suggested-title (-some->> (org-roam-node-at-point) (org-roam-node-title)))
(from (org-roam-node-read suggested-title nil nil t "Remove: "))
(to (org-roam-node-read nil (lambda (it) (not (equal from it))) nil t "Rewrite to: "))) (to (org-roam-node-read nil (lambda (it) (not (equal from it))) nil t "Rewrite to: ")))
(list from to (read-string "Link description: " (org-roam-node-title to))))) (list from to (read-string "Link description: " (org-roam-node-title to)))))
(org-save-all-org-buffers) (org-save-all-org-buffers)
@@ -190,7 +191,8 @@ SRC-NODE is the node to be removed.
DEST-NODE is the node that will be added to." DEST-NODE is the node that will be added to."
(interactive (interactive
(let* ((src (org-roam-node-read (-some->> (org-roam-node-at-point) (org-roam-node-title)) nil nil t "Source: ")) (let* ((suggested-title (-some->> (org-roam-node-at-point) (org-roam-node-title)))
(src (org-roam-node-read suggested-title nil nil t "Source: "))
(dest (org-roam-node-read nil (lambda (node) (dest (org-roam-node-read nil (lambda (node)
(and (and
(not (equal (org-roam-node-id node) (org-roam-node-id src))) (not (equal (org-roam-node-id node) (org-roam-node-id src)))