diff --git a/CHANGELOG.md b/CHANGELOG.md index a093d10..138823c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.7.0] - 2021-02-12 +## [Unreleased] ### Added * Single key prompts for key-values - `chronometrist-tag-choice`, and `chronometrist-key-values-unified-choice`, with more to come. +* `chronometrist-reset`, to clear all internal state ### Removed * `chronometrist-skip-query-prompt`, `chronometrist-skip-query-reset`, and `chronometrist--skip-detail-prompts` - these are covered by the new single key prompt functions diff --git a/elisp/chronometrist.el b/elisp/chronometrist.el index a141a70..eb76047 100644 --- a/elisp/chronometrist.el +++ b/elisp/chronometrist.el @@ -450,6 +450,14 @@ file names respectively." (chronometrist-migrate-timelog-file-to-sexp-file timeclock-file chronometrist-file) (message "You can migrate later using `chronometrist-migrate-timelog-file-to-sexp-file'.")))) +(defun chronometrist-reset () + "Reset Chronometrist's internal state." + (interactive) + (chronometrist-reset-task-list) + (chronometrist-events-populate) + (setq chronometrist--file-state nil) + (chronometrist-refresh)) + (defvar chronometrist-events (make-hash-table :test #'equal) "Each key is a date in the form (YEAR MONTH DAY). Values are lists containing events, where each event is a list in diff --git a/elisp/chronometrist.org b/elisp/chronometrist.org index b70705e..f951fe8 100644 --- a/elisp/chronometrist.org +++ b/elisp/chronometrist.org @@ -602,6 +602,16 @@ file names respectively." (message "You can migrate later using `chronometrist-migrate-timelog-file-to-sexp-file'.")))) #+END_SRC *** Data structures +**** reset-state :command: +#+BEGIN_SRC emacs-lisp +(defun chronometrist-reset () + "Reset Chronometrist's internal state." + (interactive) + (chronometrist-reset-task-list) + (chronometrist-events-populate) + (setq chronometrist--file-state nil) + (chronometrist-refresh)) +#+END_SRC **** chronometrist-events :variable: :PROPERTIES: :VALUE: hash table