diff options
| -rw-r--r-- | lisp/ChangeLog | 56 | ||||
| -rw-r--r-- | lisp/net/tramp-adb.el | 6 | ||||
| -rw-r--r-- | lisp/net/tramp-cache.el | 7 | ||||
| -rw-r--r-- | lisp/net/tramp-cmds.el | 4 | ||||
| -rw-r--r-- | lisp/net/tramp-compat.el | 72 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 31 | ||||
| -rw-r--r-- | lisp/net/tramp-gw.el | 2 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 57 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 20 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 62 |
10 files changed, 227 insertions, 90 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e919a8407ec..40a36719a1a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,59 @@ | |||
| 1 | 2013-09-08 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | Improve compatibility with older Emacsen, and XEmacs. | ||
| 4 | |||
| 5 | * net/tramp.el (tramp-find-method, tramp-find-user): Call `propertize' | ||
| 6 | only if it is bound. It isn't for XEmacs. | ||
| 7 | (with-tramp-progress-reporter): Do not let-bind `result'. This | ||
| 8 | yields to scoping errors in XEmacs. | ||
| 9 | (tramp-handle-make-auto-save-file-name): New function, moved from | ||
| 10 | tramp-sh.el. | ||
| 11 | |||
| 12 | * net/tramp-adb.el (tramp-adb-file-name-handler-alist): Add handler | ||
| 13 | for `make-auto-save-file-name'. | ||
| 14 | (tramp-adb--gnu-switches-to-ash): Use | ||
| 15 | `tramp-compat-replace-regexp-in-string'. | ||
| 16 | |||
| 17 | * net/tramp-cache.el (tramp-cache-print): Call | ||
| 18 | `substring-no-properties' only if it is bound. It isn't for XEmacs. | ||
| 19 | |||
| 20 | * net/tramp-cmds.el (tramp-bug): Call `propertize' only if it is | ||
| 21 | bound. It isn't for XEmacs. | ||
| 22 | |||
| 23 | * net/tramp-compat.el (tramp-compat-copy-file): Catch | ||
| 24 | `wrong-number-of-arguments' error. | ||
| 25 | (tramp-compat-replace-regexp-in-string): New defun. | ||
| 26 | |||
| 27 | * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): Add handler | ||
| 28 | for `make-auto-save-file-name'. | ||
| 29 | (tramp-gvfs-handle-copy-file): Use `tramp-compat-funcall' for | ||
| 30 | `copy-file'. | ||
| 31 | (tramp-gvfs-file-gvfs-monitor-file-process-filter) | ||
| 32 | (tramp-gvfs-file-name): Use `tramp-compat-replace-regexp-in-string'. | ||
| 33 | (tramp-synce-list-devices): Use `push' instead of `pushnew'. | ||
| 34 | |||
| 35 | * net/tramp-gw.el (tramp-gw-open-network-stream): Use | ||
| 36 | `tramp-compat-replace-regexp-in-string'. | ||
| 37 | |||
| 38 | * net/tramp-sh.el (tramp-sh-file-name-handler-alist): Call | ||
| 39 | `tramp-handle-make-auto-save-file-name'. | ||
| 40 | (tramp-sh-handle-make-auto-save-file-name): Move to tramp.el. | ||
| 41 | (tramp-sh-file-gvfs-monitor-dir-process-filter) | ||
| 42 | (tramp-sh-file-inotifywait-process-filter): Use | ||
| 43 | `tramp-compat-replace-regexp-in-string'. | ||
| 44 | (tramp-compute-multi-hops): Use `push' instead of `pushnew'. | ||
| 45 | |||
| 46 | * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add handler | ||
| 47 | for `make-auto-save-file-name'. | ||
| 48 | (tramp-smb-handle-copy-directory): Call | ||
| 49 | `tramp-compat-replace-regexp-in-string'. | ||
| 50 | (tramp-smb-get-file-entries): Use `push' instead of `pushnew'. | ||
| 51 | (tramp-smb-handle-copy-file): Improve error message. | ||
| 52 | (tramp-smb-handle-rename-file): Rename directly only in case | ||
| 53 | `newname' does not exist yet. This is a restriction of smbclient. | ||
| 54 | (tramp-smb-maybe-open-connection): Rerun the function only when | ||
| 55 | `auth-sources' is non-nil. | ||
| 56 | |||
| 1 | 2013-09-08 Kenichi Handa <handa@gnu.org> | 57 | 2013-09-08 Kenichi Handa <handa@gnu.org> |
| 2 | 58 | ||
| 3 | * international/characters.el: Set category "^" (Combining) for | 59 | * international/characters.el: Set category "^" (Combining) for |
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index a5f59227ef7..66d29cb3c8c 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -137,7 +137,7 @@ | |||
| 137 | (insert-directory . tramp-adb-handle-insert-directory) | 137 | (insert-directory . tramp-adb-handle-insert-directory) |
| 138 | (insert-file-contents . tramp-handle-insert-file-contents) | 138 | (insert-file-contents . tramp-handle-insert-file-contents) |
| 139 | (load . tramp-handle-load) | 139 | (load . tramp-handle-load) |
| 140 | ;; `make-auto-save-file-name' performed by default handler. | 140 | (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) |
| 141 | (make-directory . tramp-adb-handle-make-directory) | 141 | (make-directory . tramp-adb-handle-make-directory) |
| 142 | (make-directory-internal . ignore) | 142 | (make-directory-internal . ignore) |
| 143 | (make-symbolic-link . ignore) | 143 | (make-symbolic-link . ignore) |
| @@ -407,9 +407,9 @@ Convert (\"-al\") to (\"-a\" \"-l\"). Remove arguments like \"--dired\"." | |||
| 407 | (split-string | 407 | (split-string |
| 408 | (apply 'concat | 408 | (apply 'concat |
| 409 | (mapcar (lambda (s) | 409 | (mapcar (lambda (s) |
| 410 | (replace-regexp-in-string | 410 | (tramp-compat-replace-regexp-in-string |
| 411 | "\\(.\\)" " -\\1" | 411 | "\\(.\\)" " -\\1" |
| 412 | (replace-regexp-in-string "^-" "" s))) | 412 | (tramp-compat-replace-regexp-in-string "^-" "" s))) |
| 413 | ;; FIXME: Warning about removed switches (long and non-dash). | 413 | ;; FIXME: Warning about removed switches (long and non-dash). |
| 414 | (delq nil | 414 | (delq nil |
| 415 | (mapcar | 415 | (mapcar |
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index b89c5124721..b4e5e4ffd0f 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el | |||
| @@ -289,7 +289,12 @@ KEY identifies the connection, it is either a process or a vector." | |||
| 289 | (when (vectorp key) | 289 | (when (vectorp key) |
| 290 | (dotimes (i (length key)) | 290 | (dotimes (i (length key)) |
| 291 | (when (stringp (aref key i)) | 291 | (when (stringp (aref key i)) |
| 292 | (aset key i (substring-no-properties (aref key i)))))) | 292 | (aset key i |
| 293 | (funcall | ||
| 294 | ;; `substring-no-properties' does not exist in XEmacs. | ||
| 295 | (if (functionp 'substring-no-properties) | ||
| 296 | 'substring-no-properties 'identity) | ||
| 297 | (aref key i)))))) | ||
| 293 | (let ((tmp (format | 298 | (let ((tmp (format |
| 294 | "(%s %s)" | 299 | "(%s %s)" |
| 295 | (if (processp key) | 300 | (if (processp key) |
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 937db34a346..de06cd5cbc9 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el | |||
| @@ -190,7 +190,9 @@ This includes password cache, file cache, connection cache, buffers." | |||
| 190 | 190 | ||
| 191 | 'tramp-load-report-modules ; pre-hook | 191 | 'tramp-load-report-modules ; pre-hook |
| 192 | 'tramp-append-tramp-buffers ; post-hook | 192 | 'tramp-append-tramp-buffers ; post-hook |
| 193 | (propertize "\n" 'display "\ | 193 | (funcall |
| 194 | (if (functionp 'propertize) 'propertize 'progn) | ||
| 195 | "\n" 'display "\ | ||
| 194 | Enter your bug report in this message, including as much detail | 196 | Enter your bug report in this message, including as much detail |
| 195 | as you possibly can about the problem, what you did to cause it | 197 | as you possibly can about the problem, what you did to cause it |
| 196 | and what the local and remote machines are. | 198 | and what the local and remote machines are. |
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 8f9d9d8fee5..ca70c1384cb 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -313,13 +313,21 @@ Not actually used. Use `(format \"%o\" i)' instead?" | |||
| 313 | "Like `copy-file' for Tramp files (compat function)." | 313 | "Like `copy-file' for Tramp files (compat function)." |
| 314 | (cond | 314 | (cond |
| 315 | (preserve-extended-attributes | 315 | (preserve-extended-attributes |
| 316 | (tramp-compat-funcall | 316 | (condition-case nil |
| 317 | 'copy-file filename newname ok-if-already-exists keep-date | 317 | (tramp-compat-funcall |
| 318 | preserve-uid-gid preserve-extended-attributes)) | 318 | 'copy-file filename newname ok-if-already-exists keep-date |
| 319 | preserve-uid-gid preserve-extended-attributes) | ||
| 320 | (wrong-number-of-arguments | ||
| 321 | (tramp-compat-copy-file | ||
| 322 | filename newname ok-if-already-exists keep-date preserve-uid-gid)))) | ||
| 319 | (preserve-uid-gid | 323 | (preserve-uid-gid |
| 320 | (tramp-compat-funcall | 324 | (condition-case nil |
| 321 | 'copy-file filename newname ok-if-already-exists keep-date | 325 | (tramp-compat-funcall |
| 322 | preserve-uid-gid)) | 326 | 'copy-file filename newname ok-if-already-exists keep-date |
| 327 | preserve-uid-gid) | ||
| 328 | (wrong-number-of-arguments | ||
| 329 | (tramp-compat-copy-file | ||
| 330 | filename newname ok-if-already-exists keep-date)))) | ||
| 323 | (t | 331 | (t |
| 324 | (copy-file filename newname ok-if-already-exists keep-date)))) | 332 | (copy-file filename newname ok-if-already-exists keep-date)))) |
| 325 | 333 | ||
| @@ -518,6 +526,58 @@ EOL-TYPE can be one of `dos', `unix', or `mac'." | |||
| 518 | "`dos', `unix', or `mac'"))))) | 526 | "`dos', `unix', or `mac'"))))) |
| 519 | (t (error "Can't change EOL conversion -- is MULE missing?")))) | 527 | (t (error "Can't change EOL conversion -- is MULE missing?")))) |
| 520 | 528 | ||
| 529 | ;; `replace-regexp-in-string' does not exist in XEmacs. | ||
| 530 | ;; Implementation is taken from Emacs 24. | ||
| 531 | (if (fboundp 'replace-regexp-in-string) | ||
| 532 | (defalias 'tramp-compat-replace-regexp-in-string 'replace-regexp-in-string) | ||
| 533 | (defun tramp-compat-replace-regexp-in-string | ||
| 534 | (regexp rep string &optional fixedcase literal subexp start) | ||
| 535 | "Replace all matches for REGEXP with REP in STRING. | ||
| 536 | |||
| 537 | Return a new string containing the replacements. | ||
| 538 | |||
| 539 | Optional arguments FIXEDCASE, LITERAL and SUBEXP are like the | ||
| 540 | arguments with the same names of function `replace-match'. If START | ||
| 541 | is non-nil, start replacements at that index in STRING. | ||
| 542 | |||
| 543 | REP is either a string used as the NEWTEXT arg of `replace-match' or a | ||
| 544 | function. If it is a function, it is called with the actual text of each | ||
| 545 | match, and its value is used as the replacement text. When REP is called, | ||
| 546 | the match data are the result of matching REGEXP against a substring | ||
| 547 | of STRING. | ||
| 548 | |||
| 549 | To replace only the first match (if any), make REGEXP match up to \\' | ||
| 550 | and replace a sub-expression, e.g. | ||
| 551 | (replace-regexp-in-string \"\\\\(foo\\\\).*\\\\'\" \"bar\" \" foo foo\" nil nil 1) | ||
| 552 | => \" bar foo\"" | ||
| 553 | |||
| 554 | (let ((l (length string)) | ||
| 555 | (start (or start 0)) | ||
| 556 | matches str mb me) | ||
| 557 | (save-match-data | ||
| 558 | (while (and (< start l) (string-match regexp string start)) | ||
| 559 | (setq mb (match-beginning 0) | ||
| 560 | me (match-end 0)) | ||
| 561 | ;; If we matched the empty string, make sure we advance by one char | ||
| 562 | (when (= me mb) (setq me (min l (1+ mb)))) | ||
| 563 | ;; Generate a replacement for the matched substring. | ||
| 564 | ;; Operate only on the substring to minimize string consing. | ||
| 565 | ;; Set up match data for the substring for replacement; | ||
| 566 | ;; presumably this is likely to be faster than munging the | ||
| 567 | ;; match data directly in Lisp. | ||
| 568 | (string-match regexp (setq str (substring string mb me))) | ||
| 569 | (setq matches | ||
| 570 | (cons (replace-match (if (stringp rep) | ||
| 571 | rep | ||
| 572 | (funcall rep (match-string 0 str))) | ||
| 573 | fixedcase literal str subexp) | ||
| 574 | (cons (substring string start mb) ; unmatched prefix | ||
| 575 | matches))) | ||
| 576 | (setq start me)) | ||
| 577 | ;; Reconstruct a string from the pieces. | ||
| 578 | (setq matches (cons (substring string start l) matches)) ; leftover | ||
| 579 | (apply #'concat (nreverse matches)))))) | ||
| 580 | |||
| 521 | (add-hook 'tramp-unload-hook | 581 | (add-hook 'tramp-unload-hook |
| 522 | (lambda () | 582 | (lambda () |
| 523 | (unload-feature 'tramp-compat 'force))) | 583 | (unload-feature 'tramp-compat 'force))) |
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index a1ead96eaea..e764e4767dd 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -453,7 +453,7 @@ Every entry is a list (NAME ADDRESS).") | |||
| 453 | (insert-directory . tramp-gvfs-handle-insert-directory) | 453 | (insert-directory . tramp-gvfs-handle-insert-directory) |
| 454 | (insert-file-contents . tramp-gvfs-handle-insert-file-contents) | 454 | (insert-file-contents . tramp-gvfs-handle-insert-file-contents) |
| 455 | (load . tramp-handle-load) | 455 | (load . tramp-handle-load) |
| 456 | ;; `make-auto-save-file-name' performed by default handler. | 456 | (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) |
| 457 | (make-directory . tramp-gvfs-handle-make-directory) | 457 | (make-directory . tramp-gvfs-handle-make-directory) |
| 458 | (make-directory-internal . ignore) | 458 | (make-directory-internal . ignore) |
| 459 | (make-symbolic-link . ignore) | 459 | (make-symbolic-link . ignore) |
| @@ -594,15 +594,19 @@ is no information where to trace the message.") | |||
| 594 | (and (tramp-tramp-file-p newname) | 594 | (and (tramp-tramp-file-p newname) |
| 595 | (not (tramp-gvfs-file-name-p newname)))) | 595 | (not (tramp-gvfs-file-name-p newname)))) |
| 596 | 596 | ||
| 597 | ;; We cannot copy directly. | 597 | ;; We cannot call `copy-file' directly. Use |
| 598 | ;; `tramp-compat-funcall' for backward compatibility (number | ||
| 599 | ;; of arguments). | ||
| 598 | (let ((tmpfile (tramp-compat-make-temp-file filename))) | 600 | (let ((tmpfile (tramp-compat-make-temp-file filename))) |
| 599 | (cond | 601 | (cond |
| 600 | (preserve-extended-attributes | 602 | (preserve-extended-attributes |
| 601 | (copy-file | 603 | (tramp-compat-funcall |
| 604 | 'copy-file | ||
| 602 | filename tmpfile t keep-date preserve-uid-gid | 605 | filename tmpfile t keep-date preserve-uid-gid |
| 603 | preserve-extended-attributes)) | 606 | preserve-extended-attributes)) |
| 604 | (preserve-uid-gid | 607 | (preserve-uid-gid |
| 605 | (copy-file filename tmpfile t keep-date preserve-uid-gid)) | 608 | (tramp-compat-funcall |
| 609 | 'copy-file filename tmpfile t keep-date preserve-uid-gid)) | ||
| 606 | (t | 610 | (t |
| 607 | (copy-file filename tmpfile t keep-date))) | 611 | (copy-file filename tmpfile t keep-date))) |
| 608 | (rename-file tmpfile newname ok-if-already-exists)) | 612 | (rename-file tmpfile newname ok-if-already-exists)) |
| @@ -950,7 +954,7 @@ is no information where to trace the message.") | |||
| 950 | (tramp-message proc 6 "%S\n%s" proc string) | 954 | (tramp-message proc 6 "%S\n%s" proc string) |
| 951 | (setq string (concat rest-string string) | 955 | (setq string (concat rest-string string) |
| 952 | ;; Attribute change is returned in unused wording. | 956 | ;; Attribute change is returned in unused wording. |
| 953 | string (replace-regexp-in-string | 957 | string (tramp-compat-replace-regexp-in-string |
| 954 | "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string)) | 958 | "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string)) |
| 955 | 959 | ||
| 956 | (while (string-match | 960 | (while (string-match |
| @@ -960,7 +964,7 @@ is no information where to trace the message.") | |||
| 960 | "Event = \\([^[:blank:]]+\\)[\n\r]+") | 964 | "Event = \\([^[:blank:]]+\\)[\n\r]+") |
| 961 | string) | 965 | string) |
| 962 | (let ((action (intern-soft | 966 | (let ((action (intern-soft |
| 963 | (replace-regexp-in-string | 967 | (tramp-compat-replace-regexp-in-string |
| 964 | "_" "-" (downcase (match-string 2 string))))) | 968 | "_" "-" (downcase (match-string 2 string))))) |
| 965 | (file (match-string 1 string))) | 969 | (file (match-string 1 string))) |
| 966 | (setq string (replace-match "" nil nil string)) | 970 | (setq string (replace-match "" nil nil string)) |
| @@ -1158,7 +1162,8 @@ is no information where to trace the message.") | |||
| 1158 | (defun tramp-gvfs-file-name (object-path) | 1162 | (defun tramp-gvfs-file-name (object-path) |
| 1159 | "Retrieve file name from D-Bus OBJECT-PATH." | 1163 | "Retrieve file name from D-Bus OBJECT-PATH." |
| 1160 | (dbus-unescape-from-identifier | 1164 | (dbus-unescape-from-identifier |
| 1161 | (replace-regexp-in-string "^.*/\\([^/]+\\)$" "\\1" object-path))) | 1165 | (tramp-compat-replace-regexp-in-string |
| 1166 | "^.*/\\([^/]+\\)$" "\\1" object-path))) | ||
| 1162 | 1167 | ||
| 1163 | (defun tramp-bluez-address (device) | 1168 | (defun tramp-bluez-address (device) |
| 1164 | "Return bluetooth device address from a given bluetooth DEVICE name." | 1169 | "Return bluetooth device address from a given bluetooth DEVICE name." |
| @@ -1709,11 +1714,13 @@ They are retrieved from the hal daemon." | |||
| 1709 | (when (with-tramp-dbus-call-method tramp-gvfs-dbus-event-vector t | 1714 | (when (with-tramp-dbus-call-method tramp-gvfs-dbus-event-vector t |
| 1710 | :system tramp-hal-service device tramp-hal-interface-device | 1715 | :system tramp-hal-service device tramp-hal-interface-device |
| 1711 | "PropertyExists" "sync.plugin") | 1716 | "PropertyExists" "sync.plugin") |
| 1712 | (pushnew | 1717 | (let ((prop |
| 1713 | (with-tramp-dbus-call-method tramp-gvfs-dbus-event-vector t | 1718 | (with-tramp-dbus-call-method |
| 1714 | :system tramp-hal-service device tramp-hal-interface-device | 1719 | tramp-gvfs-dbus-event-vector t |
| 1715 | "GetPropertyString" "pda.pocketpc.name") | 1720 | :system tramp-hal-service device tramp-hal-interface-device |
| 1716 | tramp-synce-devices :test #'equal))) | 1721 | "GetPropertyString" "pda.pocketpc.name"))) |
| 1722 | (unless (member prop tramp-synce-devices) | ||
| 1723 | (push prop tramp-synce-devices))))) | ||
| 1717 | (tramp-message tramp-gvfs-dbus-event-vector 10 "%s" tramp-synce-devices) | 1724 | (tramp-message tramp-gvfs-dbus-event-vector 10 "%s" tramp-synce-devices) |
| 1718 | tramp-synce-devices)) | 1725 | tramp-synce-devices)) |
| 1719 | 1726 | ||
diff --git a/lisp/net/tramp-gw.el b/lisp/net/tramp-gw.el index 53dbdbc45d4..e2c7461228f 100644 --- a/lisp/net/tramp-gw.el +++ b/lisp/net/tramp-gw.el | |||
| @@ -238,7 +238,7 @@ authentication is requested from proxy server, provide it." | |||
| 238 | tramp-gw-vector 6 "\n%s" | 238 | tramp-gw-vector 6 "\n%s" |
| 239 | (format | 239 | (format |
| 240 | "%s%s\r\n" command | 240 | "%s%s\r\n" command |
| 241 | (replace-regexp-in-string ;; no password in trace! | 241 | (tramp-compat-replace-regexp-in-string ;; no password in trace! |
| 242 | "Basic [^\r\n]+" "Basic xxxxx" authentication t))) | 242 | "Basic [^\r\n]+" "Basic xxxxx" authentication t))) |
| 243 | (with-current-buffer buffer | 243 | (with-current-buffer buffer |
| 244 | ;; Trap errors to be traced in the right trace buffer. Often, | 244 | ;; Trap errors to be traced in the right trace buffer. Often, |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 8ca94122af1..2b7c43a4995 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -850,7 +850,7 @@ of command line.") | |||
| 850 | (insert-file-contents-literally | 850 | (insert-file-contents-literally |
| 851 | . tramp-sh-handle-insert-file-contents-literally) | 851 | . tramp-sh-handle-insert-file-contents-literally) |
| 852 | (load . tramp-handle-load) | 852 | (load . tramp-handle-load) |
| 853 | (make-auto-save-file-name . tramp-sh-handle-make-auto-save-file-name) | 853 | (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) |
| 854 | (make-directory . tramp-sh-handle-make-directory) | 854 | (make-directory . tramp-sh-handle-make-directory) |
| 855 | (make-symbolic-link . tramp-sh-handle-make-symbolic-link) | 855 | (make-symbolic-link . tramp-sh-handle-make-symbolic-link) |
| 856 | (process-file . tramp-sh-handle-process-file) | 856 | (process-file . tramp-sh-handle-process-file) |
| @@ -2978,48 +2978,6 @@ the result will be a local, non-Tramp, filename." | |||
| 2978 | (fset 'find-buffer-file-type find-buffer-file-type-function) | 2978 | (fset 'find-buffer-file-type find-buffer-file-type-function) |
| 2979 | (fmakunbound 'find-buffer-file-type))))) | 2979 | (fmakunbound 'find-buffer-file-type))))) |
| 2980 | 2980 | ||
| 2981 | (defun tramp-sh-handle-make-auto-save-file-name () | ||
| 2982 | "Like `make-auto-save-file-name' for Tramp files. | ||
| 2983 | Returns a file name in `tramp-auto-save-directory' for autosaving this file." | ||
| 2984 | (let ((tramp-auto-save-directory tramp-auto-save-directory) | ||
| 2985 | (buffer-file-name | ||
| 2986 | (tramp-subst-strs-in-string | ||
| 2987 | '(("_" . "|") | ||
| 2988 | ("/" . "_a") | ||
| 2989 | (":" . "_b") | ||
| 2990 | ("|" . "__") | ||
| 2991 | ("[" . "_l") | ||
| 2992 | ("]" . "_r")) | ||
| 2993 | (buffer-file-name)))) | ||
| 2994 | ;; File name must be unique. This is ensured with Emacs 22 (see | ||
| 2995 | ;; UNIQUIFY element of `auto-save-file-name-transforms'); but for | ||
| 2996 | ;; all other cases we must do it ourselves. | ||
| 2997 | (when (boundp 'auto-save-file-name-transforms) | ||
| 2998 | (mapc | ||
| 2999 | (lambda (x) | ||
| 3000 | (when (and (string-match (car x) buffer-file-name) | ||
| 3001 | (not (car (cddr x)))) | ||
| 3002 | (setq tramp-auto-save-directory | ||
| 3003 | (or tramp-auto-save-directory | ||
| 3004 | (tramp-compat-temporary-file-directory))))) | ||
| 3005 | (symbol-value 'auto-save-file-name-transforms))) | ||
| 3006 | ;; Create directory. | ||
| 3007 | (when tramp-auto-save-directory | ||
| 3008 | (setq buffer-file-name | ||
| 3009 | (expand-file-name buffer-file-name tramp-auto-save-directory)) | ||
| 3010 | (unless (file-exists-p tramp-auto-save-directory) | ||
| 3011 | (make-directory tramp-auto-save-directory t))) | ||
| 3012 | ;; Run plain `make-auto-save-file-name'. There might be an advice when | ||
| 3013 | ;; it is not a magic file name operation (since Emacs 22). | ||
| 3014 | ;; We must deactivate it temporarily. | ||
| 3015 | (if (not (ad-is-active 'make-auto-save-file-name)) | ||
| 3016 | (tramp-run-real-handler 'make-auto-save-file-name nil) | ||
| 3017 | ;; else | ||
| 3018 | (ad-deactivate 'make-auto-save-file-name) | ||
| 3019 | (prog1 | ||
| 3020 | (tramp-run-real-handler 'make-auto-save-file-name nil) | ||
| 3021 | (ad-activate 'make-auto-save-file-name))))) | ||
| 3022 | |||
| 3023 | ;; CCC grok LOCKNAME | 2981 | ;; CCC grok LOCKNAME |
| 3024 | (defun tramp-sh-handle-write-region | 2982 | (defun tramp-sh-handle-write-region |
| 3025 | (start end filename &optional append visit lockname confirm) | 2983 | (start end filename &optional append visit lockname confirm) |
| @@ -3425,7 +3383,7 @@ Fall back to normal file name handler if no Tramp handler exists." | |||
| 3425 | (tramp-message proc 6 "%S\n%s" proc string) | 3383 | (tramp-message proc 6 "%S\n%s" proc string) |
| 3426 | (setq string (concat rest-string string) | 3384 | (setq string (concat rest-string string) |
| 3427 | ;; Attribute change is returned in unused wording. | 3385 | ;; Attribute change is returned in unused wording. |
| 3428 | string (replace-regexp-in-string | 3386 | string (tramp-compat-replace-regexp-in-string |
| 3429 | "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string)) | 3387 | "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string)) |
| 3430 | 3388 | ||
| 3431 | (while (string-match | 3389 | (while (string-match |
| @@ -3439,7 +3397,7 @@ Fall back to normal file name handler if no Tramp handler exists." | |||
| 3439 | (list | 3397 | (list |
| 3440 | proc | 3398 | proc |
| 3441 | (intern-soft | 3399 | (intern-soft |
| 3442 | (replace-regexp-in-string | 3400 | (tramp-compat-replace-regexp-in-string |
| 3443 | "_" "-" (downcase (match-string 4 string)))) | 3401 | "_" "-" (downcase (match-string 4 string)))) |
| 3444 | ;; File names are returned as absolute paths. We must | 3402 | ;; File names are returned as absolute paths. We must |
| 3445 | ;; add the remote prefix. | 3403 | ;; add the remote prefix. |
| @@ -3475,7 +3433,8 @@ Fall back to normal file name handler if no Tramp handler exists." | |||
| 3475 | proc | 3433 | proc |
| 3476 | (mapcar | 3434 | (mapcar |
| 3477 | (lambda (x) | 3435 | (lambda (x) |
| 3478 | (intern-soft (replace-regexp-in-string "_" "-" (downcase x)))) | 3436 | (intern-soft |
| 3437 | (tramp-compat-replace-regexp-in-string "_" "-" (downcase x)))) | ||
| 3479 | (split-string (match-string 1 line) "," 'omit-nulls)) | 3438 | (split-string (match-string 1 line) "," 'omit-nulls)) |
| 3480 | (match-string 3 line)))) | 3439 | (match-string 3 line)))) |
| 3481 | ;; Usually, we would add an Emacs event now. Unfortunately, | 3440 | ;; Usually, we would add an Emacs event now. Unfortunately, |
| @@ -4252,7 +4211,7 @@ Gateway hops are already opened." | |||
| 4252 | ?h (or (tramp-file-name-host (car target-alist)) "")))) | 4211 | ?h (or (tramp-file-name-host (car target-alist)) "")))) |
| 4253 | (with-parsed-tramp-file-name proxy l | 4212 | (with-parsed-tramp-file-name proxy l |
| 4254 | ;; Add the hop. | 4213 | ;; Add the hop. |
| 4255 | (pushnew l target-alist :test #'equal) | 4214 | (push l target-alist) |
| 4256 | ;; Start next search. | 4215 | ;; Start next search. |
| 4257 | (setq choices tramp-default-proxies-alist))))) | 4216 | (setq choices tramp-default-proxies-alist))))) |
| 4258 | 4217 | ||
| @@ -4270,11 +4229,11 @@ Gateway hops are already opened." | |||
| 4270 | vec 'file-error | 4229 | vec 'file-error |
| 4271 | "Connection `%s' is not supported for gateway access." hop)) | 4230 | "Connection `%s' is not supported for gateway access." hop)) |
| 4272 | ;; Open the gateway connection. | 4231 | ;; Open the gateway connection. |
| 4273 | (pushnew | 4232 | (push |
| 4274 | (vector | 4233 | (vector |
| 4275 | (tramp-file-name-method hop) (tramp-file-name-user hop) | 4234 | (tramp-file-name-method hop) (tramp-file-name-user hop) |
| 4276 | (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil nil) | 4235 | (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil nil) |
| 4277 | target-alist :test #'equal) | 4236 | target-alist) |
| 4278 | ;; For the password prompt, we need the correct values. | 4237 | ;; For the password prompt, we need the correct values. |
| 4279 | ;; Therefore, we must remember the gateway vector. But we | 4238 | ;; Therefore, we must remember the gateway vector. But we |
| 4280 | ;; cannot do it as connection property, because it shouldn't | 4239 | ;; cannot do it as connection property, because it shouldn't |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index f05a54f46f7..1d4880a9f32 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -229,7 +229,7 @@ See `tramp-actions-before-shell' for more info.") | |||
| 229 | (insert-directory . tramp-smb-handle-insert-directory) | 229 | (insert-directory . tramp-smb-handle-insert-directory) |
| 230 | (insert-file-contents . tramp-handle-insert-file-contents) | 230 | (insert-file-contents . tramp-handle-insert-file-contents) |
| 231 | (load . tramp-handle-load) | 231 | (load . tramp-handle-load) |
| 232 | ;; `make-auto-save-file-name' performed by default handler. | 232 | (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) |
| 233 | (make-directory . tramp-smb-handle-make-directory) | 233 | (make-directory . tramp-smb-handle-make-directory) |
| 234 | (make-directory-internal . tramp-smb-handle-make-directory-internal) | 234 | (make-directory-internal . tramp-smb-handle-make-directory-internal) |
| 235 | (make-symbolic-link . tramp-smb-handle-make-symbolic-link) | 235 | (make-symbolic-link . tramp-smb-handle-make-symbolic-link) |
| @@ -403,7 +403,7 @@ pass to the OPERATION." | |||
| 403 | (port (tramp-file-name-port v)) | 403 | (port (tramp-file-name-port v)) |
| 404 | (share (tramp-smb-get-share v)) | 404 | (share (tramp-smb-get-share v)) |
| 405 | (localname (file-name-as-directory | 405 | (localname (file-name-as-directory |
| 406 | (replace-regexp-in-string | 406 | (tramp-compat-replace-regexp-in-string |
| 407 | "\\\\" "/" (tramp-smb-get-localname v)))) | 407 | "\\\\" "/" (tramp-smb-get-localname v)))) |
| 408 | (tmpdir (make-temp-name | 408 | (tmpdir (make-temp-name |
| 409 | (expand-file-name | 409 | (expand-file-name |
| @@ -537,7 +537,8 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 537 | (unless (tramp-smb-send-command | 537 | (unless (tramp-smb-send-command |
| 538 | v (format "put \"%s\" \"%s\"" | 538 | v (format "put \"%s\" \"%s\"" |
| 539 | filename (tramp-smb-get-localname v))) | 539 | filename (tramp-smb-get-localname v))) |
| 540 | (tramp-error v 'file-error "Cannot copy `%s'" filename)))))) | 540 | (tramp-error |
| 541 | v 'file-error "Cannot copy `%s' to `%s'" filename newname)))))) | ||
| 541 | 542 | ||
| 542 | ;; KEEP-DATE handling. | 543 | ;; KEEP-DATE handling. |
| 543 | (when keep-date | 544 | (when keep-date |
| @@ -1151,7 +1152,8 @@ target of the symlink differ." | |||
| 1151 | (tramp-dissect-file-name (if (file-remote-p filename) filename newname)) | 1152 | (tramp-dissect-file-name (if (file-remote-p filename) filename newname)) |
| 1152 | 0 (format "Renaming %s to %s" filename newname) | 1153 | 0 (format "Renaming %s to %s" filename newname) |
| 1153 | 1154 | ||
| 1154 | (if (and (tramp-equal-remote filename newname) | 1155 | (if (and (not (file-exists-p newname)) |
| 1156 | (tramp-equal-remote filename newname) | ||
| 1155 | (string-equal | 1157 | (string-equal |
| 1156 | (tramp-smb-get-share (tramp-dissect-file-name filename)) | 1158 | (tramp-smb-get-share (tramp-dissect-file-name filename)) |
| 1157 | (tramp-smb-get-share (tramp-dissect-file-name newname)))) | 1159 | (tramp-smb-get-share (tramp-dissect-file-name newname)))) |
| @@ -1364,14 +1366,14 @@ Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)." | |||
| 1364 | (while (not (eobp)) | 1366 | (while (not (eobp)) |
| 1365 | (setq entry (tramp-smb-read-file-entry share)) | 1367 | (setq entry (tramp-smb-read-file-entry share)) |
| 1366 | (forward-line) | 1368 | (forward-line) |
| 1367 | (when entry (pushnew entry res :test #'equal)))) | 1369 | (when entry (push entry res)))) |
| 1368 | 1370 | ||
| 1369 | ;; Cache share entries. | 1371 | ;; Cache share entries. |
| 1370 | (unless share | 1372 | (unless share |
| 1371 | (tramp-set-connection-property v "share-cache" res))) | 1373 | (tramp-set-connection-property v "share-cache" res))) |
| 1372 | 1374 | ||
| 1373 | ;; Add directory itself. | 1375 | ;; Add directory itself. |
| 1374 | (pushnew '("" "drwxrwxrwx" 0 (0 0)) res :test #'equal) | 1376 | (push '("" "drwxrwxrwx" 0 (0 0)) res) |
| 1375 | 1377 | ||
| 1376 | ;; There's a very strange error (debugged with XEmacs 21.4.14) | 1378 | ;; There's a very strange error (debugged with XEmacs 21.4.14) |
| 1377 | ;; If there's no short delay, it returns nil. No idea about. | 1379 | ;; If there's no short delay, it returns nil. No idea about. |
| @@ -1719,8 +1721,10 @@ If ARGUMENT is non-nil, use it as argument for | |||
| 1719 | (error | 1721 | (error |
| 1720 | (with-current-buffer (tramp-get-connection-buffer vec) | 1722 | (with-current-buffer (tramp-get-connection-buffer vec) |
| 1721 | (goto-char (point-min)) | 1723 | (goto-char (point-min)) |
| 1722 | (if (search-forward-regexp | 1724 | (if (and (boundp 'auth-sources) |
| 1723 | tramp-smb-wrong-passwd-regexp nil t) | 1725 | (symbol-value 'auth-sources) |
| 1726 | (search-forward-regexp | ||
| 1727 | tramp-smb-wrong-passwd-regexp nil t)) | ||
| 1724 | ;; Disable `auth-source' and `password-cache'. | 1728 | ;; Disable `auth-source' and `password-cache'. |
| 1725 | (let (auth-sources) | 1729 | (let (auth-sources) |
| 1726 | (tramp-cleanup vec) | 1730 | (tramp-cleanup vec) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 727536b2e10..6c1ee70b205 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1222,10 +1222,11 @@ their replacement." | |||
| 1222 | ;; This works with the current set of `tramp-obsolete-methods'. | 1222 | ;; This works with the current set of `tramp-obsolete-methods'. |
| 1223 | ;; Must be improved, if their are more sophisticated replacements. | 1223 | ;; Must be improved, if their are more sophisticated replacements. |
| 1224 | (setq result (substring result 0 -1))) | 1224 | (setq result (substring result 0 -1))) |
| 1225 | ;; We must mark, whether a default value has been used. | 1225 | ;; We must mark, whether a default value has been used. Not |
| 1226 | (if (or method (null result)) | 1226 | ;; applicable for XEmacs. |
| 1227 | (if (or method (null result) (null (functionp 'propertize))) | ||
| 1227 | result | 1228 | result |
| 1228 | (propertize result 'tramp-default t)))) | 1229 | (tramp-compat-funcall 'propertize result 'tramp-default t)))) |
| 1229 | 1230 | ||
| 1230 | (defun tramp-find-user (method user host) | 1231 | (defun tramp-find-user (method user host) |
| 1231 | "Return the right user string to use. | 1232 | "Return the right user string to use. |
| @@ -1243,10 +1244,11 @@ This is USER, if non-nil. Otherwise, do a lookup in | |||
| 1243 | (setq choices nil))) | 1244 | (setq choices nil))) |
| 1244 | luser) | 1245 | luser) |
| 1245 | tramp-default-user))) | 1246 | tramp-default-user))) |
| 1246 | ;; We must mark, whether a default value has been used. | 1247 | ;; We must mark, whether a default value has been used. Not |
| 1247 | (if (or user (null result)) | 1248 | ;; applicable for XEmacs. |
| 1249 | (if (or user (null result) (null (functionp 'propertize))) | ||
| 1248 | result | 1250 | result |
| 1249 | (propertize result 'tramp-default t)))) | 1251 | (tramp-compat-funcall 'propertize result 'tramp-default t)))) |
| 1250 | 1252 | ||
| 1251 | (defun tramp-find-host (method user host) | 1253 | (defun tramp-find-host (method user host) |
| 1252 | "Return the right host string to use. | 1254 | "Return the right host string to use. |
| @@ -1641,7 +1643,7 @@ without a visible progress reporter." | |||
| 1641 | (declare (indent 3) (debug t)) | 1643 | (declare (indent 3) (debug t)) |
| 1642 | `(progn | 1644 | `(progn |
| 1643 | (tramp-message ,vec ,level "%s..." ,message) | 1645 | (tramp-message ,vec ,level "%s..." ,message) |
| 1644 | (let ((result "failed") | 1646 | (let ((cookie "failed") |
| 1645 | (tm | 1647 | (tm |
| 1646 | ;; We start a pulsing progress reporter after 3 seconds. Feature | 1648 | ;; We start a pulsing progress reporter after 3 seconds. Feature |
| 1647 | ;; introduced in Emacs 24.1. | 1649 | ;; introduced in Emacs 24.1. |
| @@ -1656,10 +1658,10 @@ without a visible progress reporter." | |||
| 1656 | #'tramp-progress-reporter-update pr))))))) | 1658 | #'tramp-progress-reporter-update pr))))))) |
| 1657 | (unwind-protect | 1659 | (unwind-protect |
| 1658 | ;; Execute the body. | 1660 | ;; Execute the body. |
| 1659 | (prog1 (progn ,@body) (setq result "done")) | 1661 | (prog1 (progn ,@body) (setq cookie "done")) |
| 1660 | ;; Stop progress reporter. | 1662 | ;; Stop progress reporter. |
| 1661 | (if tm (tramp-compat-funcall 'cancel-timer tm)) | 1663 | (if tm (tramp-compat-funcall 'cancel-timer tm)) |
| 1662 | (tramp-message ,vec ,level "%s...%s" ,message result))))) | 1664 | (tramp-message ,vec ,level "%s...%s" ,message cookie))))) |
| 1663 | 1665 | ||
| 1664 | (tramp-compat-font-lock-add-keywords | 1666 | (tramp-compat-font-lock-add-keywords |
| 1665 | 'emacs-lisp-mode '("\\<with-tramp-progress-reporter\\>")) | 1667 | 'emacs-lisp-mode '("\\<with-tramp-progress-reporter\\>")) |
| @@ -3920,6 +3922,48 @@ Return the local name of the temporary file." | |||
| 3920 | 3922 | ||
| 3921 | ;;; Auto saving to a special directory: | 3923 | ;;; Auto saving to a special directory: |
| 3922 | 3924 | ||
| 3925 | (defun tramp-handle-make-auto-save-file-name () | ||
| 3926 | "Like `make-auto-save-file-name' for Tramp files. | ||
| 3927 | Returns a file name in `tramp-auto-save-directory' for autosaving this file." | ||
| 3928 | (let ((tramp-auto-save-directory tramp-auto-save-directory) | ||
| 3929 | (buffer-file-name | ||
| 3930 | (tramp-subst-strs-in-string | ||
| 3931 | '(("_" . "|") | ||
| 3932 | ("/" . "_a") | ||
| 3933 | (":" . "_b") | ||
| 3934 | ("|" . "__") | ||
| 3935 | ("[" . "_l") | ||
| 3936 | ("]" . "_r")) | ||
| 3937 | (buffer-file-name)))) | ||
| 3938 | ;; File name must be unique. This is ensured with Emacs 22 (see | ||
| 3939 | ;; UNIQUIFY element of `auto-save-file-name-transforms'); but for | ||
| 3940 | ;; all other cases we must do it ourselves. | ||
| 3941 | (when (boundp 'auto-save-file-name-transforms) | ||
| 3942 | (mapc | ||
| 3943 | (lambda (x) | ||
| 3944 | (when (and (string-match (car x) buffer-file-name) | ||
| 3945 | (not (car (cddr x)))) | ||
| 3946 | (setq tramp-auto-save-directory | ||
| 3947 | (or tramp-auto-save-directory | ||
| 3948 | (tramp-compat-temporary-file-directory))))) | ||
| 3949 | (symbol-value 'auto-save-file-name-transforms))) | ||
| 3950 | ;; Create directory. | ||
| 3951 | (when tramp-auto-save-directory | ||
| 3952 | (setq buffer-file-name | ||
| 3953 | (expand-file-name buffer-file-name tramp-auto-save-directory)) | ||
| 3954 | (unless (file-exists-p tramp-auto-save-directory) | ||
| 3955 | (make-directory tramp-auto-save-directory t))) | ||
| 3956 | ;; Run plain `make-auto-save-file-name'. There might be an advice when | ||
| 3957 | ;; it is not a magic file name operation (since Emacs 22). | ||
| 3958 | ;; We must deactivate it temporarily. | ||
| 3959 | (if (not (ad-is-active 'make-auto-save-file-name)) | ||
| 3960 | (tramp-run-real-handler 'make-auto-save-file-name nil) | ||
| 3961 | ;; else | ||
| 3962 | (ad-deactivate 'make-auto-save-file-name) | ||
| 3963 | (prog1 | ||
| 3964 | (tramp-run-real-handler 'make-auto-save-file-name nil) | ||
| 3965 | (ad-activate 'make-auto-save-file-name))))) | ||
| 3966 | |||
| 3923 | (unless (tramp-exists-file-name-handler 'make-auto-save-file-name) | 3967 | (unless (tramp-exists-file-name-handler 'make-auto-save-file-name) |
| 3924 | (defadvice make-auto-save-file-name | 3968 | (defadvice make-auto-save-file-name |
| 3925 | (around tramp-advice-make-auto-save-file-name () activate) | 3969 | (around tramp-advice-make-auto-save-file-name () activate) |