From 92564720e691921654560c71ba14498e648bd067 Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Tue, 15 Feb 2022 20:30:26 +0530 Subject: [PATCH] Define accessor for intervals --- elisp/chronometrist.el | 11 +++++++++++ elisp/chronometrist.org | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/elisp/chronometrist.el b/elisp/chronometrist.el index 2031ed5..2433405 100644 --- a/elisp/chronometrist.el +++ b/elisp/chronometrist.el @@ -428,6 +428,17 @@ in a hash table returned by `chronometrist-to-hash-table'." do (cl-return plist))) ;; date-properties:1 ends here +;; [[file:chronometrist.org::*record-intervals][record-intervals:1]] +(defun chronometrist-record-intervals (plist-group) + "Return plists from PLIST-GROUP. +PLIST-GROUP must be a tagged list as returned by +`chronometrist-latest-record'." + (cl-loop for elt being the elements of plist-group + using (index i) + when (chronometrist-plist-p elt) + return (seq-drop plist-group i))) +;; record-intervals:1 ends here + ;; [[file:chronometrist.org::*iso-to-ts][iso-to-ts:1]] (defun chronometrist-iso-to-ts (timestamp) "Convert TIMESTAMP to a TS struct. (see `ts.el') diff --git a/elisp/chronometrist.org b/elisp/chronometrist.org index 5f23bc1..62e3282 100644 --- a/elisp/chronometrist.org +++ b/elisp/chronometrist.org @@ -964,6 +964,18 @@ in a hash table returned by `chronometrist-to-hash-table'." do (cl-return plist))) #+END_SRC +*** record-intervals :function: +#+BEGIN_SRC elisp +(defun chronometrist-record-intervals (plist-group) + "Return plists from PLIST-GROUP. +PLIST-GROUP must be a tagged list as returned by +`chronometrist-latest-record'." + (cl-loop for elt being the elements of plist-group + using (index i) + when (chronometrist-plist-p elt) + return (seq-drop plist-group i))) +#+END_SRC + ** Time functions *** iso-to-ts :function: #+BEGIN_SRC emacs-lisp