]> git.eshelyaron.com Git - emacs.git/commitdiff
project--read-project-list: Add structure verification
authorDmitry Gutov <dgutov@yandex.ru>
Fri, 26 Jun 2020 00:41:42 +0000 (03:41 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Fri, 26 Jun 2020 00:43:14 +0000 (03:43 +0300)
* lisp/progmodes/project.el (project--list): Update docstring.
(project--read-project-list): Add structure verification.

lisp/progmodes/project.el

index add0e592f696dbb56aa2c48eb000b3b1045791df..7e25869e2862a4178a592a84c5e688878f47cac7 100644 (file)
@@ -874,7 +874,8 @@ Certain buffers may be \"spared\", see `project-kill-buffers-ignores'."
   :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 `project-kill-buffers-ignores'."
           (when (file-exists-p filename)
             (with-temp-buffer
               (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."