bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#57418: 28.1; Projects not saved when vc-handled-backends is nil


From: Philip Kaludercic
Subject: bug#57418: 28.1; Projects not saved when vc-handled-backends is nil
Date: Fri, 26 Aug 2022 07:46:06 +0000

Louis-Guillaume Gagnon <gagnonlg@protonmail.com> writes:

>
> Good day,
>
> I've recently been migrating from projectile to the built-in
> project.el. Since then, one major annoyance is that the projects are
> never saved into project-list-file, so I have to re-enter the projects'
> paths everytime I make a query.
>
> I have narrowed it down to vc-handled-backends being set to nil in my
> init-file. If it's left at its default, it works as expected. I could
> just leave the variable at its default but (iirc) it's part of a bunch
> of optimizations I made to speedup my TRAMP setup, so I'm reluctant to
> do that.  And just to be perfectly clear, the rest of project mode seemingly
> works as expected if that variable is nil, it's just the projects are
> not saved.
>
> Steps to reproduce from emacs -Q:
>
> + (setq 'vc-handled-backends nil)
>
> + Use project.el to find a file in any project not in your
> project-list-file, e.g. with C-x p p
>
> + Open your project-list-file, "/.emacs.d/projects" in my case
>
> Expected result: The recently opened project is listed
> Actual result: The recently opened project is *not* listed

This is to be expected, as by default `project-find-functions' only
includes one function that uses and relies on VC.  If it were just this,
I would therefore not consider this to be a bug.  Does anything else
work?  `project-find-file', `project-shell', `project-compile', ...?

What might be worth doing is issuing a warning if `project-try-vc' (the
default project-finding-function) is invoked while VC is effectively
disabled.

You could try solving this by either adding your own alternative to
`project-try-vc' (e.g. if you just use Git, then this

--8<---------------cut here---------------start------------->8---
(defun project-try-git (dir)
  "Find a super-directory of DIR containing a root file."
  (let ((repo (locate-dominating-file dir ".git")))
    (and repo (list 'git dir))))

(cl-defmethod project-root ((project (head git)))
  "Return the root of a explicit PROJECT."
  (cadr project ))

(with-eval-after-load 'project
  (add-hook 'project-find-functions #'project-try-git))
--8<---------------cut here---------------end--------------->8---

might be enough, but still be optimised a bit more).

Another idea might be to just disable VC for Tramp, or rather just some
Tramp connections? 

> Thanks in advance,
> L-G





reply via email to

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