[Top][All Lists]

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

master 96ff641 3/3: project--read-project-list: Add structure verificati

From: Dmitry Gutov
Subject: master 96ff641 3/3: project--read-project-list: Add structure verification
Date: Thu, 25 Jun 2020 20:43:41 -0400 (EDT)

branch: master
commit 96ff641cd90217d4dfa1ab621e3c6a18d409fc76
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    project--read-project-list: Add structure verification
    * lisp/progmodes/project.el (project--list): Update docstring.
    (project--read-project-list): Add structure verification.
 lisp/progmodes/project.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index add0e59..7e25869 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -874,7 +874,8 @@ Certain buffers may be \"spared\", see 
   :group 'project)
 (defvar project--list 'unset
-  "List of known project directories.")
+  "List structure containing root directories of known projects.
+With some possible metadata (to be decided).")
 (defun project--read-project-list ()
   "Initialize `project--list' using contents of `project-list-file'."
@@ -883,7 +884,14 @@ Certain buffers may be \"spared\", see 
           (when (file-exists-p filename)
               (insert-file-contents filename)
-              (read (current-buffer)))))))
+              (read (current-buffer)))))
+    (unless (seq-every-p
+             (lambda (elt) (and (listp elt)
+                           (stringp (car elt))))
+             project--list)
+      (warn "Contents of %s are in wrong format, resetting"
+            project-list-file)
+      (setq project--list nil))))
 (defun project--ensure-read-project-list ()
   "Initialize `project--list' if it isn't already initialized."

reply via email to

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