[chronometrist] add loop-file example

This commit is contained in:
contrapunctus 2021-04-16 09:39:48 +05:30
parent 9372fb7bb0
commit 18769a28b2
1 changed files with 15 additions and 0 deletions

View File

@ -600,6 +600,21 @@ Return nil (and run `magit-status') if the user answers no."
(generate-new-buffer-name "sed-tangle")
(format "sed -n '/#+BEGIN_SRC emacs-lisp$/,/#+END_SRC$/{//!p;}' ~s.org > ~s.el" base base)))))
#+END_SRC
An example of querying the Chronometrist file data - finding out how much time I've spent on tasks matching a certain criteria.
#+BEGIN_SRC emacs-lisp :tangle no :load no
(chronometrist-loop-file for plist in chronometrist-file
with count = 0
when (and (equal (plist-get plist :name) "Composing")
(equal (plist-get plist :song) "आदि काल से आज तलक"))
sum (chronometrist-interval plist) into seconds
and do (cl-incf count)
finally return
(format "%s over %s days."
(ts-human-format-duration seconds)
count))
#+END_SRC
*** WISH emms
1. [ ] make toggle command for emms-start/emms-stop