Re: Remove old clock entries

2021-09-05 Thread Ihor Radchenko
TRS-80  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



Re: Remove old clock entries

2021-03-03 Thread TRS-80

On 2021-03-01 01:20, Julien Cubizolles wrote:

I'm clocking the time spent on daily tasks like email and for that I
have a "Daily Routine" TODO entry. Clocking in this task adds a new
clock line everyday, leading to a very populated CLOCK drawer. I'd
like to limit its size by either a maximum number of clock entries
by removing the older ones or better, removing the entries older
than some date. Is there some variable to that effect ?


Not that I am aware of (anyone is welcome to correct me if I am
wrong).

Because I have similar problem, I have been thinking about this for a
while.  I am no longer clocking, but in my case I have a lot of state
change logging.  But these are similar.

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.  :)

Cheers,
TRS-80