From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#65763: Error opening a file from a Git working directory if Git is not installed Date: Wed, 06 Sep 2023 18:46:54 +0300 Message-ID: <83jzt31ez5.fsf@gnu.org> References: <831qfc4d7h.fsf@gnu.org> <83y1hk2g29.fsf@gnu.org> <83a5tz33er.fsf@gnu.org> <7fa60b9c-ae00-5fdd-4805-aa55cb4094e3@gutov.dev> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19979"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65763@debbugs.gnu.org, pogonyshev@gmail.com To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 06 17:48:17 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qdulN-0004xe-CW for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Sep 2023 17:48:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qdulG-0006wm-OB; Wed, 06 Sep 2023 11:48:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qdul7-0006vV-M6 for bug-gnu-emacs@gnu.org; Wed, 06 Sep 2023 11:48:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qdul7-0002rl-Cz for bug-gnu-emacs@gnu.org; Wed, 06 Sep 2023 11:48:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qdul8-0005YA-GF for bug-gnu-emacs@gnu.org; Wed, 06 Sep 2023 11:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Sep 2023 15:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65763 X-GNU-PR-Package: emacs Original-Received: via spool by 65763-submit@debbugs.gnu.org id=B65763.169401523821151 (code B ref 65763); Wed, 06 Sep 2023 15:48:02 +0000 Original-Received: (at 65763) by debbugs.gnu.org; 6 Sep 2023 15:47:18 +0000 Original-Received: from localhost ([127.0.0.1]:37179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdukP-0005V5-JA for submit@debbugs.gnu.org; Wed, 06 Sep 2023 11:47:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51800) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdukN-0005Ur-JQ for 65763@debbugs.gnu.org; Wed, 06 Sep 2023 11:47:16 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qdukG-0002nj-Ld; Wed, 06 Sep 2023 11:47:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=kj29AlizXiDtK5gWMa4nf/azIu9IxlQj0wHd9I3XGnU=; b=aXm3hCceAxct eL+JZzDN5JsUufHQLz9qBkPHZ2bPXhpNaoE5b9/rQi+nVWWS3vMEuFg4/keq3Fu7eW/v1kdfA9DV/ CkKb1XUB1dm9gMGLY7CVvgiTpBfTgY64rCMlhSe4kcKwgakBeq2kiRwPj3VsIGfRa/T5NX/xuHhbZ 8Aq/uL45I0Zg+0NO+kAOLBsuN9oQkygNXMP807GBRRGIq4nXnDJfBMai96wcUDKc7ZDNZKWXNVYJq m/0d45IDpbZ0jO5MoZ5wyFwTTb0WurNwhUNHYgqUP5XvrhKIEMzhatV71bA14R7xdSw9NDjgGVSiD UMJDibeLxdxHqF9TXCAfcw==; In-Reply-To: <7fa60b9c-ae00-5fdd-4805-aa55cb4094e3@gutov.dev> (message from Dmitry Gutov on Wed, 6 Sep 2023 17:31:05 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:269555 Archived-At: > Date: Wed, 6 Sep 2023 17:31:05 +0300 > Cc: Eli Zaretskii , 65763@debbugs.gnu.org > From: Dmitry Gutov > > On 06/09/2023 16:11, Paul Pogonyshev wrote: > > 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. > > There was a previous discussion on this on the bug tracker which I can't > find now. If someone is more able than me, it would be a welcome help. > > I think Lars was involved, and the general argument was that if .git is > present, the user is plausibly interested in using our VC features and > might not understand which programs might be needed to be installed for > that to work. Or just forget about that aspect e.g. on a new machine. So > we help them with those warnings. > > > 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. > > I don't mind this solution as well, and it has its logic. > > So if others like this approach we could do such change (roughly, we'd > need to capture errors in all 'registered' functions at least, reraise > as vc-backend-program-missing, and then catch them -- and only them -- > silently at the top level). I prefer to emit the messages, just make them more user-friendly ("searching for program" "no such file or directory" is not very friendly, IMO), and suppress the error signaling even when debug-on-error is non-nil. The reason is simple: we are talking only about Git not being installed or accessible here, but the problems could be different and more obscure: Git could be present but inoperable for some weird misconfiguration reason, or some other problem could happen. So "if it is not installed, just silently don't do anything" is not a complete solution, and the "silently" part loses information which users may wish to have presented to them.