emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 689c5c2: Use `with-demoted-errors' in Tramp


From: Michael Albinus
Subject: [Emacs-diffs] master 689c5c2: Use `with-demoted-errors' in Tramp
Date: Mon, 10 Jul 2017 11:49:07 -0400 (EDT)

branch: master
commit 689c5c20d1174e95be50e674d05632545eb4b9c5
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Use `with-demoted-errors' in Tramp
    
    * lisp/net/tramp.el (tramp-with-demoted-errors): New defmacro.
    
    * lisp/net/tramp-sh.el (tramp-sh-handle-vc-registered): Use it.
---
 lisp/net/tramp-sh.el |  7 +++++--
 lisp/net/tramp.el    | 12 ++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 94518d0..4beb6fe 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -3432,7 +3432,9 @@ the result will be a local, non-Tramp, file name."
               `((,(tramp-file-name-regexp) . tramp-vc-file-name-handler))))
 
          ;; Here we collect only file names, which need an operation.
-         (ignore-errors (tramp-run-real-handler 'vc-registered (list file)))
+         (tramp-with-demoted-errors
+             v "Error in 1st pass of `vc-registered': %s"
+           (tramp-run-real-handler 'vc-registered (list file)))
          (tramp-message v 10 "\n%s" tramp-vc-registered-file-names)
 
          ;; Send just one command, in order to fill the cache.
@@ -3493,7 +3495,8 @@ the result will be a local, non-Tramp, file name."
                             v vc-hg-program (tramp-get-remote-path v)))))
            (setq vc-handled-backends (remq 'Hg vc-handled-backends)))
          ;; Run.
-         (ignore-errors
+         (tramp-with-demoted-errors
+             v "Error in 2nd pass of `vc-registered': %s"
            (tramp-run-real-handler 'vc-registered (list file))))))))
 
 ;;;###tramp-autoload
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 945f811..8d7fbc0 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1641,6 +1641,18 @@ an input event arrives.  The other arguments are passed 
to `tramp-error'."
        (when (tramp-file-name-equal-p vec (car tramp-current-connection))
          (setcdr tramp-current-connection (current-time)))))))
 
+(defmacro tramp-with-demoted-errors (vec-or-proc format &rest body)
+  "Execute BODY while redirecting the error message to `tramp-message'.
+BODY is executed like wrapped by `with-demoted-errors'.  FORMAT
+is a format-string containing a %-sequence meaning to substitute
+the resulting error message."
+  (declare (debug (symbolp body))
+           (indent 2))
+  (let ((err (make-symbol "err")))
+    `(condition-case-unless-debug ,err
+         (progn ,@body)
+       (error (tramp-message ,vec-or-proc 3 ,format ,err) nil))))
+
 (defmacro with-parsed-tramp-file-name (filename var &rest body)
   "Parse a Tramp filename and make components available in the body.
 



reply via email to

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