From e6d0afe82b03a741abfdaaf3d383dc37924a705a Mon Sep 17 00:00:00 2001 From: Kirill Krasnoshchekov Date: Mon, 17 Feb 2025 03:44:55 +0400 Subject: [PATCH 1/3] [add] autosave option --- annotate.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/annotate.el b/annotate.el index 5236c5a..235d398 100644 --- a/annotate.el +++ b/annotate.el @@ -251,6 +251,11 @@ of lines. The center of the region is the position of the annotation as defined in the database." :type 'number) +(defcustom annotate-autosave t + "Whether annotations should be saved after each user action, +e.g. new annotation created, existing one amenede or deleted." + :type 'boolean) + (defconst annotate-prop-chain-position 'position) @@ -886,7 +891,8 @@ and ; with proper text (forward-line 1) (goto-char (annotate-end-of-line-pos)) - (annotate-annotate))))))))))))))) + (annotate-annotate)))))))))))) + (if annotate-autosave (annotate-save-annotations))))) (defun annotate-toggle-annotation-text () "Hide annotation's text at current cursor's point, if such annotation exists." @@ -2526,7 +2532,8 @@ point)." (let* ((delete-confirmed-p (annotate--confirm-annotation-delete))) (when delete-confirmed-p (annotate--delete-annotation-chain annotation) - (font-lock-flush))))) + (font-lock-flush))) + (if annotate-autosave (annotate-save-annotations)))) (defun annotate--confirm-append-newline-at-the-end-of-buffer () "Prompt user for appending newline confirmation. From 0641d322af8aac39da1b1559d9f531294ce02b00 Mon Sep 17 00:00:00 2001 From: Kirill Krasnoshchekov Date: Fri, 21 Feb 2025 00:42:01 +0400 Subject: [PATCH 2/3] [fix] make autosave disabled by default --- annotate.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/annotate.el b/annotate.el index 235d398..3ba6d4c 100644 --- a/annotate.el +++ b/annotate.el @@ -251,7 +251,7 @@ of lines. The center of the region is the position of the annotation as defined in the database." :type 'number) -(defcustom annotate-autosave t +(defcustom annotate-autosave nil "Whether annotations should be saved after each user action, e.g. new annotation created, existing one amenede or deleted." :type 'boolean) From 79ec13034cc88b0ce8ba9985f80101120f39bfd8 Mon Sep 17 00:00:00 2001 From: Kirill Krasnoshchekov Date: Sun, 2 Mar 2025 21:10:11 +0400 Subject: [PATCH 3/3] [fix] a typo in the doc, if -> when, improved formatting --- annotate.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/annotate.el b/annotate.el index 3ba6d4c..10b3206 100644 --- a/annotate.el +++ b/annotate.el @@ -253,7 +253,7 @@ annotation as defined in the database." (defcustom annotate-autosave nil "Whether annotations should be saved after each user action, -e.g. new annotation created, existing one amenede or deleted." +e.g. new annotation created, existing one amended or deleted." :type 'boolean) (defconst annotate-prop-chain-position @@ -892,7 +892,8 @@ and (forward-line 1) (goto-char (annotate-end-of-line-pos)) (annotate-annotate)))))))))))) - (if annotate-autosave (annotate-save-annotations))))) + (when annotate-autosave + (annotate-save-annotations))))) (defun annotate-toggle-annotation-text () "Hide annotation's text at current cursor's point, if such annotation exists." @@ -2533,7 +2534,8 @@ point)." (when delete-confirmed-p (annotate--delete-annotation-chain annotation) (font-lock-flush))) - (if annotate-autosave (annotate-save-annotations)))) + (when annotate-autosave + (annotate-save-annotations)))) (defun annotate--confirm-append-newline-at-the-end-of-buffer () "Prompt user for appending newline confirmation.