From 06890773aedfafc34c74ea988c160a15cbcf3ccb Mon Sep 17 00:00:00 2001 From: Jethro Kuan Date: Mon, 10 Feb 2020 15:27:42 +0800 Subject: [PATCH] Add org-roam-link-id-format and org-roam-link-title-format This allows for customizing how org-roam links look when inserted --- org-roam.el | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/org-roam.el b/org-roam.el index f091fd2..a22acd4 100644 --- a/org-roam.el +++ b/org-roam.el @@ -22,11 +22,6 @@ :type 'directory :group 'org-roam) -(defcustom org-roam-zettel-indicator "§" - "Indicator in front of a zettel." - :type 'string - :group 'org-roam) - (defcustom org-roam-position 'right "Position of `org-roam' buffer. @@ -47,6 +42,16 @@ Valid values are (const title)) :group 'org-roam) +(defcustom org-roam-link-id-format "§%s" + "The format string used when inserting org-roam links that use id." + :type 'string + :group 'org-roam) + +(defcustom org-roam-link-title-format "%s" + "The format string used when inserting org-roam links that use their title." + :type 'string + :group 'org-roam) + (defcustom org-roam-buffer-width 0.33 "Width of `org-roam' buffer." :type 'number :group 'org-roam) @@ -179,7 +184,7 @@ If `ABSOLUTE', return the absolute file-path. Else, return the relative file-pat (make-empty-file file-path)) (insert (format "[[%s][%s]]" (concat "file:" file-path) - title))))) + (format org-roam-link-title-format title)))))) (defun org-roam--insert-id () "Find `ID', and insert a relative org link to it at point." @@ -189,7 +194,7 @@ If `ABSOLUTE', return the absolute file-path. Else, return the relative file-pat (make-empty-file file-path)) (insert (format "[[%s][%s]]" (concat "file:" file-path) - (concat org-roam-zettel-indicator id))))) + (format org-roam-link-id-format id))))) ;;; Finding org-roam files (defun org-roam-find-file ()