Samuel Wales <samolog...@gmail.com> writes:
> are there intereim workarounds like semi-automatically moving large
> logbook entries, or entire logbooks, to a task that says "was logbook
> for ..." and then archiving that task?  or automatically archiving old
> logbook entries?

My largest logbook contains ~2.5k clock records with no obvious impact
on performance (on main). However, when I was using older Org versions,
I used the following helper functions:

Credit: 
https://www.reddit.com/r/orgmode/comments/dg43hs/can_i_archive_a_property_drawer/f3frk2n/
Caveat: you might get duplicate IDs using the functions below. I just
changed the archived ID manually in the past.

#+begin_src emacs-lisp
(defun my/org-archive-delete-logbook ()
  (save-excursion
   (org-end-of-meta-data)
   (let ((elm (org-element-at-point)))
     (when (and
            (equal (org-element-type elm) 'drawer)
            (equal (org-element-property :drawer-name elm) "LOGBOOK"))
       (delete-region (org-element-property :begin elm)
                      (org-element-property :end elm))))))

(defun my/org-archive-without-delete ()
  (cl-letf (((symbol-function 'org-cut-subtree) (lambda () nil)))
    (org-archive-subtree)))

(defun my/org-archive-logbook ()
  (interactive)
  (my/org-archive-without-delete)
  (my/org-archive-delete-logbook))
#+end_src

Best,
Ihor

Reply via email to