org mode - How to refile into a datetree - Emacs Stack Exchange

CREATED: [2021-04-19 Mon 17:02]
ID: 0abcd6a9-fb99-43b9-ba25-66d46637a8ee
REVIEW_SCORE: 3.0
ROAM_REFS: https://emacs.stackexchange.com/questions/10597/how-to-refile-into-a-datetree
MTIME: [2025-02-02 Sun 19:51],[2021-04-19 Mon 17:02]
(defun my/org-read-datetree-date (d)
"Parse a time string D and return a date to pass to the datetree functions."
(let ((dtmp (nthcdr 3 (parse-time-string d))))
  (list (cadr dtmp) (car dtmp) (caddr dtmp))))

(defun my/org-refile-to-archive-datetree ()
  "Refile an entry to a datetree under an archive."
  (interactive)
  (require 'org-datetree)
  (let ((datetree-date (my/org-read-datetree-date (org-read-date t nil))))
    (org-refile nil nil (list nil (buffer-file-name) nil
                              (save-excursion
                                (org-datetree-find-date-create datetree-date)))))
  (setq this-command 'my/org-refile-to-journal))

used the above to refile into the blotter before I decided that the blotter should just be appended to.

1. Backlinks

Author: sahiti

Created: 2025-05-03 Sat 15:32

Validate