From 3e7c41c9f710e21e9aa22854462e905737284e2d Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Sat, 4 Sep 2021 20:25:18 +0530 Subject: [PATCH] Create on-file-change generic --- elisp/chronometrist.el | 3 +++ elisp/chronometrist.org | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/elisp/chronometrist.el b/elisp/chronometrist.el index e7d9be1..4909d5a 100644 --- a/elisp/chronometrist.el +++ b/elisp/chronometrist.el @@ -420,6 +420,9 @@ Hash table keys are ISO-8601 date strings. Hash table values are lists of record (cl-defgeneric chronometrist-list-records (backend) "Return all records in BACKEND as a list of plists, in reverse chronological order.") +(cl-defgeneric chronometrist-on-file-change (backend) + "Function to be run when file for BACKEND changes.") + (defclass chronometrist-plist-backend (chronometrist-backend) ()) (add-to-list 'chronometrist-backends-alist diff --git a/elisp/chronometrist.org b/elisp/chronometrist.org index 05b1526..292df3b 100644 --- a/elisp/chronometrist.org +++ b/elisp/chronometrist.org @@ -1035,6 +1035,11 @@ Hash table keys are ISO-8601 date strings. Hash table values are lists of record (cl-defgeneric chronometrist-list-records (backend) "Return all records in BACKEND as a list of plists, in reverse chronological order.") #+END_SRC +**** on-file-change :generic:function: +#+BEGIN_SRC emacs-lisp +(cl-defgeneric chronometrist-on-file-change (backend) + "Function to be run when file for BACKEND changes.") +#+END_SRC *** plist backend In this format, user data is stored as Elisp plists in a plain text file. A basic plist in this file looks like this -