emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-24 r117671: * net/tramp-adb.el (tramp-adb-handle-fil


From: Michael Albinus
Subject: [Emacs-diffs] emacs-24 r117671: * net/tramp-adb.el (tramp-adb-handle-file-attributes):
Date: Wed, 05 Nov 2014 11:24:12 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117671
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/18891
committer: Michael Albinus <address@hidden>
branch nick: emacs-24
timestamp: Wed 2014-11-05 12:24:04 +0100
message:
  * net/tramp-adb.el (tramp-adb-handle-file-attributes):
  * net/tramp-gvfs.el (tramp-gvfs-handle-file-attributes):
  * net/tramp-sh.el (tramp-sh-handle-file-attributes): Return nil in
  case of errors.
  
  * net/tramp.el (tramp-error-with-buffer): Show connection buffer
  only when message appeared in minibuffer.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/net/tramp-adb.el          trampadb.el-20121204164216-03wyr5miam215d7f-1
  lisp/net/tramp-gvfs.el         
trampgvfs.el-20091113204419-o5vbwnq5f7feedwu-10898
  lisp/net/tramp-sh.el           trampsh.el-20100913133439-a1faifh29eqoi4nh-1
  lisp/net/tramp.el              tramp.el-20091113204419-o5vbwnq5f7feedwu-2427
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-11-04 16:30:48 +0000
+++ b/lisp/ChangeLog    2014-11-05 11:24:04 +0000
@@ -1,3 +1,13 @@
+2014-11-05  Michael Albinus  <address@hidden>
+
+       * net/tramp.el (tramp-error-with-buffer): Show connection buffer
+       only when message appeared in minibuffer.  (Bug#18891)
+
+       * net/tramp-adb.el (tramp-adb-handle-file-attributes):
+       * net/tramp-gvfs.el (tramp-gvfs-handle-file-attributes):
+       * net/tramp-sh.el (tramp-sh-handle-file-attributes): Return nil in
+       case of errors.
+
 2014-11-04  Eli Zaretskii  <address@hidden>
 
        * jit-lock.el (jit-lock-stealth-fontify): Be tolerant to nil being

=== modified file 'lisp/net/tramp-adb.el'
--- a/lisp/net/tramp-adb.el     2014-11-02 11:22:56 +0000
+++ b/lisp/net/tramp-adb.el     2014-11-05 11:24:04 +0000
@@ -316,17 +316,18 @@
 (defun tramp-adb-handle-file-attributes (filename &optional id-format)
   "Like `file-attributes' for Tramp files."
   (unless id-format (setq id-format 'integer))
-  (with-parsed-tramp-file-name filename nil
-    (with-tramp-file-property
-       v localname (format "file-attributes-%s" id-format)
-      (and
-       (tramp-adb-send-command-and-check
-       v (format "%s -d -l %s"
-                 (tramp-adb-get-ls-command v)
-                 (tramp-shell-quote-argument localname)))
-       (with-current-buffer (tramp-get-buffer v)
-        (tramp-adb-sh-fix-ls-output)
-        (cdar (tramp-do-parse-file-attributes-with-ls v id-format)))))))
+  (ignore-errors
+    (with-parsed-tramp-file-name filename nil
+      (with-tramp-file-property
+         v localname (format "file-attributes-%s" id-format)
+       (and
+        (tramp-adb-send-command-and-check
+         v (format "%s -d -l %s"
+                   (tramp-adb-get-ls-command v)
+                   (tramp-shell-quote-argument localname)))
+        (with-current-buffer (tramp-get-buffer v)
+          (tramp-adb-sh-fix-ls-output)
+          (cdar (tramp-do-parse-file-attributes-with-ls v id-format))))))))
 
 (defun tramp-do-parse-file-attributes-with-ls (vec &optional id-format)
   "Parse `file-attributes' for Tramp files using the ls(1) command."

=== modified file 'lisp/net/tramp-gvfs.el'
--- a/lisp/net/tramp-gvfs.el    2014-11-01 13:34:45 +0000
+++ b/lisp/net/tramp-gvfs.el    2014-11-05 11:24:04 +0000
@@ -720,124 +720,128 @@
 (defun tramp-gvfs-handle-file-attributes (filename &optional id-format)
   "Like `file-attributes' for Tramp files."
   (unless id-format (setq id-format 'integer))
-  ;; Don't modify `last-coding-system-used' by accident.
-  (let ((last-coding-system-used last-coding-system-used)
-       dirp res-symlink-target res-numlinks res-uid res-gid res-access
-       res-mod res-change res-size res-filemodes res-inode res-device)
-    (with-parsed-tramp-file-name filename nil
-      (with-tramp-file-property
-         v localname (format "file-attributes-%s" id-format)
-       (tramp-message v 5 "file attributes: %s" localname)
-       (tramp-gvfs-send-command
-        v "gvfs-info" (tramp-gvfs-url-file-name filename))
-       ;; Parse output ...
-       (with-current-buffer (tramp-get-connection-buffer v)
-         (goto-char (point-min))
-         (when (re-search-forward "attributes:" nil t)
-           ;; ... directory or symlink
-           (goto-char (point-min))
-           (setq dirp (if (re-search-forward "type:\\s-+directory" nil t) t))
-           (goto-char (point-min))
-           (setq res-symlink-target
-                 (if (re-search-forward
-                      "standard::symlink-target:\\s-+\\(\\S-+\\)" nil t)
-                     (match-string 1)))
-           ;; ... number links
-           (goto-char (point-min))
-           (setq res-numlinks
-                 (if (re-search-forward "unix::nlink:\\s-+\\([0-9]+\\)" nil t)
-                     (string-to-number (match-string 1)) 0))
-           ;; ... uid and gid
-           (goto-char (point-min))
-           (setq res-uid
-                 (or (if (eq id-format 'integer)
-                         (if (re-search-forward
-                              "unix::uid:\\s-+\\([0-9]+\\)" nil t)
-                             (string-to-number (match-string 1)))
-                       (if (re-search-forward
-                            "owner::user:\\s-+\\(\\S-+\\)" nil t)
-                           (match-string 1)))
-                     (tramp-get-local-uid id-format)))
-           (setq res-gid
-                 (or (if (eq id-format 'integer)
-                         (if (re-search-forward
-                              "unix::gid:\\s-+\\([0-9]+\\)" nil t)
-                             (string-to-number (match-string 1)))
-                       (if (re-search-forward
-                            "owner::group:\\s-+\\(\\S-+\\)" nil t)
-                           (match-string 1)))
-                     (tramp-get-local-gid id-format)))
-           ;; ... last access, modification and change time
-           (goto-char (point-min))
-           (setq res-access
-                 (if (re-search-forward
-                      "time::access:\\s-+\\([0-9]+\\)" nil t)
-                     (seconds-to-time (string-to-number (match-string 1)))
-                   '(0 0)))
-           (goto-char (point-min))
-           (setq res-mod
-                 (if (re-search-forward
-                      "time::modified:\\s-+\\([0-9]+\\)" nil t)
-                     (seconds-to-time (string-to-number (match-string 1)))
-                   '(0 0)))
-           (goto-char (point-min))
-           (setq res-change
-                 (if (re-search-forward
-                      "time::changed:\\s-+\\([0-9]+\\)" nil t)
-                     (seconds-to-time (string-to-number (match-string 1)))
-                   '(0 0)))
-           ;; ... size
-           (goto-char (point-min))
-           (setq res-size
-                 (if (re-search-forward
-                      "standard::size:\\s-+\\([0-9]+\\)" nil t)
-                     (string-to-number (match-string 1)) 0))
-           ;; ... file mode flags
-           (goto-char (point-min))
-           (setq res-filemodes
-                 (if (re-search-forward "unix::mode:\\s-+\\([0-9]+\\)" nil t)
-                     (tramp-file-mode-from-int
-                      (string-to-number (match-string 1)))
-                   (if dirp "drwx------" "-rwx------")))
-           ;; ... inode and device
-           (goto-char (point-min))
-           (setq res-inode
-                 (if (re-search-forward "unix::inode:\\s-+\\([0-9]+\\)" nil t)
-                     (string-to-number (match-string 1))
-                   (tramp-get-inode v)))
-           (goto-char (point-min))
-           (setq res-device
-                 (if (re-search-forward "unix::device:\\s-+\\([0-9]+\\)" nil t)
-                     (string-to-number (match-string 1))
-                   (tramp-get-device v)))
+  (ignore-errors
+    ;; Don't modify `last-coding-system-used' by accident.
+    (let ((last-coding-system-used last-coding-system-used)
+         dirp res-symlink-target res-numlinks res-uid res-gid res-access
+         res-mod res-change res-size res-filemodes res-inode res-device)
+      (with-parsed-tramp-file-name filename nil
+       (with-tramp-file-property
+           v localname (format "file-attributes-%s" id-format)
+         (tramp-message v 5 "file attributes: %s" localname)
+         (tramp-gvfs-send-command
+          v "gvfs-info" (tramp-gvfs-url-file-name filename))
+         ;; Parse output ...
+         (with-current-buffer (tramp-get-connection-buffer v)
+           (goto-char (point-min))
+           (when (re-search-forward "attributes:" nil t)
+             ;; ... directory or symlink
+             (goto-char (point-min))
+             (setq dirp (if (re-search-forward "type:\\s-+directory" nil t) t))
+             (goto-char (point-min))
+             (setq res-symlink-target
+                   (if (re-search-forward
+                        "standard::symlink-target:\\s-+\\(\\S-+\\)" nil t)
+                       (match-string 1)))
+             ;; ... number links
+             (goto-char (point-min))
+             (setq res-numlinks
+                   (if (re-search-forward
+                        "unix::nlink:\\s-+\\([0-9]+\\)" nil t)
+                       (string-to-number (match-string 1)) 0))
+             ;; ... uid and gid
+             (goto-char (point-min))
+             (setq res-uid
+                   (or (if (eq id-format 'integer)
+                           (if (re-search-forward
+                                "unix::uid:\\s-+\\([0-9]+\\)" nil t)
+                               (string-to-number (match-string 1)))
+                         (if (re-search-forward
+                              "owner::user:\\s-+\\(\\S-+\\)" nil t)
+                             (match-string 1)))
+                       (tramp-get-local-uid id-format)))
+             (setq res-gid
+                   (or (if (eq id-format 'integer)
+                           (if (re-search-forward
+                                "unix::gid:\\s-+\\([0-9]+\\)" nil t)
+                               (string-to-number (match-string 1)))
+                         (if (re-search-forward
+                              "owner::group:\\s-+\\(\\S-+\\)" nil t)
+                             (match-string 1)))
+                       (tramp-get-local-gid id-format)))
+             ;; ... last access, modification and change time
+             (goto-char (point-min))
+             (setq res-access
+                   (if (re-search-forward
+                        "time::access:\\s-+\\([0-9]+\\)" nil t)
+                       (seconds-to-time (string-to-number (match-string 1)))
+                     '(0 0)))
+             (goto-char (point-min))
+             (setq res-mod
+                   (if (re-search-forward
+                        "time::modified:\\s-+\\([0-9]+\\)" nil t)
+                       (seconds-to-time (string-to-number (match-string 1)))
+                     '(0 0)))
+             (goto-char (point-min))
+             (setq res-change
+                   (if (re-search-forward
+                        "time::changed:\\s-+\\([0-9]+\\)" nil t)
+                       (seconds-to-time (string-to-number (match-string 1)))
+                     '(0 0)))
+             ;; ... size
+             (goto-char (point-min))
+             (setq res-size
+                   (if (re-search-forward
+                        "standard::size:\\s-+\\([0-9]+\\)" nil t)
+                       (string-to-number (match-string 1)) 0))
+             ;; ... file mode flags
+             (goto-char (point-min))
+             (setq res-filemodes
+                   (if (re-search-forward "unix::mode:\\s-+\\([0-9]+\\)" nil t)
+                       (tramp-file-mode-from-int
+                        (string-to-number (match-string 1)))
+                     (if dirp "drwx------" "-rwx------")))
+             ;; ... inode and device
+             (goto-char (point-min))
+             (setq res-inode
+                   (if (re-search-forward
+                        "unix::inode:\\s-+\\([0-9]+\\)" nil t)
+                       (string-to-number (match-string 1))
+                     (tramp-get-inode v)))
+             (goto-char (point-min))
+             (setq res-device
+                   (if (re-search-forward
+                        "unix::device:\\s-+\\([0-9]+\\)" nil t)
+                       (string-to-number (match-string 1))
+                     (tramp-get-device v)))
 
-           ;; Return data gathered.
-           (list
-            ;; 0. t for directory, string (name linked to) for
-            ;; symbolic link, or nil.
-            (or dirp res-symlink-target)
-            ;; 1. Number of links to file.
-            res-numlinks
-            ;; 2. File uid.
-            res-uid
-            ;; 3. File gid.
-            res-gid
-            ;; 4. Last access time, as a list of integers.
-            ;; 5. Last modification time, likewise.
-            ;; 6. Last status change time, likewise.
-            res-access res-mod res-change
-            ;; 7. Size in bytes (-1, if number is out of range).
-            res-size
-            ;; 8. File modes.
-            res-filemodes
-            ;; 9. t if file's gid would change if file were deleted
-            ;; and recreated.
-            nil
-            ;; 10. Inode number.
-            res-inode
-            ;; 11. Device number.
-            res-device
-            )))))))
+             ;; Return data gathered.
+             (list
+              ;; 0. t for directory, string (name linked to) for
+              ;; symbolic link, or nil.
+              (or dirp res-symlink-target)
+              ;; 1. Number of links to file.
+              res-numlinks
+              ;; 2. File uid.
+              res-uid
+              ;; 3. File gid.
+              res-gid
+              ;; 4. Last access time, as a list of integers.
+              ;; 5. Last modification time, likewise.
+              ;; 6. Last status change time, likewise.
+              res-access res-mod res-change
+              ;; 7. Size in bytes (-1, if number is out of range).
+              res-size
+              ;; 8. File modes.
+              res-filemodes
+              ;; 9. t if file's gid would change if file were deleted
+              ;; and recreated.
+              nil
+              ;; 10. Inode number.
+              res-inode
+              ;; 11. Device number.
+              res-device
+              ))))))))
 
 (defun tramp-gvfs-handle-file-directory-p (filename)
   "Like `file-directory-p' for Tramp files."

=== modified file 'lisp/net/tramp-sh.el'
--- a/lisp/net/tramp-sh.el      2014-11-04 09:02:56 +0000
+++ b/lisp/net/tramp-sh.el      2014-11-05 11:24:04 +0000
@@ -1103,23 +1103,24 @@
 (defun tramp-sh-handle-file-attributes (filename &optional id-format)
   "Like `file-attributes' for Tramp files."
   (unless id-format (setq id-format 'integer))
-  ;; Don't modify `last-coding-system-used' by accident.
-  (let ((last-coding-system-used last-coding-system-used))
-    (with-parsed-tramp-file-name (expand-file-name filename) nil
-      (with-tramp-file-property
-         v localname (format "file-attributes-%s" id-format)
-       (save-excursion
-         (tramp-convert-file-attributes
-          v
-          (or
-           (cond
-            ((tramp-get-remote-stat v)
-             (tramp-do-file-attributes-with-stat v localname id-format))
-            ((tramp-get-remote-perl v)
-             (tramp-do-file-attributes-with-perl v localname id-format))
-            (t nil))
-           ;; The scripts could fail, for example with huge file size.
-           (tramp-do-file-attributes-with-ls v localname id-format))))))))
+  (ignore-errors
+    ;; Don't modify `last-coding-system-used' by accident.
+    (let ((last-coding-system-used last-coding-system-used))
+      (with-parsed-tramp-file-name (expand-file-name filename) nil
+       (with-tramp-file-property
+           v localname (format "file-attributes-%s" id-format)
+         (save-excursion
+           (tramp-convert-file-attributes
+            v
+            (or
+             (cond
+              ((tramp-get-remote-stat v)
+               (tramp-do-file-attributes-with-stat v localname id-format))
+              ((tramp-get-remote-perl v)
+               (tramp-do-file-attributes-with-perl v localname id-format))
+              (t nil))
+             ;; The scripts could fail, for example with huge file size.
+             (tramp-do-file-attributes-with-ls v localname id-format)))))))))
 
 (defun tramp-do-file-attributes-with-ls (vec localname &optional id-format)
   "Implement `file-attributes' for Tramp files using the ls(1) command."

=== modified file 'lisp/net/tramp.el'
--- a/lisp/net/tramp.el 2014-11-01 13:34:45 +0000
+++ b/lisp/net/tramp.el 2014-11-05 11:24:04 +0000
@@ -1604,7 +1604,9 @@
        (when (and buf
                   tramp-message-show-message
                   (not (zerop tramp-verbose))
-                  (not (tramp-completion-mode-p)))
+                  (not (tramp-completion-mode-p))
+                  ;; Show only when Emacs has started already.
+                  (current-message))
          (let ((enable-recursive-minibuffers t))
            ;; `tramp-error' does not show messages.  So we must do it
            ;; ourselves.


reply via email to

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