emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/annotate abe23338cb 235/372: - ensured that the modified s


From: ELPA Syncer
Subject: [nongnu] elpa/annotate abe23338cb 235/372: - ensured that the modified status of as buffer is not modified by the local
Date: Fri, 4 Feb 2022 16:59:03 -0500 (EST)

branch: elpa/annotate
commit abe23338cbe4994e56c1c63a89fa901df5cbdd85
Author: cage <cage-invalid@invalid>
Commit: cage <cage-invalid@invalid>

    - ensured that the modified status of as buffer is not modified by the local
      function 'delete' in 'annotate-change-annotation'.
---
 annotate.el | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/annotate.el b/annotate.el
index a176abcf9e..d57a8c69a7 100644
--- a/annotate.el
+++ b/annotate.el
@@ -278,6 +278,14 @@ annotation as defined in the database."
              ,@body)
          (setf inhibit-modification-hooks ,old-mode)))))
 
+(cl-defmacro annotate-with-restore-modified-bit (&rest body)
+  "Save the value of `buffer-modified-p' before `body' is exectuted
+  and restore the saved value just after the end of `body'."
+  (let ((modifiedp (gensym)))
+    `(let ((,modifiedp (buffer-modified-p)))
+       ,@body
+       (set-buffer-modified-p modifiedp))))
+
 (defun annotate-end-of-line-pos ()
  "Get the position of the end of line and rewind the point's
 position (so that it is unchanged after this function is called)."
@@ -1320,7 +1328,7 @@ annotation."
                                             (overlay-end ov))
       (delete-overlay ov)
       (setf modifiedp t)
-    (set-buffer-modified-p modifiedp))))
+      (set-buffer-modified-p modifiedp))))
 
 (defun annotate-string-empty-p (a)
   "Is the arg an empty string or null?"
@@ -1593,13 +1601,14 @@ The searched interval can be customized setting the 
variable:
          (annotation-text (read-from-minibuffer annotate-annotation-prompt
                                                 (overlay-get highlight 
'annotation))))
     (cl-labels ((delete (annotation)
-                 (let ((chain (annotate-find-chain annotation)))
-                   (dolist (single-element chain)
-                     (goto-char (overlay-end single-element))
-                     (move-end-of-line nil)
+                 (let ((chain      (annotate-find-chain annotation)))
+                   (annotate-with-restore-modified-bit
+                    (dolist (single-element chain)
+                      (goto-char (overlay-end single-element))
+                      (move-end-of-line nil)
                       (annotate--remove-annotation-property (overlay-start 
single-element)
                                                             (overlay-end   
single-element))
-                      (delete-overlay single-element))))
+                      (delete-overlay single-element)))))
                 (change (annotation)
                   (let ((chain (annotate-find-chain annotation)))
                     (dolist (single-element chain)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]