diff options
| author | Michael Albinus | 2017-07-10 17:49:01 +0200 |
|---|---|---|
| committer | Michael Albinus | 2017-07-10 17:49:01 +0200 |
| commit | 689c5c20d1174e95be50e674d05632545eb4b9c5 (patch) | |
| tree | 46e38c0b1b15604eb85cf72ea6562663b5bb5e74 /lisp | |
| parent | 0440c748aaec9b8b32c8cb268f6e24e874fedc75 (diff) | |
| download | emacs-689c5c20d1174e95be50e674d05632545eb4b9c5.tar.gz emacs-689c5c20d1174e95be50e674d05632545eb4b9c5.zip | |
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.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/net/tramp-sh.el | 7 | ||||
| -rw-r--r-- | 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 94518d0d359..4beb6fe5216 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." | |||
| 3432 | `((,(tramp-file-name-regexp) . tramp-vc-file-name-handler)))) | 3432 | `((,(tramp-file-name-regexp) . tramp-vc-file-name-handler)))) |
| 3433 | 3433 | ||
| 3434 | ;; Here we collect only file names, which need an operation. | 3434 | ;; Here we collect only file names, which need an operation. |
| 3435 | (ignore-errors (tramp-run-real-handler 'vc-registered (list file))) | 3435 | (tramp-with-demoted-errors |
| 3436 | v "Error in 1st pass of `vc-registered': %s" | ||
| 3437 | (tramp-run-real-handler 'vc-registered (list file))) | ||
| 3436 | (tramp-message v 10 "\n%s" tramp-vc-registered-file-names) | 3438 | (tramp-message v 10 "\n%s" tramp-vc-registered-file-names) |
| 3437 | 3439 | ||
| 3438 | ;; Send just one command, in order to fill the cache. | 3440 | ;; Send just one command, in order to fill the cache. |
| @@ -3493,7 +3495,8 @@ the result will be a local, non-Tramp, file name." | |||
| 3493 | v vc-hg-program (tramp-get-remote-path v))))) | 3495 | v vc-hg-program (tramp-get-remote-path v))))) |
| 3494 | (setq vc-handled-backends (remq 'Hg vc-handled-backends))) | 3496 | (setq vc-handled-backends (remq 'Hg vc-handled-backends))) |
| 3495 | ;; Run. | 3497 | ;; Run. |
| 3496 | (ignore-errors | 3498 | (tramp-with-demoted-errors |
| 3499 | v "Error in 2nd pass of `vc-registered': %s" | ||
| 3497 | (tramp-run-real-handler 'vc-registered (list file)))))))) | 3500 | (tramp-run-real-handler 'vc-registered (list file)))))))) |
| 3498 | 3501 | ||
| 3499 | ;;;###tramp-autoload | 3502 | ;;;###tramp-autoload |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 945f81188c8..8d7fbc068b8 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'." | |||
| 1641 | (when (tramp-file-name-equal-p vec (car tramp-current-connection)) | 1641 | (when (tramp-file-name-equal-p vec (car tramp-current-connection)) |
| 1642 | (setcdr tramp-current-connection (current-time))))))) | 1642 | (setcdr tramp-current-connection (current-time))))))) |
| 1643 | 1643 | ||
| 1644 | (defmacro tramp-with-demoted-errors (vec-or-proc format &rest body) | ||
| 1645 | "Execute BODY while redirecting the error message to `tramp-message'. | ||
| 1646 | BODY is executed like wrapped by `with-demoted-errors'. FORMAT | ||
| 1647 | is a format-string containing a %-sequence meaning to substitute | ||
| 1648 | the resulting error message." | ||
| 1649 | (declare (debug (symbolp body)) | ||
| 1650 | (indent 2)) | ||
| 1651 | (let ((err (make-symbol "err"))) | ||
| 1652 | `(condition-case-unless-debug ,err | ||
| 1653 | (progn ,@body) | ||
| 1654 | (error (tramp-message ,vec-or-proc 3 ,format ,err) nil)))) | ||
| 1655 | |||
| 1644 | (defmacro with-parsed-tramp-file-name (filename var &rest body) | 1656 | (defmacro with-parsed-tramp-file-name (filename var &rest body) |
| 1645 | "Parse a Tramp filename and make components available in the body. | 1657 | "Parse a Tramp filename and make components available in the body. |
| 1646 | 1658 | ||