unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Louis-Guillaume Gagnon <gagnonlg@protonmail.com>
Cc: 57418@debbugs.gnu.org
Subject: bug#57418: 28.1; Projects not saved when vc-handled-backends is nil
Date: Fri, 26 Aug 2022 07:46:06 +0000	[thread overview]
Message-ID: <87edx3o3b5.fsf@posteo.net> (raw)
In-Reply-To: <e03739d5-a1e9-64ba-0807-203ac235c18a@protonmail.com> (Louis-Guillaume Gagnon's message of "Thu, 25 Aug 2022 20:35:55 +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	other threads:[~2022-08-26  7:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25 20:35 bug#57418: 28.1; Projects not saved when vc-handled-backends is nil Louis-Guillaume Gagnon via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-26  7:46 ` Philip Kaludercic [this message]
2022-08-26 14:09   ` Michael Albinus
2022-08-26 14:21   ` Dmitry Gutov
2022-08-26 14:34     ` Louis-Guillaume Gagnon via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-26 16:11     ` Louis-Guillaume Gagnon via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-26 22:36       ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87edx3o3b5.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=57418@debbugs.gnu.org \
    --cc=gagnonlg@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).