emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Remove old clock entries


From: Ihor Radchenko
Subject: Re: Remove old clock entries
Date: Sun, 05 Sep 2021 21:49:10 +0800

TRS-80 <lists.trs-80@isnotmyreal.name> writes:

> I was thinking about incorporating some handling of these entries into
> a custom archival function.  Which would also handle some other things
> at the same time.  But so far, it's just some notes and thoughts about
> desired functionality and how it might work.  And I keep monitoring
> the mailing list for some better ideas.  :)

FYI:

Credit: 
https://www.reddit.com/r/orgmode/comments/dg43hs/can_i_archive_a_property_drawer/f3frk2n/

#+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

[Prev in Thread] Current Thread [Next in Thread]