diff options
| author | Joakim Verona | 2013-01-22 00:03:23 +0100 |
|---|---|---|
| committer | Joakim Verona | 2013-01-22 00:03:23 +0100 |
| commit | 2adf26f58a2435bcbd7f925f7e1208ceda907520 (patch) | |
| tree | c010555fabe45beeb3028cb03a64c53abae093a5 /lisp/net | |
| parent | 9054ae6b57b275be298a919a3aed506f950409b6 (diff) | |
| parent | bb677ef7449aba3c2d5d7ede8cc4b87814f01ab3 (diff) | |
| download | emacs-2adf26f58a2435bcbd7f925f7e1208ceda907520.tar.gz emacs-2adf26f58a2435bcbd7f925f7e1208ceda907520.zip | |
auto upstream
Diffstat (limited to 'lisp/net')
| -rw-r--r-- | lisp/net/tramp-adb.el | 60 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 3 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 5 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 37 |
4 files changed, 44 insertions, 61 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index ab13d4cf442..17802d39fa4 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | ;;; Code: | 33 | ;;; Code: |
| 34 | 34 | ||
| 35 | (require 'tramp) | 35 | (require 'tramp) |
| 36 | (require 'time-date) | ||
| 36 | 37 | ||
| 37 | (defvar dired-move-to-filename-regexp) | 38 | (defvar dired-move-to-filename-regexp) |
| 38 | 39 | ||
| @@ -465,7 +466,7 @@ Emacs dired can't find files." | |||
| 465 | (setq time-a (apply 'encode-time (parse-time-string (match-string 0 a)))) | 466 | (setq time-a (apply 'encode-time (parse-time-string (match-string 0 a)))) |
| 466 | (string-match tramp-adb-ls-date-regexp b) | 467 | (string-match tramp-adb-ls-date-regexp b) |
| 467 | (setq time-b (apply 'encode-time (parse-time-string (match-string 0 b)))) | 468 | (setq time-b (apply 'encode-time (parse-time-string (match-string 0 b)))) |
| 468 | (time-less-p time-b time-a))) | 469 | (tramp-time-less-p time-b time-a))) |
| 469 | 470 | ||
| 470 | (defun tramp-adb-ls-output-name-less-p (a b) | 471 | (defun tramp-adb-ls-output-name-less-p (a b) |
| 471 | "Sort \"ls\" output by name, ascending." | 472 | "Sort \"ls\" output by name, ascending." |
| @@ -638,7 +639,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 638 | newname (expand-file-name newname)) | 639 | newname (expand-file-name newname)) |
| 639 | 640 | ||
| 640 | (if (file-directory-p filename) | 641 | (if (file-directory-p filename) |
| 641 | (copy-directory filename newname keep-date t) | 642 | (tramp-file-name-handler 'copy-directory filename newname keep-date t) |
| 642 | (with-tramp-progress-reporter | 643 | (with-tramp-progress-reporter |
| 643 | (tramp-dissect-file-name (if (file-remote-p filename) filename newname)) | 644 | (tramp-dissect-file-name (if (file-remote-p filename) filename newname)) |
| 644 | 0 (format "Copying %s to %s" filename newname) | 645 | 0 (format "Copying %s to %s" filename newname) |
| @@ -698,7 +699,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 698 | (tramp-flush-file-property v localname) | 699 | (tramp-flush-file-property v localname) |
| 699 | ;; Short track. | 700 | ;; Short track. |
| 700 | (tramp-adb-barf-unless-okay | 701 | (tramp-adb-barf-unless-okay |
| 701 | v (format "mv %s %s" (file-remote-p filename 'localname) localname) | 702 | v (format |
| 703 | "mv %s %s" | ||
| 704 | (tramp-file-name-handler 'file-remote-p filename 'localname) | ||
| 705 | localname) | ||
| 702 | "Error renaming %s to %s" filename newname)) | 706 | "Error renaming %s to %s" filename newname)) |
| 703 | 707 | ||
| 704 | ;; Rename by copy. | 708 | ;; Rename by copy. |
| @@ -907,15 +911,11 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 907 | (cons program args) " ")))) | 911 | (cons program args) " ")))) |
| 908 | (tramp-process-connection-type | 912 | (tramp-process-connection-type |
| 909 | (or (null program) tramp-process-connection-type)) | 913 | (or (null program) tramp-process-connection-type)) |
| 910 | (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) | ||
| 911 | (name1 name) | 914 | (name1 name) |
| 912 | (i 0)) | 915 | (i 0)) |
| 913 | (unwind-protect | 916 | (unwind-protect |
| 914 | (save-excursion | 917 | (save-excursion |
| 915 | (save-restriction | 918 | (save-restriction |
| 916 | (unless buffer | ||
| 917 | ;; BUFFER can be nil. We use a temporary buffer. | ||
| 918 | (setq buffer (generate-new-buffer tramp-temp-buffer-name))) | ||
| 919 | (while (get-process name1) | 919 | (while (get-process name1) |
| 920 | ;; NAME must be unique as process name. | 920 | ;; NAME must be unique as process name. |
| 921 | (setq i (1+ i) | 921 | (setq i (1+ i) |
| @@ -923,35 +923,21 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 923 | (setq name name1) | 923 | (setq name name1) |
| 924 | ;; Set the new process properties. | 924 | ;; Set the new process properties. |
| 925 | (tramp-set-connection-property v "process-name" name) | 925 | (tramp-set-connection-property v "process-name" name) |
| 926 | (tramp-set-connection-property v "process-buffer" buffer) | 926 | (when command |
| 927 | ;; Activate narrowing in order to save BUFFER contents. | 927 | (let* ((host (tramp-file-name-host v)) |
| 928 | ;; Clear also the modification time; otherwise we might | 928 | (devices (mapcar 'cadr (tramp-adb-parse-device-names nil))) |
| 929 | ;; be interrupted by `verify-visited-file-modtime'. | 929 | (args (if (> (length host) 0) |
| 930 | (with-current-buffer (tramp-get-connection-buffer v) | 930 | (list "-s" host "shell" command) |
| 931 | (let ((buffer-undo-list t)) | 931 | (list "shell" command))) |
| 932 | (clear-visited-file-modtime) | 932 | (p (apply 'start-process (tramp-get-connection-name v) buffer |
| 933 | (narrow-to-region (point-max) (point-max)) | 933 | (tramp-adb-program) args))) |
| 934 | (if command | 934 | ;; Set sentinel and query flag for this process. |
| 935 | ;; Send the command. | 935 | (tramp-set-connection-property p "vector" v) |
| 936 | (tramp-adb-send-command v command) | 936 | (set-process-sentinel p 'tramp-process-sentinel) |
| 937 | ;; Open the connection. | 937 | (tramp-compat-set-process-query-on-exit-flag p t) |
| 938 | (tramp-adb-maybe-open-connection v)))) | 938 | ;; Return process. |
| 939 | (let ((p (tramp-get-connection-process v))) | 939 | p)))) |
| 940 | ;; Set sentinel and query flag for this process. | 940 | (tramp-set-connection-property v "process-name" nil))))) |
| 941 | (tramp-set-connection-property p "vector" v) | ||
| 942 | (set-process-sentinel p 'tramp-process-sentinel) | ||
| 943 | (tramp-compat-set-process-query-on-exit-flag p t) | ||
| 944 | ;; Return process. | ||
| 945 | p))) | ||
| 946 | ;; Save exit. | ||
| 947 | (with-current-buffer (tramp-get-connection-buffer v) | ||
| 948 | (if (string-match tramp-temp-buffer-name (buffer-name)) | ||
| 949 | (progn | ||
| 950 | (set-process-buffer (tramp-get-connection-process v) nil) | ||
| 951 | (kill-buffer (current-buffer))) | ||
| 952 | (set-buffer-modified-p bmp))) | ||
| 953 | (tramp-set-connection-property v "process-name" nil) | ||
| 954 | (tramp-set-connection-property v "process-buffer" nil))))) | ||
| 955 | 941 | ||
| 956 | ;; Helper functions. | 942 | ;; Helper functions. |
| 957 | 943 | ||
| @@ -1089,7 +1075,7 @@ connection if a previous connection has died for some reason." | |||
| 1089 | (tramp-adb-wait-for-output p) | 1075 | (tramp-adb-wait-for-output p) |
| 1090 | (unless (eq 'run (process-status p)) | 1076 | (unless (eq 'run (process-status p)) |
| 1091 | (tramp-error vec 'file-error "Terminated!")) | 1077 | (tramp-error vec 'file-error "Terminated!")) |
| 1092 | (set-process-query-on-exit-flag p nil) | 1078 | (tramp-compat-set-process-query-on-exit-flag p nil) |
| 1093 | 1079 | ||
| 1094 | ;; Check whether the properties have been changed. If | 1080 | ;; Check whether the properties have been changed. If |
| 1095 | ;; yes, this is a strong indication that we must expire all | 1081 | ;; yes, this is a strong indication that we must expire all |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index d83599a6662..743c8dbe0f9 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -1555,7 +1555,8 @@ be non-negative integers." | |||
| 1555 | (goto-char (point-max)) | 1555 | (goto-char (point-max)) |
| 1556 | (delete-blank-lines) | 1556 | (delete-blank-lines) |
| 1557 | (when (> (point-max) (point-min)) | 1557 | (when (> (point-max) (point-min)) |
| 1558 | (substring-no-properties (buffer-string)))))))) | 1558 | (tramp-compat-funcall |
| 1559 | 'substring-no-properties (buffer-string)))))))) | ||
| 1559 | 1560 | ||
| 1560 | (defun tramp-sh-handle-set-file-acl (filename acl-string) | 1561 | (defun tramp-sh-handle-set-file-acl (filename acl-string) |
| 1561 | "Like `set-file-acl' for Tramp files." | 1562 | "Like `set-file-acl' for Tramp files." |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 0f143100906..65c52ae4f3c 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -649,13 +649,14 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 649 | v (format "getfacl \"%s\"" (tramp-smb-get-localname v))) | 649 | v (format "getfacl \"%s\"" (tramp-smb-get-localname v))) |
| 650 | (with-current-buffer (tramp-get-connection-buffer v) | 650 | (with-current-buffer (tramp-get-connection-buffer v) |
| 651 | (goto-char (point-min)) | 651 | (goto-char (point-min)) |
| 652 | (while (looking-at-p "^#") | 652 | (while (looking-at "^#") |
| 653 | (forward-line) | 653 | (forward-line) |
| 654 | (delete-region (point-min) (point))) | 654 | (delete-region (point-min) (point))) |
| 655 | (goto-char (point-max)) | 655 | (goto-char (point-max)) |
| 656 | (delete-blank-lines) | 656 | (delete-blank-lines) |
| 657 | (when (> (point-max) (point-min)) | 657 | (when (> (point-max) (point-min)) |
| 658 | (substring-no-properties (buffer-string)))))))) | 658 | (tramp-compat-funcall |
| 659 | 'substring-no-properties (buffer-string)))))))) | ||
| 659 | 660 | ||
| 660 | (defun tramp-smb-handle-file-attributes (filename &optional id-format) | 661 | (defun tramp-smb-handle-file-attributes (filename &optional id-format) |
| 661 | "Like `file-attributes' for Tramp files." | 662 | "Like `file-attributes' for Tramp files." |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 2c4aac0ac8a..69e82de3f7f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1779,28 +1779,23 @@ value of `default-file-modes', without execute permissions." | |||
| 1779 | (or (file-modes filename) | 1779 | (or (file-modes filename) |
| 1780 | (logand (default-file-modes) (tramp-compat-octal-to-decimal "0666")))) | 1780 | (logand (default-file-modes) (tramp-compat-octal-to-decimal "0666")))) |
| 1781 | 1781 | ||
| 1782 | (defalias 'tramp-replace-environment-variables | 1782 | (defun tramp-replace-environment-variables (filename) |
| 1783 | (if (ignore-errors | 1783 | "Replace environment variables in FILENAME. |
| 1784 | (equal "${ tramp?}" | ||
| 1785 | (tramp-compat-funcall | ||
| 1786 | 'substitute-env-vars "${ tramp?}" 'only-defined))) | ||
| 1787 | (lambda (filename) | ||
| 1788 | "Like `substitute-env-vars' with `only-defined' non-nil." | ||
| 1789 | (tramp-compat-funcall 'substitute-env-vars filename 'only-defined)) | ||
| 1790 | (lambda (filename) | ||
| 1791 | "Replace environment variables in FILENAME. | ||
| 1792 | Return the string with the replaced variables." | 1784 | Return the string with the replaced variables." |
| 1793 | (save-match-data | 1785 | (or (ignore-errors |
| 1794 | (let ((idx (string-match "$\\(\\w+\\)" filename))) | 1786 | (tramp-compat-funcall 'substitute-env-vars filename 'only-defined)) |
| 1795 | ;; `$' is coded as `$$'. | 1787 | ;; We need an own implementation. |
| 1796 | (when (and idx | 1788 | (save-match-data |
| 1797 | (or (zerop idx) (not (eq ?$ (aref filename (1- idx))))) | 1789 | (let ((idx (string-match "$\\(\\w+\\)" filename))) |
| 1798 | (getenv (match-string 1 filename))) | 1790 | ;; `$' is coded as `$$'. |
| 1799 | (setq filename | 1791 | (when (and idx |
| 1800 | (replace-match | 1792 | (or (zerop idx) (not (eq ?$ (aref filename (1- idx))))) |
| 1801 | (substitute-in-file-name (match-string 0 filename)) | 1793 | (getenv (match-string 1 filename))) |
| 1802 | t nil filename))) | 1794 | (setq filename |
| 1803 | filename))))) | 1795 | (replace-match |
| 1796 | (substitute-in-file-name (match-string 0 filename)) | ||
| 1797 | t nil filename))) | ||
| 1798 | filename)))) | ||
| 1804 | 1799 | ||
| 1805 | ;; In XEmacs, electricity is implemented via a key map for ?/ and ?~, | 1800 | ;; In XEmacs, electricity is implemented via a key map for ?/ and ?~, |
| 1806 | ;; which calls corresponding functions (see minibuf.el). | 1801 | ;; which calls corresponding functions (see minibuf.el). |