From 112324ebcf2efbe0adc33c21d28f6193994a69dc Mon Sep 17 00:00:00 2001 From: Jethro Kuan Date: Mon, 10 Feb 2020 15:44:40 +0800 Subject: [PATCH] Add org-roam-new-file `org-roam-new-file` quickly creates a new file using the current timestamp. --- org-roam.el | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/org-roam.el b/org-roam.el index a22acd4..2135a7e 100644 --- a/org-roam.el +++ b/org-roam.el @@ -161,6 +161,18 @@ If `ABSOLUTE', return the absolute file-path. Else, return the relative file-pat (or (org-roam--get-title file-path) (org-roam--get-id file-path))) +;;; Creating org-roam files +(defun org-roam--new-file-named (slug) + "Create a new file named `SLUG'. +`SLUG' is the short file name, without a path or a file extension." + (interactive "sNew filename (without extension): ") + (find-file (org-roam--get-file-path slug t))) + +(defun org-roam-new-file () + "Quickly create a new file, using the current timestamp." + (interactive) + (org-roam--new-file-named (format-time-string "%Y-%m-%d-%H%M%S" (current-time)))) + ;;; Inserting org-roam links (defun org-roam-insert () "Insert an org-roam link." @@ -404,12 +416,6 @@ This is equivalent to removing the node from the graph." (org-roam--insert-item item))))) ;;; Org-roam daily notes -(defun org-roam--new-file-named (slug) - "Create a new file named `SLUG'. -`SLUG' is the short file name, without a path or a file extension." - (interactive "sNew filename (without extension): ") - (find-file (org-roam--get-file-path slug t))) - (defun org-roam-today () "Create the file for today." (interactive)