Subject: Re: bug#41741: [PATCH] Save project list as lisp data

From: Simen Heggestøyl <[email-masked]>
Date: Sun, 07 Jun 2020 21:55:06 +0200

Dmitry Gutov <[email-masked]> writes:

> On 06.06.2020 19:40, Simen Heggestøyl wrote:
>
>> No metadata is added at this point, but it makes it extensible for the
>> future.
>
> I'm not sure we'd really be able to store metadata in it. The list is
> more or less transient: the entries are added automatically, and
> removed automatically as well. If someone needs to know something
> about a project, it's better to leave that to an overridable method,
> and maybe add a project-vc- variable (if that value needs to be
> user-customizable).
>
> For that reason, we should probably opt for storing directories only.

It is transient now, yes. But the biggest gain from going from the
one-directory-per-line format to the proposed alist format is (in my
view) having the possibility to extend its uses in the future without
breaking backward compatibility with existing project list files.

Just as an example I can imagine an optional feature in the future where
you could name a project interactively the first time it's seen
(i.e. when it's added to the project list for the first time). I
wouldn't like to maintain that in my config file; having the name live
in the project list only would be fine with me. That would require
extending project.el to keep project metadata when rearranging them.

>> -  "Initialize `project--list' from the project list file."
>> +  "Initialize `project--list' from the file `project-list-file'."
>
> I think the previous string was okay.

Alright, reverted.

>> -          (when (file-exists-p filename)
>> +          (when (file-readable-p filename)
>
> What's the difference? File exists, but belongs to another account?
> I'm not sure we'd want to silently fail in that case (kinda puzzling
> behavior), and writing to the file is likely to fail later too.

Hm, yes. I snatched that part from saveplace.el, but after you pointed
it out I now also think it's better to get an error in that
case. Reverted.

>> +              (car (read-from-string (buffer-string))))))))
>
> AKA:
>
>      (goto-char (point-min))
>      (read (current-buffer))
>
> Though the practical difference will be tiny.

I don't mind changing it, but could you explain the difference to me? My
understanding isn't deep enough to see anything but one line versus
two. :)

-- Simen