doom

My literate doom emacs config
git clone https://github.com/michaelneuper/doom.git
Files | Log | Refs

commit 802c445864bd83b304324144c405d8d0e1bb6dab
parent 667cfe643dbdadacef7b70d1ce492a9b1628fba9
Author: michaelneuper <michael@michaelneuper.com>
Date:   Mon, 12 May 2025 22:21:00 +0200

define custom org-roam-node-insert functions

Diffstat:
Mconfig.org | 53+++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 39 insertions(+), 14 deletions(-)

diff --git a/config.org b/config.org @@ -629,28 +629,53 @@ Set up =org-roam= and =org-roam-ui= along with their keybindings that have the [ #'org-roam-reflinks-section #'org-roam-unlinked-references-section))) -(defun my/org-roam-node-insert-after-point () - "Insert org-roam link *after* point when in Evil normal mode." - (interactive) +;; custom functions for inserting nodes +(defun my/org-roam--after-point () + "If in evil normal state and not at EOL, move one char forward." (when (and (bound-and-true-p evil-mode) (evil-normal-state-p) - (not (eolp))) ; prevent overshooting line - (forward-char)) - (call-interactively #'org-roam-node-insert)) + (not (eolp))) + (forward-char))) +(defun my/org-roam-insert-lowercase () + "Insert an org-roam link after point, forcing the link text to lower-case." + (interactive) + (let ((org-roam-node-formatter + (lambda (node) (downcase (org-roam-node-title node))))) + (my/org-roam--after-point) + (call-interactively #'org-roam-node-insert))) +(defun my/org-roam-insert-custom-title () + "Pick a node, then prompt for a verbatim link description." + (interactive) + (my/org-roam--after-point) + (let* ((node (org-roam-node-read)) + (desc (read-string "Description: ")) + (link (org-link-make-string + (concat "id:" (org-roam-node-id node)) + desc))) + (insert link) + (org-roam-link-replace-at-point link) + (run-hooks 'org-roam-insert-node-hook) + (forward-char))) (map! :map evil-org-mode-map :leader (:prefix ("r" . "roam") - :desc "Insert node" - "i" #'my/org-roam-node-insert-after-point - :desc "Find node" - "f" #'org-roam-node-find - :desc "Capture to node" - "c" #'org-roam-capture + :desc "Add alias" + "a" #'org-roam-alias-add + :desc "Remove alias" + "A" #'org-roam-alias-remove :desc "Toggle roam buffer" "b" #'org-roam-buffer-toggle - :desc "Open random note" - "r" #'org-roam-node-random + :desc "Find node" + "f" #'org-roam-node-find + :desc "Insert node" + "i" #'my/org-roam-insert-lowercase + :desc "Insert node (prompt title)" + "I" #'my/org-roam-insert-custom-title + :desc "Add tag" + "t" #'org-roam-tag-add + :desc "Remove tag" + "T" #'org-roam-tag-remove :desc "Visit node" "v" #'org-roam-node-visit :desc "Open ORUI"