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

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

[nongnu] elpa/annotate a04a6144aa 240/372: Merge pull request #75 from c


From: ELPA Syncer
Subject: [nongnu] elpa/annotate a04a6144aa 240/372: Merge pull request #75 from cage2/master
Date: Fri, 4 Feb 2022 16:59:03 -0500 (EST)

branch: elpa/annotate
commit a04a6144aaf31b2547f0988dff1f035fb8aa20ae
Merge: 99d99e5bcb 553116dc61
Author: cage2 <1257703+cage2@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #75 from cage2/master
    
    Added dependency on info and removed duplicated operation
---
 Changelog   |  7 +++++++
 NEWS.org    |  3 +++
 annotate.el | 26 +++++++++++++++++++-------
 3 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/Changelog b/Changelog
index 101524003c..badeb620e7 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,10 @@
+2020-07-01
+       * annotate.el (annotate-change-annotation)
+
+       - ensured that the modified status of as buffer is not modified by the 
local
+       function 'delete' in 'annotate-change-annotation';
+       - added dependency on 'info'.
+
 2020-06-26
        * annotate.el (annotate-switch-db)
        - Added file argument 'database-file-path',
diff --git a/NEWS.org b/NEWS.org
index 5d65662c4e..25e31feb82 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -120,3 +120,6 @@
 
 - 2020-06-26 V0.8.1 Bastian Bechtold, cage ::
   Added file argument to ~annotate-switch-db~.
+
+- 2020-07-01 V0.8.2 Bastian Bechtold, cage ::
+  Added explicit dependency on 'info' and removed a duplicated operation.
diff --git a/annotate.el b/annotate.el
index a176abcf9e..3677e2ab3e 100644
--- a/annotate.el
+++ b/annotate.el
@@ -50,12 +50,15 @@
 ;; can not be annotated.
 
 ;;; Code:
+
+(require 'info)
+
 (require 'cl-lib)
 
 ;;;###autoload
 (defgroup annotate nil
   "Annotate files without changing them."
-  :version "0.8.1"
+  :version "0.8.2"
   :group 'text)
 
 ;;;###autoload
@@ -278,6 +281,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 +1331,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 +1604,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]