[data structures] add reset command

This commit is contained in:
contrapunctus 2021-02-18 15:52:26 +05:30
parent 620ea5433e
commit 83bbe0bd6a
3 changed files with 20 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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