From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Simon Tournier Newsgroups: gmane.emacs.bugs Subject: bug#57407: [PATCH] Handle error of =?UTF-8?Q?=E2=80=99vc-registered=E2=80=99?= Date: Thu, 25 Aug 2022 18:20:07 +0200 Message-ID: <87lercwb0o.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26607"; mail-complaints-to="usenet@ciao.gmane.io" To: 57407@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 25 18:24:41 2022 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 1oRFer-0006ap-ID for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Aug 2022 18:24:41 +0200 Original-Received: from localhost ([::1]:53304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRFeq-0006CU-HW for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Aug 2022 12:24:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRFbK-0003Dw-Qo for bug-gnu-emacs@gnu.org; Thu, 25 Aug 2022 12:21:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33128) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oRFbK-0006FF-IQ for bug-gnu-emacs@gnu.org; Thu, 25 Aug 2022 12:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oRFbK-0002la-Dj for bug-gnu-emacs@gnu.org; Thu, 25 Aug 2022 12:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 25 Aug 2022 16:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57407 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166144444210584 (code B ref -1); Thu, 25 Aug 2022 16:21:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Aug 2022 16:20:42 +0000 Original-Received: from localhost ([127.0.0.1]:51110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oRFay-0002kd-SB for submit@debbugs.gnu.org; Thu, 25 Aug 2022 12:20:41 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:44728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oRFav-0002kU-0U for submit@debbugs.gnu.org; Thu, 25 Aug 2022 12:20:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRFam-0002vc-TH for bug-gnu-emacs@gnu.org; Thu, 25 Aug 2022 12:20:36 -0400 Original-Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:39553) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oRFah-00064v-9G for bug-gnu-emacs@gnu.org; Thu, 25 Aug 2022 12:20:27 -0400 Original-Received: by mail-wr1-x42d.google.com with SMTP id az27so5254376wrb.6 for ; Thu, 25 Aug 2022 09:20:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:subject:to:from:from:to:cc; bh=o+iVlyF7wW8w7iopzv4YWEGKpAC7yv+gzfs98yB0nV0=; b=E4GHSedfCEcaaywE7O2t7BhiSJarccgJnlj1RSaJygpHp1VdCRnhLVwDH0h3GJ78zO Ct/fpCNSkxET92cCkIbnksA2dYMIPgJfudor79lwVZt6q2OBC5AvT7M62E8YukBo5/vF Yx56v/iD8O11DJOdAk87ENqiJ5nGnc+dpZup84hEo3Im+1mjl6EUdSBRGi2WEwIZztDC zctyGxUFUy9HH9heLNRs08iHbuemwS5Me3aUAAi/FhFuTVObVShwlXJgJryTVRcI1n+7 xzWZDU3j96rLNhvUNtOcLPgZ1UyqTrn/CGPb41wN/jXaOu9jjyBjlWy51JAVaOTVT7GV 8bew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc; bh=o+iVlyF7wW8w7iopzv4YWEGKpAC7yv+gzfs98yB0nV0=; b=ixG6HeqUzomgOtaTt9EdXp9nLKdvWj2H0XwjwGCrdQyeMV+R8gHtLUcIFbLDTKvHag OY0+13w9Nf6tVaehV9N8rP2tOExscB7nNPunBnJk8+6pp0jTmOaEoXQKGG4BKfDsTJeK dyPVA1C+3yjiD2qPDyEOM1SXZzb+uXUII4F621wi0QRZDgcNVaIgcKjaDdJaIxzbXyjD iP0OZNRYu3RjvEJg7KCfZ1oHg/A4h8TMEOp4tWuFuMF605QjHhq+tbEahM4ZnL81MFyt s5vevNC1qhFPZdPY13n09qBmiko5Y3JJCwmPoccB+KZQHM0WyiXfLRXaHTN6Iha8tSh5 U8eQ== X-Gm-Message-State: ACgBeo3OXlPlJ85o0P+6puPu6HAJNZg3l6yYIhlpjAsKJi+RnUU3rSVg eOjVto3sZtL5ZzunEpD7CXnktlIeOms= X-Google-Smtp-Source: AA6agR48zyZNss7BEY/5Z+6aPF5+ir4kpUBf9RATUyXVerM8ZHB0L4Jd2a+AaR6zaXxTj83W4yUEGA== X-Received: by 2002:adf:e78c:0:b0:225:2de2:940d with SMTP id n12-20020adfe78c000000b002252de2940dmr2639936wrm.686.1661444418910; Thu, 25 Aug 2022 09:20:18 -0700 (PDT) Original-Received: from pfiuh07 ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id v2-20020a5d6b02000000b0021e30e9e44asm19701949wrw.53.2022.08.25.09.20.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 09:20:17 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=zimon.toutoune@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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" Xref: news.gmane.io gmane.emacs.bugs:240729 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Submission (Bug#18481) [0] merged on 2020-08-13 with commit 991e145450ec8b02865597bc80fd797e39e81f07 [1] aims to: =E2=80=9CNotify the user if we errors when querying for registered git file= s=E2=80=9C However, the replacement of =E2=80=99ignore-errors=E2=80=99 by =E2=80=99wit= h-demoted-errors=E2=80=99 introduces spurious messages. This patch proposes to handle the errors in a way that: 1. the user is still informed (avoid silent error) 2. improve the messages trying to be more accurate 3. do it for all the VC backends 0: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D18481 1: https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=3D991e145450ec8b0= 2865597bc80fd797e39e81f07 First, let compare the previous situation with the patched one. If the user runs =E2=80=99find-file=E2=80=99 in a Git repository without having in= stalled the Git binary, then Emacs complains and the error is misleading. Reproducer: --8<---------------cut here---------------start------------->8--- $ which git which: no git in =E2=80=A6 $ mkdir -p /tmp/Git/.git $ emacs -q --batch --eval=3D"(find-file \"/tmp/Git/foo\")" Error: (file-missing "Searching for program" "No such file or directory" "g= it") Package vc-mtn is deprecated --8<---------------cut here---------------end--------------->8--- Not having a working Git installation is not an error for opening one file belonging to a folder containing a =E2=80=99.git=E2=80=99 subdirectory= . For instance, if an user processes many files reporting many messages, then it seems hard to locate the real error, if any. Moreover, the messages are inconsistent depending on the VC backend; from nothing reported to a backtrace. --8<---------------cut here---------------start------------->8--- $ mkdir -p /tmp/Bzr/.bzr $ emacs -q --batch --eval=3D"(find-file \"/tmp/Bzr/foo\")" Error: (file-missing "Searching for program" "No such file or directory" "b= zr") Error: (file-missing "Searching for program" "No such file or directory" "b= zr") Error: file-missing ("Searching for program" "No such file or directory" "b= zr") [...] Searching for program: No such file or directory, bzr --8<---------------cut here---------------end--------------->8--- Considering the patch, it would become: --8<---------------cut here---------------start------------->8--- $ emacs -q --batch --eval=3D"(find-file \"/tmp/Git/foo\")" Warning: (vc-not-supported "Searching for program" "No such file or directo= ry" "git") $ emacs -q --batch --eval=3D"(find-file \"/tmp/Bzr/foo\")" Falling back on "slow" status detection ((error . "VC: Bzr dirstate is not = flat format 3")) Warning: (vc-not-supported "Searching for program" "No such file or directo= ry" "bzr") --8<---------------cut here---------------end--------------->8--- and all the VC backends report similarly when something fails. Second, I have tested various configurations using Guix (65cabb0) and also the Emacs test suite is passing. However, note that a) I barely use VC so b) I am lacking imagination for testing scenarii where the bubble error could wrongly propagate and thus would provide an unexpected behavior. Especially with remote as Tramp allows. Third, I do not know if it is the correct way for catching the errors. The core of the change is: --8<---------------cut here---------------start------------->8--- lisp/vc/vc-dispatcher.el (vc-do-command): (condition-case err (setq status (apply #'process-file command nil t nil squeezed)) (error (pcase (car err) ('file-missing (if (string=3D (cadr err) "Searching for program") ;; The most probable is the lack of the backend bin= ary. (signal 'vc-not-supported (cdr err)) (signal (car err) (cdr err)))) (_ (signal (car err) (cdr err)))))) lisp/vc/vc-hooks.el (vc-refresh-state): (condition-case err (vc-backend buffer-file-name) (error (pcase (car err) ('vc-not-supported (message "Warning: %S" err)) (_ (message "VC refresh error: %S" err))) nil)) --8<---------------cut here---------------end--------------->8--- and the rest of the change is just bubble error propagation from this =E2=80=99vc-do-command=E2=80=99 to this =E2=80=99vc-refresh-state=E2=80=99. It is probably an abuse of =E2=80=99pcase=E2=80=99. Is =E2=80=99cond=E2=80= =99 better here? Last, I have not found in the documentation how to differentiate what it is raised depending on the error type, hence the =E2=80=99pcase=E2=80=99. I hope all this is helpful and going in the right direction for improving the reported messages. If not, let me know what could be better. Cheers, simon PS: If this patch makes sense for inclusion, then let me know and I will complete the Copyright Assignment process. Simon Tournier (1): Handle error of 'vc-registered' lisp/vc/vc-bzr.el | 82 ++++++++++++++++++++-------------------- lisp/vc/vc-dispatcher.el | 12 +++++- lisp/vc/vc-git.el | 24 +++++++----- lisp/vc/vc-hg.el | 13 +++---- lisp/vc/vc-hooks.el | 11 +++++- lisp/vc/vc-svn.el | 5 +-- 6 files changed, 84 insertions(+), 63 deletions(-) base-commit: 1007800a5994ac49b6bc9cd7528edb2d709d2031 --=20 2.36.0 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Handle-error-of-vc-registered.patch Content-Description: the.patch >From befbe14487c1ba4ee2a98edb8dc6ef1f111d9fbd Mon Sep 17 00:00:00 2001 From: Simon Tournier Date: Thu, 25 Aug 2022 02:47:03 +0200 Subject: [PATCH 1/1] Handle error of 'vc-registered' This follows up commit 991e145450ec8b02865597bc80fd797e39e81f07: 2020-08-13 "Notify the user if we errors when querying for registered git files" closing Bug#18481. * lisp/vc/vc-bzr.el (vc-bzr-state-heuristic): Raise an error for unknown Bazaar dirstate format. (vc-bzr-registered): Catch the error. (vc-bzr-status): Tweak error catch. * lisp/vc/vc-dispatcher.el (vc-do-command): Catch errors of command run synchronously. * lisp/vc/vc-git.el (vc-git-registered): Raise the errors reported by 'vc-git-command'. * lisp/vc/vc-hg.el (vc-hg-registered): Avoid unnecessary calls by directly call specialized 'vc-hg-state', replace generic 'process-file' by specialized 'vc-hg-command', do not ignore errors. * lisp/vc/vc-hooks.el (vc-refresh-state): Notify accordindly to the failure. * lisp/vc/vc-svn.el (vc-svn-registered): Raise the errors. --- lisp/vc/vc-bzr.el | 82 ++++++++++++++++++++-------------------- lisp/vc/vc-dispatcher.el | 12 +++++- lisp/vc/vc-git.el | 24 +++++++----- lisp/vc/vc-hg.el | 13 +++---- lisp/vc/vc-hooks.el | 11 +++++- lisp/vc/vc-svn.el | 5 +-- 6 files changed, 84 insertions(+), 63 deletions(-) diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index f6b17d4ce0..7bfb3d0ed3 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el @@ -226,7 +226,7 @@ vc-bzr-state-heuristic (insert-file-contents dirstate) (goto-char (point-min)) (if (not (looking-at "#bazaar dirstate flat format 3")) - (vc-bzr-state file) ; Some other unknown format? + (signal 'error "VC: Bzr dirstate is not flat format 3") (let* ((relfile (file-relative-name file root)) (reldir (file-name-directory relfile))) (cond @@ -314,7 +314,9 @@ vc-bzr-state-heuristic (defun vc-bzr-registered (file) "Return non-nil if FILE is registered with bzr." - (let ((state (vc-bzr-state-heuristic file))) + (let ((state (condition-case err + (vc-bzr-state-heuristic file) + (error (signal (car err) (cdr err)))))) (not (memq state '(nil unregistered ignored))))) (defconst vc-bzr-state-words @@ -445,45 +447,45 @@ vc-bzr-status ;; (unchanged . WARNING). FIXME unchanged is not the best status to ;; return in case of error. (with-temp-buffer - ;; This is with-demoted-errors without the condition-case-unless-debug - ;; annoyance, which makes it fail during ert testing. - (condition-case err (vc-bzr-command "status" t 0 file) - (error (message "Error: %S" err) nil)) (let ((status 'unchanged)) - ;; the only secure status indication in `bzr status' output - ;; is a couple of lines following the pattern:: - ;; | : - ;; | - ;; if the file is up-to-date, we get no status report from `bzr', - ;; so if the regexp search for the above pattern fails, we consider - ;; the file to be up-to-date. - (goto-char (point-min)) - (when (re-search-forward - ;; bzr prints paths relative to the repository root. - (concat "^\\(" vc-bzr-state-words "\\):[ \t\n]+" - (regexp-quote (vc-bzr-file-name-relative file)) - ;; Bzr appends a '/' to directory names and - ;; '*' to executable files - (if (file-directory-p file) "/?" "\\*?") - "[ \t\n]*$") - nil t) - (let ((statusword (match-string 1))) - ;; Erase the status text that matched. - (delete-region (match-beginning 0) (match-end 0)) - (setq status - (intern (string-replace " " "" statusword))))) - (when status - (goto-char (point-min)) - (skip-chars-forward " \n\t") ;Throw away spaces. - (cons status - ;; "bzr" will output warnings and informational messages to - ;; stderr; due to Emacs's `vc-do-command' (and, it seems, - ;; `start-process' itself) limitations, we cannot catch stderr - ;; and stdout into different buffers. So, if there's anything - ;; left in the buffer after removing the above status - ;; keywords, let us just presume that any other message from - ;; "bzr" is a user warning, and display it. - (unless (eobp) (buffer-substring (point) (point-max)))))))) + (condition-case err + (progn + (vc-bzr-command "status" t 0 file) + ;; the only secure status indication in `bzr status' output + ;; is a couple of lines following the pattern:: + ;; | : + ;; | + ;; if the file is up-to-date, we get no status report from `bzr', + ;; so if the regexp search for the above pattern fails, we consider + ;; the file to be up-to-date. + (goto-char (point-min)) + (when (re-search-forward + ;; bzr prints paths relative to the repository root. + (concat "^\\(" vc-bzr-state-words "\\):[ \t\n]+" + (regexp-quote (vc-bzr-file-name-relative file)) + ;; Bzr appends a '/' to directory names and + ;; '*' to executable files + (if (file-directory-p file) "/?" "\\*?") + "[ \t\n]*$") + nil t) + (let ((statusword (match-string 1))) + ;; Erase the status text that matched. + (delete-region (match-beginning 0) (match-end 0)) + (setq status + (intern (string-replace " " "" statusword))))) + (when status + (goto-char (point-min)) + (skip-chars-forward " \n\t") ;Throw away spaces. + (cons status + ;; "bzr" will output warnings and informational messages to + ;; stderr; due to Emacs's `vc-do-command' (and, it seems, + ;; `start-process' itself) limitations, we cannot catch stderr + ;; and stdout into different buffers. So, if there's anything + ;; left in the buffer after removing the above status + ;; keywords, let us just presume that any other message from + ;; "bzr" is a user warning, and display it. + (unless (eobp) (buffer-substring (point) (point-max)))))) + (error (signal (car err) (cdr err))))))) (defun vc-bzr-state (file) (let ((result (vc-bzr-status file))) diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index e2a490092b..778d1139fc 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el @@ -359,7 +359,17 @@ vc-do-command (let ((inhibit-message vc-inhibit-message)) (message "Running in foreground: %s" full-command))) (let ((buffer-undo-list t)) - (setq status (apply #'process-file command nil t nil squeezed))) + (condition-case err + (setq status (apply #'process-file command nil t nil squeezed)) + (error + (pcase (car err) + ('file-missing + (if (string= (cadr err) "Searching for program") + ;; The most probable is the lack of the backend binary. + (signal 'vc-not-supported (cdr err)) + (signal (car err) (cdr err)))) + (_ + (signal (car err) (cdr err))))))) (when (and (not (eq t okstatus)) (or (not (integerp status)) (and okstatus (< okstatus status)))) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 46a486a46c..dda00a8089 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -259,15 +259,18 @@ vc-git-registered ;; path specs. ;; See also: https://marc.info/?l=git&m=125787684318129&w=2 (name (file-relative-name file dir)) - (str (with-demoted-errors "Error: %S" - (cd dir) - (vc-git--out-ok "ls-files" "-c" "-z" "--" name) - ;; If result is empty, use ls-tree to check for deleted - ;; file. - (when (eq (point-min) (point-max)) - (vc-git--out-ok "ls-tree" "--name-only" "-z" "HEAD" - "--" name)) - (buffer-string)))) + (str (condition-case err + (progn + (cd dir) + (vc-git-command (current-buffer) nil + name "ls-files" "-c" "-z" "--") + ;; If result is empty, use ls-tree to check for deleted + ;; file. + (when (eq (point-min) (point-max)) + (vc-git-command (current-buffer) nil + name "ls-tree" "--name-only" "-z" "HEAD" "--")) + (buffer-string)) + (error (signal (car err) (cdr err)))))) (and str (> (length str) (length name)) (string= (substring str 0 (1+ (length name))) @@ -1775,7 +1778,8 @@ vc-git-command "A wrapper around `vc-do-command' for use in vc-git.el. The difference to vc-do-command is that this function always invokes `vc-git-program'." - (let ((coding-system-for-read + (let ((inhibit-null-byte-detection t) + (coding-system-for-read (or coding-system-for-read vc-git-log-output-coding-system)) (coding-system-for-write (or coding-system-for-write vc-git-commits-coding-system)) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index f4a44df3c2..713f0abd19 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -206,7 +206,7 @@ vc-hg-update-on-retrieve-tag (defun vc-hg-registered (file) "Return non-nil if FILE is registered with hg." (when (vc-hg-root file) ; short cut - (let ((state (vc-state file 'Hg))) ; expensive + (let ((state (vc-hg-state file))) (if (memq state '(ignored unregistered nil)) ;; Clear the cache for proper fallback to another backend. (ignore (vc-file-setprop file 'vc-state nil)) @@ -228,23 +228,22 @@ vc-hg-state-slow (with-current-buffer standard-output (setq status - (condition-case nil - ;; Ignore all errors. + (condition-case err (let ((process-environment ;; Avoid localization of messages so we ;; can parse the output. Disable pager. (append (list "TERM=dumb" "LANGUAGE=C" "HGPLAIN=1") process-environment))) - (process-file - vc-hg-program nil t nil + (vc-hg-command (current-buffer) nil + (file-relative-name file) "--config" "ui.report_untrusted=0" "--config" "alias.status=status" "--config" "defaults.status=" - "status" "-A" (file-relative-name file))) + "status" "-A")) ;; Some problem happened. E.g. We can't find an `hg' ;; executable. - (error nil))))))) + (error (signal (car err) (cdr err))))))))) (when (and (eq 0 status) (> (length out) 0) (null (string-match ".*: No such file or directory$" out))) diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 1f0eeb7e18..bd9acfc958 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -791,8 +791,15 @@ vc-refresh-state (add-hook 'vc-mode-line-hook #'vc-mode-line nil t) (let (backend) (cond - ((setq backend (with-demoted-errors "VC refresh error: %S" - (vc-backend buffer-file-name))) + ((setq backend (condition-case err + (vc-backend buffer-file-name) + (error + (pcase (car err) + ('vc-not-supported + (message "Warning: %S" err)) + (_ + (message "VC refresh error: %S" err))) + nil))) ;; Let the backend setup any buffer-local things he needs. (vc-call-backend backend 'find-file-hook) ;; Compute the state and put it in the mode line. diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el index 08b53a7169..7eb529a5d9 100644 --- a/lisp/vc/vc-svn.el +++ b/lisp/vc/vc-svn.el @@ -148,15 +148,14 @@ vc-svn-registered (cd (file-name-directory file)) (let* (process-file-side-effects (status - (condition-case nil - ;; Ignore all errors. + (condition-case err (vc-svn-command t t file "status" "-v") ;; Some problem happened. E.g. We can't find an `svn' ;; executable. We used to only catch `file-error' but when ;; the process is run on a remote host via Tramp, the error ;; is only reported via the exit status which is turned into ;; an `error' by vc-do-command. - (error nil)))) + (error (signal (car err) (cdr err)))))) (when (eq 0 status) (let ((parsed (vc-svn-parse-status file))) (and parsed (not (memq parsed '(ignored unregistered)))))))))) -- 2.36.0 --=-=-=--