[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate 5cc5bbd0d8 1/5: - removed the use of 'after-save-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate 5cc5bbd0d8 1/5: - removed the use of 'after-save-hook', used 'kill-buffer-hook' and |
Date: |
Thu, 7 Jul 2022 08:58:10 -0400 (EDT) |
branch: elpa/annotate
commit 5cc5bbd0d80f08b347d38b38453797aef8778f43
Author: cage <cage@invalid>
Commit: cage <cage@invalid>
- removed the use of 'after-save-hook', used 'kill-buffer-hook' and
'kill-emacs-hook', instead.
Using these two hooks prevents the buffer to be marked as modified
when, in fact, only the annotation has been changed (or
added/deleted).
---
annotate.el | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/annotate.el b/annotate.el
index cf2059b14a..12cb4814fb 100644
--- a/annotate.el
+++ b/annotate.el
@@ -468,7 +468,8 @@ local version (i.e. a different database for each annotated
file"
"Load annotations and set up save and display hooks."
(annotate--maybe-database-set-buffer-local)
(annotate-load-annotations)
- (add-hook 'after-save-hook #'annotate-save-annotations t t)
+ (add-hook 'kill-buffer-hook #'annotate-save-annotations t t)
+ (add-hook 'kill-emacs-hook #'annotate-save-annotations t t)
;; This hook is needed to reorganize the layout of the annotation
;; text when a window vertically resized
(add-hook 'window-size-change-functions #'on-window-size-change t t)
@@ -486,7 +487,8 @@ local version (i.e. a different database for each annotated
file"
(defun annotate-shutdown ()
"Clear annotations and remove save and display hooks."
(annotate-clear-annotations)
- (remove-hook 'after-save-hook #'annotate-save-annotations t)
+ (remove-hook 'kill-buffer-hook #'annotate-save-annotations t)
+ (remove-hook 'kill-emacs-hook #'annotate-save-annotations t)
(remove-hook 'window-size-change-functions #'on-window-size-change t)
(remove-hook 'before-change-functions #'annotate-before-change-fn t)
(remove-hook 'Info-selection-hook #'annotate-info-select-fn t)
@@ -735,8 +737,7 @@ specified by `FROM' and `TO'."
; with proper text
(forward-line 1)
(goto-char (annotate-end-of-line-pos))
- (annotate-annotate))))))))))))
- (set-buffer-modified-p t))))
+ (annotate-annotate)))))))))))))))
(cl-defun annotate-goto-next-annotation (&key (startingp t))
"Move point to the next annotation."
@@ -1462,8 +1463,7 @@ essentially what you get from:
"Load all annotations from disk in old format."
(interactive)
(let ((annotations (cdr (assoc-string (annotate-actual-file-name)
- (annotate-load-annotation-data t))))
- (modified-p (buffer-modified-p)))
+ (annotate-load-annotation-data t)))))
;; remove empty annotations created by earlier bug:
(setq annotations (cl-remove-if (lambda (ann) (null (nth 2 ann)))
annotations))
@@ -1477,7 +1477,6 @@ essentially what you get from:
(end (annotate-ending-of-annotation
annotation))
(annotation-string (annotate-annotation-string
annotation)))
(annotate-create-annotation start end annotation-string nil)))))
- (set-buffer-modified-p modified-p)
(font-lock-flush)
(when annotate-use-messages
(message "Annotations loaded."))))
@@ -1525,8 +1524,7 @@ example:
(annotation-dump (assoc-string filename all-annotations-data))
(annotations (annotate-annotations-from-dump
annotation-dump))
(old-checksum (annotate-checksum-from-dump annotation-dump))
- (new-checksum (annotate-buffer-checksum))
- (modified-p (buffer-modified-p)))
+ (new-checksum (annotate-buffer-checksum)))
(if (old-format-p annotation-dump)
(annotate-load-annotation-old-format)
(when (and annotate-warn-if-hash-mismatch
@@ -1553,7 +1551,6 @@ example:
end
annotation-string
annotated-text))))))
- (set-buffer-modified-p modified-p)
(font-lock-flush)
(when annotate-use-messages
(message "Annotations loaded."))))))
@@ -1730,8 +1727,7 @@ functions)."
(defun annotate-clear-annotations ()
"Clear all current annotations."
(interactive)
- (let ((overlays (overlays-in 0 (buffer-size)))
- (modifiedp (buffer-modified-p)))
+ (let ((overlays (overlays-in 0 (buffer-size))))
;; only remove annotations, not all overlays
(setq overlays (cl-remove-if
(lambda (ov) (not (annotationp ov)))
@@ -1739,9 +1735,7 @@ functions)."
(dolist (ov overlays)
(annotate--remove-annotation-property (overlay-start ov)
(overlay-end ov))
- (delete-overlay ov)
- (setf modifiedp t)
- (set-buffer-modified-p modifiedp))))
+ (delete-overlay ov))))
(defun annotate-string-empty-p (a)
"Is the arg `A' an empty string or null?"
@@ -2140,8 +2134,7 @@ point)."
(let* ((delete-confirmed-p (annotate--confirm-annotation-delete)))
(when delete-confirmed-p
(annotate--delete-annotation-chain annotation)
- (font-lock-flush)
- (set-buffer-modified-p t)))))
+ (font-lock-flush)))))
(defun annotate-change-annotation (pos)
"Change annotation at point. If empty, delete annotation."
- [nongnu] elpa/annotate updated (7f48fad362 -> 4c697e70e8), ELPA Syncer, 2022/07/07
- [nongnu] elpa/annotate dc5781a074 3/5: - updated changelog., ELPA Syncer, 2022/07/07
- [nongnu] elpa/annotate 5cc5bbd0d8 1/5: - removed the use of 'after-save-hook', used 'kill-buffer-hook' and,
ELPA Syncer <=
- [nongnu] elpa/annotate 9bfa065a4e 4/5: - moved version number to 1.7.0., ELPA Syncer, 2022/07/07
- [nongnu] elpa/annotate d6c941b79a 2/5: - updated version and NEWS.org, ELPA Syncer, 2022/07/07
- [nongnu] elpa/annotate 4c697e70e8 5/5: Merge pull request #132 from cage2/no-modified-bit, ELPA Syncer, 2022/07/07