emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 0a53910: Improve Tramp traces.


From: Michael Albinus
Subject: [Emacs-diffs] master 0a53910: Improve Tramp traces.
Date: Fri, 29 May 2015 17:46:46 +0000

branch: master
commit 0a539105a88820548b2038251eb174026341150e
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Improve Tramp traces.
    
    * lisp/net/tramp.el (tramp-call-process-region): New defun.
    
    * lisp/net/tramp-sh.el (tramp-get-inline-coding): Use it.
---
 lisp/net/tramp-sh.el |    4 ++--
 lisp/net/tramp.el    |   36 ++++++++++++++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 46588f0..fb63d79 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -5579,7 +5579,7 @@ function cell is returned to be applied on a buffer."
                       (default-directory
                         (tramp-compat-temporary-file-directory)))
                   (apply
-                   'call-process-region (point-min) (point-max)
+                   'tramp-call-process-region ,vec (point-min) (point-max)
                    (car (split-string ,compress)) t t nil
                    (cdr (split-string ,compress)))))
            `(lambda (beg end)
@@ -5588,7 +5588,7 @@ function cell is returned to be applied on a buffer."
                     (default-directory
                       (tramp-compat-temporary-file-directory)))
                 (apply
-                 'call-process-region beg end
+                 'tramp-call-process-region ,vec beg end
                  (car (split-string ,compress)) t t nil
                  (cdr (split-string ,compress))))
               (,coding (point-min) (point-max)))))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index f0e3cb6..7bfd225 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4038,8 +4038,8 @@ this file, if that variable is non-nil."
       ;; else
       (ad-deactivate 'make-auto-save-file-name)
       (prog1
-       (tramp-run-real-handler 'make-auto-save-file-name nil)
-       (ad-activate 'make-auto-save-file-name)))))
+         (tramp-run-real-handler 'make-auto-save-file-name nil)
+       (ad-activate 'make-auto-save-file-name)))))
 
 (unless (tramp-exists-file-name-handler 'make-auto-save-file-name)
   (defadvice make-auto-save-file-name
@@ -4131,6 +4131,38 @@ are written with verbosity of 6."
        (tramp-message v 6 "%d\n%s" result (error-message-string err))))
     result))
 
+(defun tramp-call-process-region
+  (vec start end program &optional delete buffer display &rest args)
+  "Calls `call-process-region' on the local host.
+It always returns a return code.  The Lisp error raised when
+PROGRAM is nil is trapped also, returning 1.  Furthermore, traces
+are written with verbosity of 6."
+  (let ((v (or vec
+              (vector tramp-current-method tramp-current-user
+                      tramp-current-host nil nil)))
+       (buffer (if (eq buffer t) (current-buffer) buffer))
+       result)
+    (tramp-message
+     v 6 "`%s %s' %s %s %s %s"
+     program (mapconcat 'identity args " ") start end delete buffer)
+    (condition-case err
+       (progn
+         (setq result
+               (apply
+                'call-process-region
+                start end program delete buffer display args))
+         ;; `result' could also be an error string.
+         (when (stringp result)
+           (signal 'file-error (list result)))
+         (with-current-buffer (if (bufferp buffer) buffer (current-buffer))
+            (if (zerop result)
+                (tramp-message v 6 "%d" result)
+              (tramp-message v 6 "%d\n%s" result (buffer-string)))))
+      (error
+       (setq result 1)
+       (tramp-message v 6 "%d\n%s" result (error-message-string err))))
+    result))
+
 ;;;###tramp-autoload
 (defun tramp-read-passwd (proc &optional prompt)
   "Read a password from user (compat function).



reply via email to

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