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

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

bug#65763: Error opening a file from a Git working directory if Git is n


From: Paul Pogonyshev
Subject: bug#65763: Error opening a file from a Git working directory if Git is not installed
Date: Wed, 6 Sep 2023 15:11:00 +0200

I doubt ERT can be changed, it probably sets `debug-on-error' for a reason, i.e. without it it simply couldn't work. As far as I can tell, the only good option is to never trigger an error just because a directory looks like it might be Git, but Git is not installed.

Also consider this from a user point of view. Let's say I have nothing to do with programming at all and don't have Git installed. Someone emails me a cool Emacs package as a tarball and accidentally archives `.git' along, because he is a developer. I unpack it, open some file and now my Emacs warns me that Git is not installed. But why? I didn't even ask it to do anything. It itself decided to do something (because it saw a `.git' directory), failed (Git is not installed), and now warns me. From my point of view, if there is a failure for action that wasn't direct result of user order, Emacs should stay silent.

In other words, I think there are two sane options here:

1) Simply check if Git is installed before doing anything Git-related from `find-file-hook' callback. If it is not installed, just silently don't do anything. Reserve errors and warnings until the user actually ask you to do something Git-related, not simply to open a file.

2) Make sure that this error is always demoted to a warning, even if `debug-on-error' is t.

I like option 1 better.

Paul

On Wed, 6 Sept 2023 at 14:52, Dmitry Gutov <dmitry@gutov.dev> wrote:
On 06/09/2023 15:49, Paul Pogonyshev wrote:
> It feels conceptually wrong to require all tests that open files to
> rebind `vc-handled-backends'. This is not what they are testing. It also
> depends on knowing particular Emacs quirks (which I, for example, didn't
> know one day earlier). If those were to change in some way, would all
> tests everywhere need to accomodate?

But does that mean that VC needs to be changed, or ERT?

E.g. ERT has an interactive mode where it drops into a debugger for the
user ('d'), but does it need to enable the debugger for its simple runs
as well?

reply via email to

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