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

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

[nongnu] elpa/annotate a59cc2c6b2 172/372: - when 'delete' button from a


From: ELPA Syncer
Subject: [nongnu] elpa/annotate a59cc2c6b2 172/372: - when 'delete' button from a summary window is activated redraw and
Date: Fri, 4 Feb 2022 16:58:56 -0500 (EST)

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

    - when 'delete' button  from a summary window is  activated redraw and
      update a window that is displayng the file that contains the deleted
      annotation (if such buffer exists).
---
 annotate.el | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/annotate.el b/annotate.el
index 29af2cb00a..ee3255a47f 100644
--- a/annotate.el
+++ b/annotate.el
@@ -1511,16 +1511,27 @@ sophisticated way than plain text"
          (end-of-button   (button-get button 'end-of-button))
          (db              (annotate-load-annotation-data))
          (filtered        (annotate-db-remove-annotation db filename beginning 
ending)))
-    (annotate-dump-annotation-data filtered)
-    (with-current-buffer annotate-summary-buffer-name
-      (read-only-mode -1)
-      (save-excursion
-        (button-put button 'invisible t)
-        (let ((annotation-button (previous-button (point))))
-          (button-put annotation-button 'face '(:strike-through t)))
-        (let ((replace-button (next-button (point))))
-          (button-put replace-button 'invisible t)))
-      (read-only-mode 1))))
+    (annotate-dump-annotation-data filtered) ; save the new database with 
entry removed
+    (cl-labels ((redraw-summary-window () ; update the summary window
+                  (with-current-buffer annotate-summary-buffer-name
+                    (read-only-mode -1)
+                    (save-excursion
+                      (button-put button 'invisible t)
+                      (let ((annotation-button (previous-button (point))))
+                        (button-put annotation-button 'face '(:strike-through 
t)))
+                      (let ((replace-button (next-button (point))))
+                        (button-put replace-button 'invisible t)))
+                    (read-only-mode 1)))
+                ;; if the file where the  deleted annotation belong to is 
visited,
+                ;; update the buffer
+                (update-visited-buffer-maybe ()
+                  (let ((visited-buffer (find-buffer-visiting filename)))
+                    (when visited-buffer ;; a buffer is visiting the file
+                      (with-current-buffer visited-buffer
+                        (annotate-mode -1)
+                        (annotate-mode  1))))))
+      (redraw-summary-window)
+      (update-visited-buffer-maybe))))
 
 (defun annotate-summary-replace-annotation-button-pressed (button)
   (let* ((filename             (button-get button 'file))



reply via email to

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