Skip to content

Commit 738c158

Browse files
authored
Merge pull request #165 from krvkir/master
[add] autosave option
2 parents c5a41ce + 79ec130 commit 738c158

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

annotate.el

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,11 @@ of lines. The center of the region is the position of the
251251
annotation as defined in the database."
252252
:type 'number)
253253

254+
(defcustom annotate-autosave nil
255+
"Whether annotations should be saved after each user action,
256+
e.g. new annotation created, existing one amended or deleted."
257+
:type 'boolean)
258+
254259
(defconst annotate-prop-chain-position
255260
'position)
256261

@@ -886,7 +891,9 @@ and
886891
; with proper text
887892
(forward-line 1)
888893
(goto-char (annotate-end-of-line-pos))
889-
(annotate-annotate)))))))))))))))
894+
(annotate-annotate))))))))))))
895+
(when annotate-autosave
896+
(annotate-save-annotations)))))
890897

891898
(defun annotate-toggle-annotation-text ()
892899
"Hide annotation's text at current cursor's point, if such annotation exists."
@@ -2526,7 +2533,9 @@ point)."
25262533
(let* ((delete-confirmed-p (annotate--confirm-annotation-delete)))
25272534
(when delete-confirmed-p
25282535
(annotate--delete-annotation-chain annotation)
2529-
(font-lock-flush)))))
2536+
(font-lock-flush)))
2537+
(when annotate-autosave
2538+
(annotate-save-annotations))))
25302539

25312540
(defun annotate--confirm-append-newline-at-the-end-of-buffer ()
25322541
"Prompt user for appending newline confirmation.

0 commit comments

Comments
 (0)