emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master fdf31e5: Improve Tramp traces.


From: Michael Albinus
Subject: [Emacs-diffs] master fdf31e5: Improve Tramp traces.
Date: Sat, 30 May 2015 09:54:42 +0000

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

    Improve Tramp traces.
    
    * lisp/net/trampver.el (tramp-repository-get-version): New defun.
    
    * lisp/net/tramp.el (tramp-debug-message): Use it.
---
 lisp/net/tramp.el    |    7 ++++++-
 lisp/net/trampver.el |   12 ++++++++++++
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 7bfd225..40bba14 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1433,7 +1433,12 @@ ARGUMENTS to actually emit the message (if applicable)."
        (format
        ";; %sEmacs: %s Tramp: %s -*- mode: outline; -*-"
        (if (featurep 'sxemacs) "SX" (if (featurep 'xemacs) "X" "GNU "))
-       emacs-version tramp-version)))
+       emacs-version tramp-version))
+      (when (>= tramp-verbose 10)
+       (insert
+        (format
+         "\n;; Location: %s Git: %s"
+         (locate-library "tramp") (tramp-repository-get-version)))))
     (unless (bolp)
       (insert "\n"))
     ;; Timestamp.
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 226ec9f..c5e5705 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -38,6 +38,18 @@
 (defconst tramp-bug-report-address "address@hidden"
   "Email address to send bug reports to.")
 
+(defun tramp-repository-get-version ()
+  "Try to return as a string the repository revision of the Tramp sources."
+  (let ((dir (funcall 'locate-dominating-file (locate-library "tramp") 
".git")))
+    (when dir
+      (with-temp-buffer
+       (let ((default-directory (file-name-as-directory dir)))
+         (and (zerop
+               (ignore-errors
+                 (call-process "git" nil '(t nil) nil "rev-parse" "HEAD")))
+              (not (zerop (buffer-size)))
+              (replace-regexp-in-string "\n" "" (buffer-string))))))))
+
 ;; Check for (X)Emacs version.
 (let ((x (if (or (>= emacs-major-version 22)
                 (and (featurep 'xemacs)



reply via email to

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