Skip to content

Instantly share code, notes, and snippets.

@dmitrym0
Created April 4, 2024 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitrym0/ba0045fff7b270f8ed70d8d6142abd5b to your computer and use it in GitHub Desktop.
Save dmitrym0/ba0045fff7b270f8ed70d8d6142abd5b to your computer and use it in GitHub Desktop.
(defun dm/goto-tasks-heading ()
"Find the tasks heading"
(search-forward "* Tasks"))
(defun dm/get-todays-daily-file ()
"Gets the path to today's daily file"
(let* ((daily-file (format "%s.org" (format-time-string "%Y-%m-%d")))
(full-path (concat org-roam-directory "/" org-roam-dailies-directory daily-file )))
full-path)
)
(defun dm/move-task-to-today-and-reset-schedule ()
"Moves a task from an old daily note to today's note"
(interactive)
(let* ((daily-file (dm/get-todays-daily-file)))
(save-window-excursion
(when (string-equal "org-agenda-mode" major-mode)
(org-agenda-goto))
(org-cut-subtree)
(find-file daily-file)
(goto-line 1)
(dm/goto-tasks-heading)
(org-paste-subtree)
(org-schedule nil (format-time-string "%Y-%m-%d 12:00"))
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment