summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+org.el36
1 files changed, 36 insertions, 0 deletions
diff --git a/lisp/+org.el b/lisp/+org.el index 6b956ae..2557671 100644 --- a/lisp/+org.el +++ b/lisp/+org.el
@@ -730,6 +730,42 @@ When called with a prefix ARG, will still unconditionally call
730 (t #'org-return))))) 730 (t #'org-return)))))
731 731
732 732
733;;; move org archives to a dedicated file
734(defun +org-archive-monthwise (archive-file)
735 (if (file-exists-p archive-file)
736 (with-current-buffer (find-file-noselect archive-file)
737 (let ((dir (file-name-directory (file-truename archive-file)))
738 (prog (make-progress-reporter (format "Archiving from %s..." archive-file)))
739 (keep-going t))
740 (goto-char (point-min))
741 (while keep-going
742 (when-let* ((time (or (org-entry-get (point) "ARCHIVE_TIME")
743 (org-get-deadline-time (point))))
744 (parsed-time (and time
745 (org-parse-time-string time)))
746 (refile-target (format "%s%02d-%02d.org"
747 dir
748 (decoded-time-year parsed-time)
749 (decoded-time-month parsed-time)))
750 (title-str (format "#+title: Archive for %02d-%02d (%s)\n\n"
751 (decoded-time-year parsed-time)
752 (decoded-time-month parsed-time)
753 (file-truename archive-file))))
754 (unless (file-exists-p refile-target)
755 (with-current-buffer (find-file-noselect refile-target)
756 (insert title-str)
757 (save-buffer)))
758 (org-refile nil nil (list ""
759 refile-target
760 nil
761 0)))
762 (progress-reporter-update prog)
763 (org-next-visible-heading 1)
764 (when (>= (point) (point-max))
765 (setq keep-going nil)))))
766 (message "Archive file %s does not exist!" archive-file)))
767
768
733;;; el-patch 769;;; el-patch
734 770
735(el-patch-defun org-format-outline-path (path &optional width prefix separator) 771(el-patch-defun org-format-outline-path (path &optional width prefix separator)