aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMichael Albinus2014-11-05 12:24:04 +0100
committerMichael Albinus2014-11-05 12:24:04 +0100
commitbd02f3d40e764945066e90921481bfccfb4407fa (patch)
treed77e18a411cdb914cbd1d5b932274cd7070dfbb5 /lisp
parent076582fde300472131422818d72e814e516c91ed (diff)
downloademacs-bd02f3d40e764945066e90921481bfccfb4407fa.tar.gz
emacs-bd02f3d40e764945066e90921481bfccfb4407fa.zip
* 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. Fixes: debbugs:18891
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/net/tramp-adb.el23
-rw-r--r--lisp/net/tramp-gvfs.el234
-rw-r--r--lisp/net/tramp-sh.el35
-rw-r--r--lisp/net/tramp.el4
5 files changed, 162 insertions, 144 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bad4def88f2..4a3b1dcd96a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12014-11-05 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp-error-with-buffer): Show connection buffer
4 only when message appeared in minibuffer. (Bug#18891)
5
6 * net/tramp-adb.el (tramp-adb-handle-file-attributes):
7 * net/tramp-gvfs.el (tramp-gvfs-handle-file-attributes):
8 * net/tramp-sh.el (tramp-sh-handle-file-attributes): Return nil in
9 case of errors.
10
12014-11-04 Eli Zaretskii <eliz@gnu.org> 112014-11-04 Eli Zaretskii <eliz@gnu.org>
2 12
3 * jit-lock.el (jit-lock-stealth-fontify): Be tolerant to nil being 13 * jit-lock.el (jit-lock-stealth-fontify): Be tolerant to nil being
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 639f07b2f1d..2401b4af479 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -316,17 +316,18 @@ pass to the OPERATION."
316(defun tramp-adb-handle-file-attributes (filename &optional id-format) 316(defun tramp-adb-handle-file-attributes (filename &optional id-format)
317 "Like `file-attributes' for Tramp files." 317 "Like `file-attributes' for Tramp files."
318 (unless id-format (setq id-format 'integer)) 318 (unless id-format (setq id-format 'integer))
319 (with-parsed-tramp-file-name filename nil 319 (ignore-errors
320 (with-tramp-file-property 320 (with-parsed-tramp-file-name filename nil
321 v localname (format "file-attributes-%s" id-format) 321 (with-tramp-file-property
322 (and 322 v localname (format "file-attributes-%s" id-format)
323 (tramp-adb-send-command-and-check 323 (and
324 v (format "%s -d -l %s" 324 (tramp-adb-send-command-and-check
325 (tramp-adb-get-ls-command v) 325 v (format "%s -d -l %s"
326 (tramp-shell-quote-argument localname))) 326 (tramp-adb-get-ls-command v)
327 (with-current-buffer (tramp-get-buffer v) 327 (tramp-shell-quote-argument localname)))
328 (tramp-adb-sh-fix-ls-output) 328 (with-current-buffer (tramp-get-buffer v)
329 (cdar (tramp-do-parse-file-attributes-with-ls v id-format))))))) 329 (tramp-adb-sh-fix-ls-output)
330 (cdar (tramp-do-parse-file-attributes-with-ls v id-format))))))))
330 331
331(defun tramp-do-parse-file-attributes-with-ls (vec &optional id-format) 332(defun tramp-do-parse-file-attributes-with-ls (vec &optional id-format)
332 "Parse `file-attributes' for Tramp files using the ls(1) command." 333 "Parse `file-attributes' for Tramp files using the ls(1) command."
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 1b4c1694a92..30802273d5c 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -720,124 +720,128 @@ is no information where to trace the message.")
720(defun tramp-gvfs-handle-file-attributes (filename &optional id-format) 720(defun tramp-gvfs-handle-file-attributes (filename &optional id-format)
721 "Like `file-attributes' for Tramp files." 721 "Like `file-attributes' for Tramp files."
722 (unless id-format (setq id-format 'integer)) 722 (unless id-format (setq id-format 'integer))
723 ;; Don't modify `last-coding-system-used' by accident. 723 (ignore-errors
724 (let ((last-coding-system-used last-coding-system-used) 724 ;; Don't modify `last-coding-system-used' by accident.
725 dirp res-symlink-target res-numlinks res-uid res-gid res-access 725 (let ((last-coding-system-used last-coding-system-used)
726 res-mod res-change res-size res-filemodes res-inode res-device) 726 dirp res-symlink-target res-numlinks res-uid res-gid res-access
727 (with-parsed-tramp-file-name filename nil 727 res-mod res-change res-size res-filemodes res-inode res-device)
728 (with-tramp-file-property 728 (with-parsed-tramp-file-name filename nil
729 v localname (format "file-attributes-%s" id-format) 729 (with-tramp-file-property
730 (tramp-message v 5 "file attributes: %s" localname) 730 v localname (format "file-attributes-%s" id-format)
731 (tramp-gvfs-send-command 731 (tramp-message v 5 "file attributes: %s" localname)
732 v "gvfs-info" (tramp-gvfs-url-file-name filename)) 732 (tramp-gvfs-send-command
733 ;; Parse output ... 733 v "gvfs-info" (tramp-gvfs-url-file-name filename))
734 (with-current-buffer (tramp-get-connection-buffer v) 734 ;; Parse output ...
735 (goto-char (point-min)) 735 (with-current-buffer (tramp-get-connection-buffer v)
736 (when (re-search-forward "attributes:" nil t)
737 ;; ... directory or symlink
738 (goto-char (point-min))
739 (setq dirp (if (re-search-forward "type:\\s-+directory" nil t) t))
740 (goto-char (point-min))
741 (setq res-symlink-target
742 (if (re-search-forward
743 "standard::symlink-target:\\s-+\\(\\S-+\\)" nil t)
744 (match-string 1)))
745 ;; ... number links
746 (goto-char (point-min))
747 (setq res-numlinks
748 (if (re-search-forward "unix::nlink:\\s-+\\([0-9]+\\)" nil t)
749 (string-to-number (match-string 1)) 0))
750 ;; ... uid and gid
751 (goto-char (point-min)) 736 (goto-char (point-min))
752 (setq res-uid 737 (when (re-search-forward "attributes:" nil t)
753 (or (if (eq id-format 'integer) 738 ;; ... directory or symlink
739 (goto-char (point-min))
740 (setq dirp (if (re-search-forward "type:\\s-+directory" nil t) t))
741 (goto-char (point-min))
742 (setq res-symlink-target
743 (if (re-search-forward
744 "standard::symlink-target:\\s-+\\(\\S-+\\)" nil t)
745 (match-string 1)))
746 ;; ... number links
747 (goto-char (point-min))
748 (setq res-numlinks
749 (if (re-search-forward
750 "unix::nlink:\\s-+\\([0-9]+\\)" nil t)
751 (string-to-number (match-string 1)) 0))
752 ;; ... uid and gid
753 (goto-char (point-min))
754 (setq res-uid
755 (or (if (eq id-format 'integer)
756 (if (re-search-forward
757 "unix::uid:\\s-+\\([0-9]+\\)" nil t)
758 (string-to-number (match-string 1)))
754 (if (re-search-forward 759 (if (re-search-forward
755 "unix::uid:\\s-+\\([0-9]+\\)" nil t) 760 "owner::user:\\s-+\\(\\S-+\\)" nil t)
756 (string-to-number (match-string 1))) 761 (match-string 1)))
757 (if (re-search-forward 762 (tramp-get-local-uid id-format)))
758 "owner::user:\\s-+\\(\\S-+\\)" nil t) 763 (setq res-gid
759 (match-string 1))) 764 (or (if (eq id-format 'integer)
760 (tramp-get-local-uid id-format))) 765 (if (re-search-forward
761 (setq res-gid 766 "unix::gid:\\s-+\\([0-9]+\\)" nil t)
762 (or (if (eq id-format 'integer) 767 (string-to-number (match-string 1)))
763 (if (re-search-forward 768 (if (re-search-forward
764 "unix::gid:\\s-+\\([0-9]+\\)" nil t) 769 "owner::group:\\s-+\\(\\S-+\\)" nil t)
765 (string-to-number (match-string 1))) 770 (match-string 1)))
766 (if (re-search-forward 771 (tramp-get-local-gid id-format)))
767 "owner::group:\\s-+\\(\\S-+\\)" nil t) 772 ;; ... last access, modification and change time
768 (match-string 1))) 773 (goto-char (point-min))
769 (tramp-get-local-gid id-format))) 774 (setq res-access
770 ;; ... last access, modification and change time 775 (if (re-search-forward
771 (goto-char (point-min)) 776 "time::access:\\s-+\\([0-9]+\\)" nil t)
772 (setq res-access 777 (seconds-to-time (string-to-number (match-string 1)))
773 (if (re-search-forward 778 '(0 0)))
774 "time::access:\\s-+\\([0-9]+\\)" nil t) 779 (goto-char (point-min))
775 (seconds-to-time (string-to-number (match-string 1))) 780 (setq res-mod
776 '(0 0))) 781 (if (re-search-forward
777 (goto-char (point-min)) 782 "time::modified:\\s-+\\([0-9]+\\)" nil t)
778 (setq res-mod 783 (seconds-to-time (string-to-number (match-string 1)))
779 (if (re-search-forward 784 '(0 0)))
780 "time::modified:\\s-+\\([0-9]+\\)" nil t) 785 (goto-char (point-min))
781 (seconds-to-time (string-to-number (match-string 1))) 786 (setq res-change
782 '(0 0))) 787 (if (re-search-forward
783 (goto-char (point-min)) 788 "time::changed:\\s-+\\([0-9]+\\)" nil t)
784 (setq res-change 789 (seconds-to-time (string-to-number (match-string 1)))
785 (if (re-search-forward 790 '(0 0)))
786 "time::changed:\\s-+\\([0-9]+\\)" nil t) 791 ;; ... size
787 (seconds-to-time (string-to-number (match-string 1))) 792 (goto-char (point-min))
788 '(0 0))) 793 (setq res-size
789 ;; ... size 794 (if (re-search-forward
790 (goto-char (point-min)) 795 "standard::size:\\s-+\\([0-9]+\\)" nil t)
791 (setq res-size 796 (string-to-number (match-string 1)) 0))
792 (if (re-search-forward 797 ;; ... file mode flags
793 "standard::size:\\s-+\\([0-9]+\\)" nil t) 798 (goto-char (point-min))
794 (string-to-number (match-string 1)) 0)) 799 (setq res-filemodes
795 ;; ... file mode flags 800 (if (re-search-forward "unix::mode:\\s-+\\([0-9]+\\)" nil t)
796 (goto-char (point-min)) 801 (tramp-file-mode-from-int
797 (setq res-filemodes 802 (string-to-number (match-string 1)))
798 (if (re-search-forward "unix::mode:\\s-+\\([0-9]+\\)" nil t) 803 (if dirp "drwx------" "-rwx------")))
799 (tramp-file-mode-from-int 804 ;; ... inode and device
800 (string-to-number (match-string 1))) 805 (goto-char (point-min))
801 (if dirp "drwx------" "-rwx------"))) 806 (setq res-inode
802 ;; ... inode and device 807 (if (re-search-forward
803 (goto-char (point-min)) 808 "unix::inode:\\s-+\\([0-9]+\\)" nil t)
804 (setq res-inode 809 (string-to-number (match-string 1))
805 (if (re-search-forward "unix::inode:\\s-+\\([0-9]+\\)" nil t) 810 (tramp-get-inode v)))
806 (string-to-number (match-string 1)) 811 (goto-char (point-min))
807 (tramp-get-inode v))) 812 (setq res-device
808 (goto-char (point-min)) 813 (if (re-search-forward
809 (setq res-device 814 "unix::device:\\s-+\\([0-9]+\\)" nil t)
810 (if (re-search-forward "unix::device:\\s-+\\([0-9]+\\)" nil t) 815 (string-to-number (match-string 1))
811 (string-to-number (match-string 1)) 816 (tramp-get-device v)))
812 (tramp-get-device v))) 817
813 818 ;; Return data gathered.
814 ;; Return data gathered. 819 (list
815 (list 820 ;; 0. t for directory, string (name linked to) for
816 ;; 0. t for directory, string (name linked to) for 821 ;; symbolic link, or nil.
817 ;; symbolic link, or nil. 822 (or dirp res-symlink-target)
818 (or dirp res-symlink-target) 823 ;; 1. Number of links to file.
819 ;; 1. Number of links to file. 824 res-numlinks
820 res-numlinks 825 ;; 2. File uid.
821 ;; 2. File uid. 826 res-uid
822 res-uid 827 ;; 3. File gid.
823 ;; 3. File gid. 828 res-gid
824 res-gid 829 ;; 4. Last access time, as a list of integers.
825 ;; 4. Last access time, as a list of integers. 830 ;; 5. Last modification time, likewise.
826 ;; 5. Last modification time, likewise. 831 ;; 6. Last status change time, likewise.
827 ;; 6. Last status change time, likewise. 832 res-access res-mod res-change
828 res-access res-mod res-change 833 ;; 7. Size in bytes (-1, if number is out of range).
829 ;; 7. Size in bytes (-1, if number is out of range). 834 res-size
830 res-size 835 ;; 8. File modes.
831 ;; 8. File modes. 836 res-filemodes
832 res-filemodes 837 ;; 9. t if file's gid would change if file were deleted
833 ;; 9. t if file's gid would change if file were deleted 838 ;; and recreated.
834 ;; and recreated. 839 nil
835 nil 840 ;; 10. Inode number.
836 ;; 10. Inode number. 841 res-inode
837 res-inode 842 ;; 11. Device number.
838 ;; 11. Device number. 843 res-device
839 res-device 844 ))))))))
840 )))))))
841 845
842(defun tramp-gvfs-handle-file-directory-p (filename) 846(defun tramp-gvfs-handle-file-directory-p (filename)
843 "Like `file-directory-p' for Tramp files." 847 "Like `file-directory-p' for Tramp files."
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 3103eb0daa2..6e46df254b2 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1103,23 +1103,24 @@ target of the symlink differ."
1103(defun tramp-sh-handle-file-attributes (filename &optional id-format) 1103(defun tramp-sh-handle-file-attributes (filename &optional id-format)
1104 "Like `file-attributes' for Tramp files." 1104 "Like `file-attributes' for Tramp files."
1105 (unless id-format (setq id-format 'integer)) 1105 (unless id-format (setq id-format 'integer))
1106 ;; Don't modify `last-coding-system-used' by accident. 1106 (ignore-errors
1107 (let ((last-coding-system-used last-coding-system-used)) 1107 ;; Don't modify `last-coding-system-used' by accident.
1108 (with-parsed-tramp-file-name (expand-file-name filename) nil 1108 (let ((last-coding-system-used last-coding-system-used))
1109 (with-tramp-file-property 1109 (with-parsed-tramp-file-name (expand-file-name filename) nil
1110 v localname (format "file-attributes-%s" id-format) 1110 (with-tramp-file-property
1111 (save-excursion 1111 v localname (format "file-attributes-%s" id-format)
1112 (tramp-convert-file-attributes 1112 (save-excursion
1113 v 1113 (tramp-convert-file-attributes
1114 (or 1114 v
1115 (cond 1115 (or
1116 ((tramp-get-remote-stat v) 1116 (cond
1117 (tramp-do-file-attributes-with-stat v localname id-format)) 1117 ((tramp-get-remote-stat v)
1118 ((tramp-get-remote-perl v) 1118 (tramp-do-file-attributes-with-stat v localname id-format))
1119 (tramp-do-file-attributes-with-perl v localname id-format)) 1119 ((tramp-get-remote-perl v)
1120 (t nil)) 1120 (tramp-do-file-attributes-with-perl v localname id-format))
1121 ;; The scripts could fail, for example with huge file size. 1121 (t nil))
1122 (tramp-do-file-attributes-with-ls v localname id-format)))))))) 1122 ;; The scripts could fail, for example with huge file size.
1123 (tramp-do-file-attributes-with-ls v localname id-format)))))))))
1123 1124
1124(defun tramp-do-file-attributes-with-ls (vec localname &optional id-format) 1125(defun tramp-do-file-attributes-with-ls (vec localname &optional id-format)
1125 "Implement `file-attributes' for Tramp files using the ls(1) command." 1126 "Implement `file-attributes' for Tramp files using the ls(1) command."
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index e3fb177b0c5..969172be70a 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1604,7 +1604,9 @@ an input event arrives. The other arguments are passed to `tramp-error'."
1604 (when (and buf 1604 (when (and buf
1605 tramp-message-show-message 1605 tramp-message-show-message
1606 (not (zerop tramp-verbose)) 1606 (not (zerop tramp-verbose))
1607 (not (tramp-completion-mode-p))) 1607 (not (tramp-completion-mode-p))
1608 ;; Show only when Emacs has started already.
1609 (current-message))
1608 (let ((enable-recursive-minibuffers t)) 1610 (let ((enable-recursive-minibuffers t))
1609 ;; `tramp-error' does not show messages. So we must do it 1611 ;; `tramp-error' does not show messages. So we must do it
1610 ;; ourselves. 1612 ;; ourselves.