mirror of
https://github.com/org-roam/org-roam
synced 2025-08-11 13:07:24 -05:00
Adds org-roam-today
The function creates a note for today and opens it, if it doesn't yet exist
This commit is contained in:
18
org-roam.el
18
org-roam.el
@@ -4,7 +4,7 @@
|
|||||||
"Indicator in front of a zettel.")
|
"Indicator in front of a zettel.")
|
||||||
|
|
||||||
(defun org-roam-insert (file-name)
|
(defun org-roam-insert (file-name)
|
||||||
"Finds a file, inserts it as a link with the base file name as the link name, and adds the zd-link-indicator I use to the front."
|
"Finds a file, inserts it as a link with the base file name as the link name."
|
||||||
(interactive (list (completing-read "File: " (deft-find-all-files-no-prefix))))
|
(interactive (list (completing-read "File: " (deft-find-all-files-no-prefix))))
|
||||||
(let ((org-link-file-type 'relative))
|
(let ((org-link-file-type 'relative))
|
||||||
(org-insert-link nil (concat "file:" (concat deft-directory file-name))
|
(org-insert-link nil (concat "file:" (concat deft-directory file-name))
|
||||||
@@ -26,4 +26,20 @@
|
|||||||
search-term
|
search-term
|
||||||
3)))
|
3)))
|
||||||
|
|
||||||
|
(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): ")
|
||||||
|
(let ((file (deft-absolute-filename slug)))
|
||||||
|
(unless (file-exists-p file)
|
||||||
|
(deft-auto-populate-title-maybe file)
|
||||||
|
(deft-cache-update-file file)
|
||||||
|
(deft-refresh-filter))
|
||||||
|
(deft-open-file file)))
|
||||||
|
|
||||||
|
(defun org-roam-today ()
|
||||||
|
"Creates the file for today."
|
||||||
|
(interactive)
|
||||||
|
(org-roam-new-file-named (format-time-string "%Y-%m-%d" (current-time))))
|
||||||
|
|
||||||
(provide 'org-roam)
|
(provide 'org-roam)
|
||||||
|
Reference in New Issue
Block a user