Merge branch 'dev' into plist-group-handle-split-plists

This commit is contained in:
contrapunctus 2021-12-04 22:45:12 +05:30
commit 2ac54f418a
3 changed files with 16 additions and 10 deletions

View File

@ -1144,7 +1144,7 @@ STREAM (which is the value of `current-buffer')."
;; count-records:1 ends here
;; [[file:chronometrist.org::*latest-date-records][latest-date-records:1]]
(cl-defmethod chronometrist-latest-date-records (backend)
(cl-defmethod chronometrist-latest-date-records ((backend chronometrist-plist-backend))
(with-slots (hash-table) backend
(let ((latest-date (chronometrist-events-last-date hash-table)))
(cons latest-date
@ -1443,7 +1443,7 @@ Return
;; latest-record:1 ends here
;; [[file:chronometrist.org::*latest-date-records][latest-date-records:1]]
(cl-defmethod chronometrist-latest-date-records (backend)
(cl-defmethod chronometrist-latest-date-records ((backend chronometrist-plist-group-backend))
(chronometrist-sexp-in-file (chronometrist-backend-file backend)
(goto-char (point-max))
(chronometrist-backward-read-sexp (current-buffer))))
@ -2028,9 +2028,11 @@ is the name of the task to be clocked out of."
;; [[file:chronometrist.org::*goto-last-task][goto-last-task:1]]
(defun chronometrist-goto-last-task ()
"In the `chronometrist' buffer, move point to the line containing the last active task."
(goto-char (point-min))
(re-search-forward (plist-get (chronometrist-latest-record (chronometrist-active-backend)) :name) nil t)
(beginning-of-line))
(let* ((latest-record (chronometrist-latest-record (chronometrist-active-backend)))
(name (plist-get latest-record :name)))
(goto-char (point-min))
(re-search-forward name nil t)
(beginning-of-line)))
;; goto-last-task:1 ends here
;; [[file:chronometrist.org::*print-non-tabular][print-non-tabular:1]]

View File

@ -1854,7 +1854,7 @@ STREAM (which is the value of `current-buffer')."
**** latest-date-records :reader:method:
#+BEGIN_SRC emacs-lisp
(cl-defmethod chronometrist-latest-date-records (backend)
(cl-defmethod chronometrist-latest-date-records ((backend chronometrist-plist-backend))
(with-slots (hash-table) backend
(let ((latest-date (chronometrist-events-last-date hash-table)))
(cons latest-date
@ -2276,7 +2276,7 @@ Note that migrating from the plist backend to the plist group backend is inheren
**** latest-date-records :reader:method:
#+BEGIN_SRC emacs-lisp
(cl-defmethod chronometrist-latest-date-records (backend)
(cl-defmethod chronometrist-latest-date-records ((backend chronometrist-plist-group-backend))
(chronometrist-sexp-in-file (chronometrist-backend-file backend)
(goto-char (point-max))
(chronometrist-backward-read-sexp (current-buffer))))
@ -2933,10 +2933,13 @@ is the name of the task to be clocked out of."
#+BEGIN_SRC emacs-lisp
(defun chronometrist-goto-last-task ()
"In the `chronometrist' buffer, move point to the line containing the last active task."
(goto-char (point-min))
(re-search-forward (plist-get (chronometrist-latest-record (chronometrist-active-backend)) :name) nil t)
(beginning-of-line))
(let* ((latest-record (chronometrist-latest-record (chronometrist-active-backend)))
(name (plist-get latest-record :name)))
(goto-char (point-min))
(re-search-forward name nil t)
(beginning-of-line)))
#+END_SRC
**** CLEANUP print-non-tabular :procedure:
#+BEGIN_SRC emacs-lisp
(defun chronometrist-print-non-tabular ()

View File

@ -137,6 +137,7 @@
*** plist-group-p
#+BEGIN_SRC emacs-lisp
(ert-deftest chronometrist-plist-group-p ()
(should (eq t (chronometrist-plist-group-p '(symbol (:a 1 :b 2)))))
(should (eq t (chronometrist-plist-group-p '("string" (:a 1 :b 2)))))
(should (not (chronometrist-plist-group-p nil)))
(should (not (chronometrist-plist-group-p '("string")))))