emacs-将daily笔记以逆序datetree方式refile到另一个窗口
将daily笔记以逆序datetree方式refile到另一个窗口
在左右并排的两个window间,会根据本buffer的title,将指定的headline refile到另一个窗口,并按reverse-datetree排列
(use-package org-reverse-datetree) (setq-default org-reverse-datetree-level-formats '("%Y" ; year "%Y-%m %B" "%Y-%m-%d %A" ; date )) (defun org-get-next-window-file () (if (delq (selected-window) (window-list-1 (next-window nil 'nomini 'visible))) (let ((buffer2 (window-buffer (next-window nil 'nomini 'visible)))) (with-current-buffer buffer2 (when (eq major-mode 'org-mode) (buffer-file-name buffer2)))))) (defun org-get-current-window-title () (with-current-buffer (window-buffer) (pcase (org-collect-keywords '("TITLE")) (`(("TITLE" . ,val)) (setq title (car val)))))) (defun org-refile-to-other-window (arg) (interactive "P") (if (org-get-next-window-file) (org-reverse-datetree-refile-to-file (org-get-next-window-file) (date-to-time (org-get-current-window-title))) ))