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

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

[nongnu] elpa/annotate 26ea8e3631 266/372: - prevented getting shared va


From: ELPA Syncer
Subject: [nongnu] elpa/annotate 26ea8e3631 266/372: - prevented getting shared value for 'annotate-file' in '%load-annotation-data'.
Date: Fri, 4 Feb 2022 16:59:06 -0500 (EST)

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

    - prevented getting shared value for 'annotate-file' in 
'%load-annotation-data'.
---
 annotate.el | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/annotate.el b/annotate.el
index 0e899fa243..19e677e028 100644
--- a/annotate.el
+++ b/annotate.el
@@ -1340,16 +1340,19 @@ annotation."
 (defun annotate-load-annotation-data (&optional ignore-errors)
   "Read and return saved annotations."
   (cl-flet ((%load-annotation-data ()
-              (with-temp-buffer
-                (if (file-exists-p annotate-file)
-                    (insert-file-contents annotate-file)
-                  (signal 'annotate-db-file-not-found (list annotate-file)))
-                (goto-char (point-max))
-                (cond ((= (point) 1)
-                       nil)
-                      (t
-                       (goto-char (point-min))
-                       (read (current-buffer)))))))
+              (let ((annotations-file annotate-file))
+                (with-temp-buffer
+                  (let* ((annotate-file annotations-file)
+                         (attributes    (file-attributes annotate-file)))
+                    (cond
+                     ((not (file-exists-p annotate-file))
+                      (signal 'annotate-db-file-not-found (list 
annotate-file)))
+                     ((= (file-attribute-size attributes)
+                         0)
+                      nil)
+                     (t
+                      (insert-file-contents annotate-file)
+                      (read (current-buffer)))))))))
     (if ignore-errors
         (ignore-errors (%load-annotation-data))
       (%load-annotation-data))))



reply via email to

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