summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2022-07-06 16:47:51 -0500
committerCase Duckworth2022-07-06 16:47:51 -0500
commit58e163e03be262dd2ac7c8239e638cf880a38e09 (patch)
tree1d7d0917002ad4cc364adb27dbc71e95ae9a2e95 /lisp
parentRename +compat.el to avoid collision; add a thing (diff)
downloademacs-58e163e03be262dd2ac7c8239e638cf880a38e09.tar.gz
emacs-58e163e03be262dd2ac7c8239e638cf880a38e09.zip
apodsf8u
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)