unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Philip Kaludercic <philipk@posteo.net>,
	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 17:21:13 +0300	[thread overview]
Message-ID: <f55660f5-39c0-eace-fe37-8432aa251a68@yandex.ru> (raw)
In-Reply-To: <87edx3o3b5.fsf@posteo.net>

On 26.08.2022 10:46, Philip Kaludercic wrote:
> 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', ...?

I'm honestly surprised that things work with vc-handled-backends disabled.

Louis-Guillaume, does (project-current) ever evaluate to non-nil on your 
system? I'm guessing you end up picking the project directory manually 
every time.

> 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.

Probably not: after all, the user can have some next backend configured. 
And we allow setting vc-handled-backends to nil.

> 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).

This should work, yes.

We could also add a variable which would substitute vc-handled-backends 
for the purposes of project.el (we'd temporarily use its value). Not 
sure it's worth the added complexity, though.

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

(setq-local vc-handled-backends) inside find-file-hook behind a 
file-remote-p check could do the trick.





  parent reply	other threads:[~2022-08-26 14:21 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
2022-08-26 14:09   ` Michael Albinus
2022-08-26 14:21   ` Dmitry Gutov [this message]
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=f55660f5-39c0-eace-fe37-8432aa251a68@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=57418@debbugs.gnu.org \
    --cc=gagnonlg@protonmail.com \
    --cc=philipk@posteo.net \
    /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).