emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp/net tramp.el


From: Michael Albinus
Subject: [Emacs-diffs] emacs/lisp/net tramp.el
Date: Sun, 02 Aug 2009 17:16:39 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       09/08/02 17:16:39

Modified files:
        lisp/net       : tramp.el 

Log message:
        * net/tramp.el (tramp-debug-message): Print also microseconds.
        (tramp-handle-insert-file-contents): Optimize, when BEG
        or END is non-nil.
        (tramp-handle-vc-registered): Use `tramp-cache-inhibit-cache'.
        (tramp-get-debug-buffer): Change `outline-regexp' according to new
        format.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/tramp.el?cvsroot=emacs&r1=1.245&r2=1.246

Patches:
Index: tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.245
retrieving revision 1.246
diff -u -b -r1.245 -r1.246
--- tramp.el    28 Jul 2009 20:34:32 -0000      1.245
+++ tramp.el    2 Aug 2009 17:16:39 -0000       1.246
@@ -1903,7 +1903,9 @@
       (unless (bolp)
        (insert "\n"))
       ;; Timestamp.
-      (insert (format-time-string "%T "))
+      (let ((now (current-time)))
+        (insert (format-time-string "%T." now))
+        (insert (format "%06d " (nth 2 now))))
       ;; Calling function.
       (let ((btn 1) btf fn)
        (while (not fn)
@@ -4204,7 +4206,7 @@
   "Like `insert-file-contents' for Tramp files."
   (barf-if-buffer-read-only)
   (setq filename (expand-file-name filename))
-  (let (coding-system-used result local-copy)
+  (let (coding-system-used result local-copy remote-copy)
     (unwind-protect
        (with-parsed-tramp-file-name filename nil
 
@@ -4224,6 +4226,26 @@
                       'insert-file-contents
                       (list localname visit beg end replace)))
 
+             ;; When we shall insert only a part of the file, we copy
+             ;; this part.
+             (when (or beg end)
+               (setq remote-copy (tramp-make-tramp-temp-file v))
+               (tramp-send-command
+                v
+                (cond
+                 ((and beg end)
+                  (format "tail -c +%d %s | head -c +%d >%s"
+                          (1+ beg) (tramp-shell-quote-argument localname)
+                          (- end beg) remote-copy))
+                 (beg
+                  (format "tail -c +%d %s >%s"
+                          (1+ beg) (tramp-shell-quote-argument localname)
+                          remote-copy))
+                 (end
+                  (format "head -c +%d %s >%s"
+                          (1+ end) (tramp-shell-quote-argument localname)
+                          remote-copy)))))
+
              ;; `insert-file-contents-literally' takes care to avoid
              ;; calling jka-compr.  By let-binding
              ;; `inhibit-file-name-operation', we propagate that care
@@ -4233,7 +4255,11 @@
                           (when (eq inhibit-file-name-operation
                                     'insert-file-contents)
                             'file-local-copy)))
-                     (file-local-copy filename)))
+                     (file-local-copy
+                      (if (stringp remote-copy)
+                          (tramp-make-tramp-file-name
+                           method user host remote-copy)
+                        filename))))
              (tramp-message
               v 4 "Inserting local temp file `%s'..." local-copy)
 
@@ -4244,7 +4270,7 @@
                      filename local-copy)))
                (setq result
                      (insert-file-contents
-                      local-copy nil beg end replace))
+                      local-copy nil nil nil replace))
                ;; Now `last-coding-system-used' has right value.
                ;; Remember it.
                (when (boundp 'last-coding-system-used)
@@ -4264,7 +4290,10 @@
          (set-visited-file-modtime)
          (set-buffer-modified-p nil))
        (when (stringp local-copy)
-         (delete-file local-copy))))
+         (delete-file local-copy))
+       (when (stringp remote-copy)
+         (delete-file
+          (tramp-make-tramp-file-name method user host remote-copy)))))
 
     ;; Result.
     (list (expand-file-name filename)
@@ -4605,8 +4634,8 @@
 (defun tramp-handle-vc-registered (file)
   "Like `vc-registered' for Tramp files."
   ;; There could be new files, created by the vc backend.  We disable
-  ;; the cache therefore, by providing a temporary one.
-  (let ((tramp-cache-data (make-hash-table :test 'equal)))
+  ;; the file cache therefore.
+  (let ((tramp-cache-inhibit-cache t))
     (tramp-run-real-handler 'vc-registered (list file))))
 
 ;;;###autoload
@@ -5601,7 +5630,7 @@
       (let ((default-directory (tramp-compat-temporary-file-directory)))
        (outline-mode))
       (set (make-local-variable 'outline-regexp)
-          "[0-9]+:[0-9]+:[0-9]+ [a-z0-9-]+ (\\([0-9]+\\)) #")
+          "[0-9]+:[0-9]+:[0-9]+\\.[0-9]+ [a-z0-9-]+ (\\([0-9]+\\)) #")
 ;      (set (make-local-variable 'outline-regexp)
 ;         "[a-z.-]+:[0-9]+: [a-z0-9-]+ (\\([0-9]+\\)) #")
       (set (make-local-variable 'outline-level) 'tramp-outline-level))




reply via email to

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