diff options
| author | Michael Albinus | 2018-12-06 16:00:05 +0100 |
|---|---|---|
| committer | Michael Albinus | 2018-12-06 16:00:05 +0100 |
| commit | 66b49fc1d522b8d2cce7e957a5c6e7a4f6c90e0f (patch) | |
| tree | 7c00141c6ca665d20979c3dc5aa2136dbf2b731f /lisp | |
| parent | 8f3fde3884d818eb2eef39f8295c5884bc371cc4 (diff) | |
| download | emacs-66b49fc1d522b8d2cce7e957a5c6e7a4f6c90e0f.tar.gz emacs-66b49fc1d522b8d2cce7e957a5c6e7a4f6c90e0f.zip | |
Rework Tramp wrt string-match-p, looking-at-p, save-match-data
* lisp/net/tramp.el (tramp-find-method, tramp-find-user)
(tramp-find-host, tramp-dissect-file-name, tramp-make-tramp-file-name)
(tramp-completion-make-tramp-file-name, tramp-debug-message)
(tramp-message, tramp-progress-reporter-update)
(tramp-set-completion-function)
(tramp-rfn-eshadow-update-overlay)
(tramp-find-file-name-coding-system-alist)
(tramp-file-name-for-operation)
(tramp-use-absolute-autoload-file-names)
(tramp-get-completion-methods, tramp-get-completion-user-host)
(tramp-handle-directory-files)
(tramp-handle-file-name-case-insensitive-p)
(tramp-handle-file-name-completion, tramp-handle-file-truename)
(tramp-handle-insert-directory, tramp-handle-load)
(tramp-handle-shell-command, tramp-action-yesno)
(tramp-action-yn, tramp-process-actions)
(tramp-mode-string-to-int, tramp-get-local-locale)
(tramp-local-host-p):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-system-info)
(tramp-adb-handle-directory-files-and-attributes)
(tramp-adb--gnu-switches-to-ash, tramp-adb-sh-fix-ls-output)
(tramp-adb-handle-file-name-all-completions)
(tramp-adb-handle-shell-command)
(tramp-adb-handle-start-file-process):
* lisp/net/tramp-archive.el (tramp-archive-dissect-file-name):
* lisp/net/tramp-cache.el (tramp-get-hash-table)
(tramp-flush-directory-properties, tramp-flush-file-function):
* lisp/net/tramp-cmds.el (tramp-reporter-dump-variable)
(tramp-append-tramp-buffers):
* lisp/net/tramp-compat.el (tramp-compat-process-running-p):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-expand-file-name)
(tramp-gvfs-get-file-attributes)
(tramp-gvfs-handle-file-attributes)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-handler-mounted-unmounted)
(tramp-gvfs-connection-mounted-p, tramp-gvfs-mount-spec-entry)
(tramp-gvfs-mount-spec, tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-file-attributes-with-ls)
(tramp-do-file-attributes-with-stat)
(tramp-sh-handle-file-selinux-context)
(tramp-sh-handle-directory-files-and-attributes)
(tramp-do-directory-files-and-attributes-with-stat)
(tramp-sh-handle-file-name-all-completions)
(tramp-sh-handle-dired-compress-file)
(tramp-sh-handle-insert-directory)
(tramp-sh-handle-expand-file-name)
(tramp-sh-handle-start-file-process)
(tramp-sh-handle-process-file, tramp-sh-handle-write-region)
(tramp-sh-handle-file-notify-add-watch)
(tramp-sh-gio-monitor-process-filter)
(tramp-sh-gvfs-monitor-dir-process-filter)
(tramp-sh-inotifywait-process-filter)
(tramp-sh-handle-file-system-info, tramp-maybe-send-script)
(tramp-find-executable, tramp-open-shell, tramp-find-shell)
(tramp-open-connection-setup-interactive-shell)
(tramp-find-inline-encoding, tramp-call-local-coding-command)
(tramp-compute-multi-hops, tramp-maybe-open-connection)
(tramp-convert-file-attributes)
(tramp-make-copy-program-file-name, tramp-get-remote-locale)
(tramp-get-test-nt-command, tramp-get-remote-stat)
(tramp-get-inline-coding):
* lisp/net/tramp-smb.el (tramp-smb-handle-directory-files)
(tramp-smb-action-get-acl, tramp-smb-handle-file-attributes)
(tramp-smb-handle-file-name-all-completions)
(tramp-smb-handle-file-system-info)
(tramp-smb-handle-file-writable-p)
(tramp-smb-handle-insert-directory)
(tramp-smb-handle-make-directory)
(tramp-smb-handle-make-directory-internal)
(tramp-smb-handle-start-file-process, tramp-smb-get-localname)
(tramp-smb-read-file-entry): Use `string-match-p' and
`looking-at-p'. Remove superfluous `save-match-data'. Apply
`eval-when-compile' on constant concat data.
* lisp/net/tramp-compat.el (tramp-compat-file-name-quoted-p-p):
Use `string-prefix-p'.
(tramp-compat-file-name-unquote): Do not use match data.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/net/tramp-adb.el | 62 | ||||
| -rw-r--r-- | lisp/net/tramp-archive.el | 6 | ||||
| -rw-r--r-- | lisp/net/tramp-cache.el | 8 | ||||
| -rw-r--r-- | lisp/net/tramp-cmds.el | 15 | ||||
| -rw-r--r-- | lisp/net/tramp-compat.el | 17 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 52 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 662 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 102 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 284 |
9 files changed, 610 insertions, 598 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index d0cead2b887..76bcdf09419 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -259,10 +259,11 @@ pass to the OPERATION." | |||
| 259 | (goto-char (point-min)) | 259 | (goto-char (point-min)) |
| 260 | (forward-line) | 260 | (forward-line) |
| 261 | (when (looking-at | 261 | (when (looking-at |
| 262 | (concat "[[:space:]]*[^[:space:]]+" | 262 | (eval-when-compile |
| 263 | "[[:space:]]+\\([[:digit:]]+\\)" | 263 | (concat "[[:space:]]*[^[:space:]]+" |
| 264 | "[[:space:]]+\\([[:digit:]]+\\)" | 264 | "[[:space:]]+\\([[:digit:]]+\\)" |
| 265 | "[[:space:]]+\\([[:digit:]]+\\)")) | 265 | "[[:space:]]+\\([[:digit:]]+\\)" |
| 266 | "[[:space:]]+\\([[:digit:]]+\\)"))) | ||
| 266 | ;; The values are given as 1k numbers, so we must change | 267 | ;; The values are given as 1k numbers, so we must change |
| 267 | ;; them to number of bytes. | 268 | ;; them to number of bytes. |
| 268 | (list (* 1024 (string-to-number (match-string 1))) | 269 | (list (* 1024 (string-to-number (match-string 1))) |
| @@ -462,7 +463,7 @@ pass to the OPERATION." | |||
| 462 | (sort result (lambda (x y) (string< (car x) (car y)))))) | 463 | (sort result (lambda (x y) (string< (car x) (car y)))))) |
| 463 | (delq nil | 464 | (delq nil |
| 464 | (mapcar (lambda (x) | 465 | (mapcar (lambda (x) |
| 465 | (if (or (not match) (string-match match (car x))) | 466 | (if (or (not match) (string-match-p match (car x))) |
| 466 | x)) | 467 | x)) |
| 467 | result))))))))) | 468 | result))))))))) |
| 468 | 469 | ||
| @@ -499,7 +500,7 @@ Convert (\"-al\") to (\"-a\" \"-l\"). Remove arguments like \"--dired\"." | |||
| 499 | (delq nil | 500 | (delq nil |
| 500 | (mapcar | 501 | (mapcar |
| 501 | (lambda (s) | 502 | (lambda (s) |
| 502 | (and (not (string-match "\\(^--\\|^[^-]\\)" s)) s)) | 503 | (and (not (string-match-p "\\(^--\\|^[^-]\\)" s)) s)) |
| 503 | switches)))))) | 504 | switches)))))) |
| 504 | 505 | ||
| 505 | (defun tramp-adb-sh-fix-ls-output (&optional sort-by-time) | 506 | (defun tramp-adb-sh-fix-ls-output (&optional sort-by-time) |
| @@ -514,7 +515,7 @@ Emacs dired can't find files." | |||
| 514 | "[[:space:]]\\([[:space:]][0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9][[:space:]]\\)" nil t) | 515 | "[[:space:]]\\([[:space:]][0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9][[:space:]]\\)" nil t) |
| 515 | (replace-match "0\\1" "\\1" nil) | 516 | (replace-match "0\\1" "\\1" nil) |
| 516 | ;; Insert missing "/". | 517 | ;; Insert missing "/". |
| 517 | (when (looking-at "[0-9][0-9]:[0-9][0-9][[:space:]]+$") | 518 | (when (looking-at-p "[0-9][0-9]:[0-9][0-9][[:space:]]+$") |
| 518 | (end-of-line) | 519 | (end-of-line) |
| 519 | (insert "/"))) | 520 | (insert "/"))) |
| 520 | ;; Sort entries. | 521 | ;; Sort entries. |
| @@ -594,28 +595,27 @@ Emacs dired can't find files." | |||
| 594 | filename | 595 | filename |
| 595 | (with-parsed-tramp-file-name (expand-file-name directory) nil | 596 | (with-parsed-tramp-file-name (expand-file-name directory) nil |
| 596 | (with-tramp-file-property v localname "file-name-all-completions" | 597 | (with-tramp-file-property v localname "file-name-all-completions" |
| 597 | (save-match-data | 598 | (tramp-adb-send-command |
| 598 | (tramp-adb-send-command | 599 | v (format "%s -a %s" |
| 599 | v (format "%s -a %s" | 600 | (tramp-adb-get-ls-command v) |
| 600 | (tramp-adb-get-ls-command v) | 601 | (tramp-shell-quote-argument localname))) |
| 601 | (tramp-shell-quote-argument localname))) | 602 | (mapcar |
| 602 | (mapcar | 603 | (lambda (f) |
| 603 | (lambda (f) | 604 | (if (file-directory-p (expand-file-name f directory)) |
| 604 | (if (file-directory-p (expand-file-name f directory)) | 605 | (file-name-as-directory f) |
| 605 | (file-name-as-directory f) | 606 | f)) |
| 606 | f)) | 607 | (with-current-buffer (tramp-get-buffer v) |
| 607 | (with-current-buffer (tramp-get-buffer v) | 608 | (delete-dups |
| 608 | (delete-dups | 609 | (append |
| 609 | (append | 610 | ;; In older Android versions, "." and ".." are not |
| 610 | ;; In older Android versions, "." and ".." are not | 611 | ;; included. In newer versions (toybox, since Android 6) |
| 611 | ;; included. In newer versions (toybox, since Android | 612 | ;; they are. We fix this by `delete-dups'. |
| 612 | ;; 6) they are. We fix this by `delete-dups'. | 613 | '("." "..") |
| 613 | '("." "..") | 614 | (delq |
| 614 | (delq | 615 | nil |
| 615 | nil | 616 | (mapcar |
| 616 | (mapcar | 617 | (lambda (l) (and (not (string-match-p "^[[:space:]]*$" l)) l)) |
| 617 | (lambda (l) (and (not (string-match "^[[:space:]]*$" l)) l)) | 618 | (split-string (buffer-string) "\n"))))))))))) |
| 618 | (split-string (buffer-string) "\n")))))))))))) | ||
| 619 | 619 | ||
| 620 | (defun tramp-adb-handle-file-local-copy (filename) | 620 | (defun tramp-adb-handle-file-local-copy (filename) |
| 621 | "Like `file-local-copy' for Tramp files." | 621 | "Like `file-local-copy' for Tramp files." |
| @@ -967,7 +967,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 967 | (defun tramp-adb-handle-shell-command | 967 | (defun tramp-adb-handle-shell-command |
| 968 | (command &optional output-buffer error-buffer) | 968 | (command &optional output-buffer error-buffer) |
| 969 | "Like `shell-command' for Tramp files." | 969 | "Like `shell-command' for Tramp files." |
| 970 | (let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command)) | 970 | (let* ((asynchronous (string-match-p "[ \t]*&[ \t]*\\'" command)) |
| 971 | ;; We cannot use `shell-file-name' and `shell-command-switch', | 971 | ;; We cannot use `shell-file-name' and `shell-command-switch', |
| 972 | ;; they are variables of the local host. | 972 | ;; they are variables of the local host. |
| 973 | (args (list "sh" "-c" (substring command 0 asynchronous))) | 973 | (args (list "sh" "-c" (substring command 0 asynchronous))) |
| @@ -1111,7 +1111,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 1111 | p)))) | 1111 | p)))) |
| 1112 | 1112 | ||
| 1113 | ;; Save exit. | 1113 | ;; Save exit. |
| 1114 | (if (string-match tramp-temp-buffer-name (buffer-name)) | 1114 | (if (string-match-p tramp-temp-buffer-name (buffer-name)) |
| 1115 | (ignore-errors | 1115 | (ignore-errors |
| 1116 | (set-process-buffer (tramp-get-connection-process v) nil) | 1116 | (set-process-buffer (tramp-get-connection-process v) nil) |
| 1117 | (kill-buffer (current-buffer))) | 1117 | (kill-buffer (current-buffer))) |
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index 4c9439102ae..cb072ac720f 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el | |||
| @@ -378,6 +378,7 @@ pass to the OPERATION." | |||
| 378 | (defun tramp-archive-file-name-p (name) | 378 | (defun tramp-archive-file-name-p (name) |
| 379 | "Return t if NAME is a string with archive file name syntax." | 379 | "Return t if NAME is a string with archive file name syntax." |
| 380 | (and (stringp name) | 380 | (and (stringp name) |
| 381 | ;; We cannot use `string-match-p', the matches are used. | ||
| 381 | (string-match tramp-archive-file-name-regexp name) | 382 | (string-match tramp-archive-file-name-regexp name) |
| 382 | t)) | 383 | t)) |
| 383 | 384 | ||
| @@ -430,8 +431,9 @@ name is kept in slot `hop'" | |||
| 430 | ;; http://... | 431 | ;; http://... |
| 431 | ((and url-handler-mode | 432 | ((and url-handler-mode |
| 432 | tramp-compat-use-url-tramp-p | 433 | tramp-compat-use-url-tramp-p |
| 433 | (string-match url-handler-regexp archive) | 434 | (string-match-p url-handler-regexp archive) |
| 434 | (string-match "https?" (url-type (url-generic-parse-url archive)))) | 435 | (string-match-p |
| 436 | "https?" (url-type (url-generic-parse-url archive)))) | ||
| 435 | (let* ((url-tramp-protocols | 437 | (let* ((url-tramp-protocols |
| 436 | (cons | 438 | (cons |
| 437 | (url-type (url-generic-parse-url archive)) | 439 | (url-type (url-generic-parse-url archive)) |
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 51a8f13c4a4..0a799d721d6 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el | |||
| @@ -104,7 +104,7 @@ matching entries of `tramp-connection-properties'." | |||
| 104 | (puthash key (make-hash-table :test 'equal) tramp-cache-data))) | 104 | (puthash key (make-hash-table :test 'equal) tramp-cache-data))) |
| 105 | (when (tramp-file-name-p key) | 105 | (when (tramp-file-name-p key) |
| 106 | (dolist (elt tramp-connection-properties) | 106 | (dolist (elt tramp-connection-properties) |
| 107 | (when (string-match | 107 | (when (string-match-p |
| 108 | (or (nth 0 elt) "") | 108 | (or (nth 0 elt) "") |
| 109 | (tramp-make-tramp-file-name key 'noloc 'nohop)) | 109 | (tramp-make-tramp-file-name key 'noloc 'nohop)) |
| 110 | (tramp-set-connection-property key (nth 1 elt) (nth 2 elt))))) | 110 | (tramp-set-connection-property key (nth 1 elt) (nth 2 elt))))) |
| @@ -217,8 +217,8 @@ Remove also properties of all files in subdirectories." | |||
| 217 | (lambda (key _value) | 217 | (lambda (key _value) |
| 218 | (when (and (tramp-file-name-p key) | 218 | (when (and (tramp-file-name-p key) |
| 219 | (stringp (tramp-file-name-localname key)) | 219 | (stringp (tramp-file-name-localname key)) |
| 220 | (string-match (regexp-quote directory) | 220 | (string-match-p (regexp-quote directory) |
| 221 | (tramp-file-name-localname key))) | 221 | (tramp-file-name-localname key))) |
| 222 | (remhash key tramp-cache-data))) | 222 | (remhash key tramp-cache-data))) |
| 223 | tramp-cache-data) | 223 | tramp-cache-data) |
| 224 | ;; Remove file properties of symlinks. | 224 | ;; Remove file properties of symlinks. |
| @@ -236,7 +236,7 @@ Remove also properties of all files in subdirectories." | |||
| 236 | This is suppressed for temporary buffers." | 236 | This is suppressed for temporary buffers." |
| 237 | (save-match-data | 237 | (save-match-data |
| 238 | (unless (or (null (buffer-name)) | 238 | (unless (or (null (buffer-name)) |
| 239 | (string-match "^\\( \\|\\*\\)" (buffer-name))) | 239 | (string-match-p "^\\( \\|\\*\\)" (buffer-name))) |
| 240 | (let ((bfn (if (stringp (buffer-file-name)) | 240 | (let ((bfn (if (stringp (buffer-file-name)) |
| 241 | (buffer-file-name) | 241 | (buffer-file-name) |
| 242 | default-directory)) | 242 | default-directory)) |
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 3c8f182ae97..b886223c95c 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el | |||
| @@ -261,7 +261,7 @@ buffer in your bug report. | |||
| 261 | (set varsym (read (format "(%s)" (tramp-cache-print val)))) | 261 | (set varsym (read (format "(%s)" (tramp-cache-print val)))) |
| 262 | ;; There are non-7bit characters to be masked. | 262 | ;; There are non-7bit characters to be masked. |
| 263 | (when (and (stringp val) | 263 | (when (and (stringp val) |
| 264 | (string-match | 264 | (string-match-p |
| 265 | (concat "[^" (bound-and-true-p mm-7bit-chars) "]") val)) | 265 | (concat "[^" (bound-and-true-p mm-7bit-chars) "]") val)) |
| 266 | (with-current-buffer reporter-eval-buffer | 266 | (with-current-buffer reporter-eval-buffer |
| 267 | (set | 267 | (set |
| @@ -277,10 +277,11 @@ buffer in your bug report. | |||
| 277 | ;; Remove string quotation. | 277 | ;; Remove string quotation. |
| 278 | (forward-line -1) | 278 | (forward-line -1) |
| 279 | (when (looking-at | 279 | (when (looking-at |
| 280 | (concat "\\(^.*\\)" "\"" ;; \1 " | 280 | (eval-when-compile |
| 281 | "\\((base64-decode-string \\)" "\\\\" ;; \2 \ | 281 | (concat "\\(^.*\\)" "\"" ;; \1 " |
| 282 | "\\(\".*\\)" "\\\\" ;; \3 \ | 282 | "\\((base64-decode-string \\)" "\\\\" ;; \2 \ |
| 283 | "\\(\")\\)" "\"$")) ;; \4 " | 283 | "\\(\".*\\)" "\\\\" ;; \3 \ |
| 284 | "\\(\")\\)" "\"$"))) ;; \4 " | ||
| 284 | (replace-match "\\1\\2\\3\\4") | 285 | (replace-match "\\1\\2\\3\\4") |
| 285 | (beginning-of-line) | 286 | (beginning-of-line) |
| 286 | (insert " ;; Variable encoded due to non-printable characters.\n")) | 287 | (insert " ;; Variable encoded due to non-printable characters.\n")) |
| @@ -305,7 +306,7 @@ buffer in your bug report. | |||
| 305 | (delq nil | 306 | (delq nil |
| 306 | (mapcar | 307 | (mapcar |
| 307 | (lambda (b) | 308 | (lambda (b) |
| 308 | (when (string-match "\\*tramp/" (buffer-name b)) b)) | 309 | (when (string-match-p "\\*tramp/" (buffer-name b)) b)) |
| 309 | (buffer-list)))) | 310 | (buffer-list)))) |
| 310 | (let ((reporter-eval-buffer buffer) | 311 | (let ((reporter-eval-buffer buffer) |
| 311 | (elbuf (get-buffer-create " *tmp-reporter-buffer*"))) | 312 | (elbuf (get-buffer-create " *tmp-reporter-buffer*"))) |
| @@ -333,7 +334,7 @@ buffer in your bug report. | |||
| 333 | (insert "\nload-path shadows:\n==================\n") | 334 | (insert "\nload-path shadows:\n==================\n") |
| 334 | (ignore-errors | 335 | (ignore-errors |
| 335 | (mapc | 336 | (mapc |
| 336 | (lambda (x) (when (string-match "tramp" x) (insert x "\n"))) | 337 | (lambda (x) (when (string-match-p "tramp" x) (insert x "\n"))) |
| 337 | (split-string (list-load-path-shadows t) "\n"))) | 338 | (split-string (list-load-path-shadows t) "\n"))) |
| 338 | 339 | ||
| 339 | ;; Append buffers only when we are in message mode. | 340 | ;; Append buffers only when we are in message mode. |
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 4db45f3c403..9e02ebb24dd 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -97,7 +97,7 @@ Add the extension of F, if existing." | |||
| 97 | ;; The returned command name could be truncated | 97 | ;; The returned command name could be truncated |
| 98 | ;; to 15 characters. Therefore, we cannot check | 98 | ;; to 15 characters. Therefore, we cannot check |
| 99 | ;; for `string-equal'. | 99 | ;; for `string-equal'. |
| 100 | (and comm (string-match | 100 | (and comm (string-match-p |
| 101 | (concat "^" (regexp-quote comm)) | 101 | (concat "^" (regexp-quote comm)) |
| 102 | process-name)))) | 102 | process-name)))) |
| 103 | (setq result t))))))))) | 103 | (setq result t))))))))) |
| @@ -195,7 +195,7 @@ This is a string of ten letters or dashes as in ls -l." | |||
| 195 | (defsubst tramp-compat-file-name-quoted-p (name) | 195 | (defsubst tramp-compat-file-name-quoted-p (name) |
| 196 | "Whether NAME is quoted with prefix \"/:\". | 196 | "Whether NAME is quoted with prefix \"/:\". |
| 197 | If NAME is a remote file name, check the local part of NAME." | 197 | If NAME is a remote file name, check the local part of NAME." |
| 198 | (string-match "^/:" (or (file-remote-p name 'localname) name)))) | 198 | (string-prefix-p "/:" (or (file-remote-p name 'localname) name)))) |
| 199 | 199 | ||
| 200 | (if (fboundp 'file-name-quote) | 200 | (if (fboundp 'file-name-quote) |
| 201 | (defalias 'tramp-compat-file-name-quote 'file-name-quote) | 201 | (defalias 'tramp-compat-file-name-quote 'file-name-quote) |
| @@ -212,14 +212,11 @@ If NAME is a remote file name, the local part of NAME is quoted." | |||
| 212 | (defsubst tramp-compat-file-name-unquote (name) | 212 | (defsubst tramp-compat-file-name-unquote (name) |
| 213 | "Remove quotation prefix \"/:\" from file NAME. | 213 | "Remove quotation prefix \"/:\" from file NAME. |
| 214 | If NAME is a remote file name, the local part of NAME is unquoted." | 214 | If NAME is a remote file name, the local part of NAME is unquoted." |
| 215 | (save-match-data | 215 | (let ((localname (or (file-remote-p name 'localname) name))) |
| 216 | (let ((localname (or (file-remote-p name 'localname) name))) | 216 | (when (tramp-compat-file-name-quoted-p localname) |
| 217 | (when (tramp-compat-file-name-quoted-p localname) | 217 | (setq |
| 218 | (setq | 218 | localname (if (= (length localname) 2) "/" (substring localname 2)))) |
| 219 | localname | 219 | (concat (file-remote-p name) localname))))) |
| 220 | (replace-match | ||
| 221 | (if (= (length localname) 2) "/" "") nil t localname))) | ||
| 222 | (concat (file-remote-p name) localname)))))) | ||
| 223 | 220 | ||
| 224 | ;; `tramp-syntax' has changed its meaning in Emacs 26. We still | 221 | ;; `tramp-syntax' has changed its meaning in Emacs 26. We still |
| 225 | ;; support old settings. | 222 | ;; support old settings. |
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 76747f7c993..82118724716 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -899,14 +899,14 @@ file names." | |||
| 899 | (tramp-get-connection-property v "default-location" "~") | 899 | (tramp-get-connection-property v "default-location" "~") |
| 900 | nil t localname 1))) | 900 | nil t localname 1))) |
| 901 | ;; Tilde expansion is not possible. | 901 | ;; Tilde expansion is not possible. |
| 902 | (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname) | 902 | (when (string-match-p "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname) |
| 903 | (tramp-error | 903 | (tramp-error |
| 904 | v 'file-error | 904 | v 'file-error |
| 905 | "Cannot expand tilde in file `%s'" name)) | 905 | "Cannot expand tilde in file `%s'" name)) |
| 906 | (unless (tramp-run-real-handler 'file-name-absolute-p (list localname)) | 906 | (unless (tramp-run-real-handler 'file-name-absolute-p (list localname)) |
| 907 | (setq localname (concat "/" localname))) | 907 | (setq localname (concat "/" localname))) |
| 908 | ;; We do not pass "/..". | 908 | ;; We do not pass "/..". |
| 909 | (if (string-match "^\\(afp\\|davs?\\|smb\\)$" method) | 909 | (if (string-match-p "^\\(afp\\|davs?\\|smb\\)$" method) |
| 910 | (when (string-match "^/[^/]+\\(/\\.\\./?\\)" localname) | 910 | (when (string-match "^/[^/]+\\(/\\.\\./?\\)" localname) |
| 911 | (setq localname (replace-match "/" t t localname 1))) | 911 | (setq localname (replace-match "/" t t localname 1))) |
| 912 | (when (string-match "^/\\.\\./?" localname) | 912 | (when (string-match "^/\\.\\./?" localname) |
| @@ -997,8 +997,8 @@ If FILE-SYSTEM is non-nil, return file system attributes." | |||
| 997 | (setq filename (directory-file-name (expand-file-name filename))) | 997 | (setq filename (directory-file-name (expand-file-name filename))) |
| 998 | (with-parsed-tramp-file-name filename nil | 998 | (with-parsed-tramp-file-name filename nil |
| 999 | (setq localname (tramp-compat-file-name-unquote localname)) | 999 | (setq localname (tramp-compat-file-name-unquote localname)) |
| 1000 | (if (or (and (string-match "^\\(afp\\|davs?\\|smb\\)$" method) | 1000 | (if (or (and (string-match-p "^\\(afp\\|davs?\\|smb\\)$" method) |
| 1001 | (string-match "^/?\\([^/]+\\)$" localname)) | 1001 | (string-match-p "^/?\\([^/]+\\)$" localname)) |
| 1002 | (string-equal localname "/")) | 1002 | (string-equal localname "/")) |
| 1003 | (tramp-gvfs-get-root-attributes filename) | 1003 | (tramp-gvfs-get-root-attributes filename) |
| 1004 | (assoc | 1004 | (assoc |
| @@ -1038,7 +1038,8 @@ If FILE-SYSTEM is non-nil, return file system attributes." | |||
| 1038 | (if (eq id-format 'integer) | 1038 | (if (eq id-format 'integer) |
| 1039 | (string-to-number | 1039 | (string-to-number |
| 1040 | (or (cdr (assoc "unix::uid" attributes)) | 1040 | (or (cdr (assoc "unix::uid" attributes)) |
| 1041 | (format "%s" tramp-unknown-id-integer))) | 1041 | (eval-when-compile |
| 1042 | (format "%s" tramp-unknown-id-integer)))) | ||
| 1042 | (or (cdr (assoc "owner::user" attributes)) | 1043 | (or (cdr (assoc "owner::user" attributes)) |
| 1043 | (cdr (assoc "unix::uid" attributes)) | 1044 | (cdr (assoc "unix::uid" attributes)) |
| 1044 | tramp-unknown-id-string))) | 1045 | tramp-unknown-id-string))) |
| @@ -1046,7 +1047,8 @@ If FILE-SYSTEM is non-nil, return file system attributes." | |||
| 1046 | (if (eq id-format 'integer) | 1047 | (if (eq id-format 'integer) |
| 1047 | (string-to-number | 1048 | (string-to-number |
| 1048 | (or (cdr (assoc "unix::gid" attributes)) | 1049 | (or (cdr (assoc "unix::gid" attributes)) |
| 1049 | (format "%s" tramp-unknown-id-integer))) | 1050 | (eval-when-compile |
| 1051 | (format "%s" tramp-unknown-id-integer)))) | ||
| 1050 | (or (cdr (assoc "owner::group" attributes)) | 1052 | (or (cdr (assoc "owner::group" attributes)) |
| 1051 | (cdr (assoc "unix::gid" attributes)) | 1053 | (cdr (assoc "unix::gid" attributes)) |
| 1052 | tramp-unknown-id-string))) | 1054 | tramp-unknown-id-string))) |
| @@ -1216,14 +1218,16 @@ file-notify events." | |||
| 1216 | string (replace-regexp-in-string | 1218 | string (replace-regexp-in-string |
| 1217 | "renamed to" "moved" string)) | 1219 | "renamed to" "moved" string)) |
| 1218 | ;; https://bugs.launchpad.net/bugs/1742946 | 1220 | ;; https://bugs.launchpad.net/bugs/1742946 |
| 1219 | (when (string-match "Monitoring not supported\\|No locations given" string) | 1221 | (when |
| 1222 | (string-match-p "Monitoring not supported\\|No locations given" string) | ||
| 1220 | (delete-process proc)) | 1223 | (delete-process proc)) |
| 1221 | 1224 | ||
| 1222 | (while (string-match | 1225 | (while (string-match |
| 1223 | (concat "^.+:" | 1226 | (eval-when-compile |
| 1224 | "[[:space:]]\\(.+\\):" | 1227 | (concat "^.+:" |
| 1225 | "[[:space:]]" (regexp-opt tramp-gio-events t) | 1228 | "[[:space:]]\\(.+\\):" |
| 1226 | "\\([[:space:]]\\(.+\\)\\)?$") | 1229 | "[[:space:]]" (regexp-opt tramp-gio-events t) |
| 1230 | "\\([[:space:]]\\(.+\\)\\)?$")) | ||
| 1227 | string) | 1231 | string) |
| 1228 | 1232 | ||
| 1229 | (let ((file (match-string 1 string)) | 1233 | (let ((file (match-string 1 string)) |
| @@ -1233,11 +1237,11 @@ file-notify events." | |||
| 1233 | ;; File names are returned as URL paths. We must convert them. | 1237 | ;; File names are returned as URL paths. We must convert them. |
| 1234 | (when (string-match ddu file) | 1238 | (when (string-match ddu file) |
| 1235 | (setq file (replace-match dd nil nil file))) | 1239 | (setq file (replace-match dd nil nil file))) |
| 1236 | (while (string-match "%\\([0-9A-F]\\{2\\}\\)" file) | 1240 | (while (string-match-p "%\\([0-9A-F]\\{2\\}\\)" file) |
| 1237 | (setq file (url-unhex-string file))) | 1241 | (setq file (url-unhex-string file))) |
| 1238 | (when (string-match ddu (or file1 "")) | 1242 | (when (string-match ddu (or file1 "")) |
| 1239 | (setq file1 (replace-match dd nil nil file1))) | 1243 | (setq file1 (replace-match dd nil nil file1))) |
| 1240 | (while (string-match "%\\([0-9A-F]\\{2\\}\\)" (or file1 "")) | 1244 | (while (string-match-p "%\\([0-9A-F]\\{2\\}\\)" (or file1 "")) |
| 1241 | (setq file1 (url-unhex-string file1))) | 1245 | (setq file1 (url-unhex-string file1))) |
| 1242 | ;; Remove watch when file or directory to be watched is deleted. | 1246 | ;; Remove watch when file or directory to be watched is deleted. |
| 1243 | (when (and (member action '(moved deleted)) | 1247 | (when (and (member action '(moved deleted)) |
| @@ -1540,7 +1544,7 @@ file-notify events." | |||
| 1540 | (when (and (string-equal "dav" method) (string-equal "true" ssl)) | 1544 | (when (and (string-equal "dav" method) (string-equal "true" ssl)) |
| 1541 | (setq method "davs")) | 1545 | (setq method "davs")) |
| 1542 | (when (and (string-equal "davs" method) | 1546 | (when (and (string-equal "davs" method) |
| 1543 | (string-match | 1547 | (string-match-p |
| 1544 | tramp-gvfs-nextcloud-default-prefix-regexp prefix)) | 1548 | tramp-gvfs-nextcloud-default-prefix-regexp prefix)) |
| 1545 | (setq method "nextcloud")) | 1549 | (setq method "nextcloud")) |
| 1546 | (when (string-equal "google-drive" method) | 1550 | (when (string-equal "google-drive" method) |
| @@ -1630,7 +1634,7 @@ file-notify events." | |||
| 1630 | (when (and (string-equal "dav" method) (string-equal "true" ssl)) | 1634 | (when (and (string-equal "dav" method) (string-equal "true" ssl)) |
| 1631 | (setq method "davs")) | 1635 | (setq method "davs")) |
| 1632 | (when (and (string-equal "davs" method) | 1636 | (when (and (string-equal "davs" method) |
| 1633 | (string-match | 1637 | (string-match-p |
| 1634 | tramp-gvfs-nextcloud-default-prefix-regexp prefix)) | 1638 | tramp-gvfs-nextcloud-default-prefix-regexp prefix)) |
| 1635 | (setq method "nextcloud")) | 1639 | (setq method "nextcloud")) |
| 1636 | (when (string-equal "google-drive" method) | 1640 | (when (string-equal "google-drive" method) |
| @@ -1647,8 +1651,8 @@ file-notify events." | |||
| 1647 | (string-equal domain (tramp-file-name-domain vec)) | 1651 | (string-equal domain (tramp-file-name-domain vec)) |
| 1648 | (string-equal host (tramp-file-name-host vec)) | 1652 | (string-equal host (tramp-file-name-host vec)) |
| 1649 | (string-equal port (tramp-file-name-port vec)) | 1653 | (string-equal port (tramp-file-name-port vec)) |
| 1650 | (string-match (concat "^/" (regexp-quote (or share ""))) | 1654 | (string-match-p (concat "^/" (regexp-quote (or share ""))) |
| 1651 | (tramp-file-name-unquote-localname vec))) | 1655 | (tramp-file-name-unquote-localname vec))) |
| 1652 | ;; Set mountpoint and location. | 1656 | ;; Set mountpoint and location. |
| 1653 | (tramp-set-file-property vec "/" "fuse-mountpoint" fuse-mountpoint) | 1657 | (tramp-set-file-property vec "/" "fuse-mountpoint" fuse-mountpoint) |
| 1654 | (tramp-set-connection-property | 1658 | (tramp-set-connection-property |
| @@ -1671,7 +1675,7 @@ file-notify events." | |||
| 1671 | (defun tramp-gvfs-mount-spec-entry (key value) | 1675 | (defun tramp-gvfs-mount-spec-entry (key value) |
| 1672 | "Construct a mount-spec entry to be used in a mount_spec. | 1676 | "Construct a mount-spec entry to be used in a mount_spec. |
| 1673 | It was \"a(say)\", but has changed to \"a{sv})\"." | 1677 | It was \"a(say)\", but has changed to \"a{sv})\"." |
| 1674 | (if (string-match "^(aya{sv})" tramp-gvfs-mountlocation-signature) | 1678 | (if (string-match-p "^(aya{sv})" tramp-gvfs-mountlocation-signature) |
| 1675 | (list :dict-entry key | 1679 | (list :dict-entry key |
| 1676 | (list :variant (tramp-gvfs-dbus-string-to-byte-array value))) | 1680 | (list :variant (tramp-gvfs-dbus-string-to-byte-array value))) |
| 1677 | (list :struct key (tramp-gvfs-dbus-string-to-byte-array value)))) | 1681 | (list :struct key (tramp-gvfs-dbus-string-to-byte-array value)))) |
| @@ -1686,7 +1690,7 @@ It was \"a(say)\", but has changed to \"a{sv})\"." | |||
| 1686 | (localname (tramp-file-name-unquote-localname vec)) | 1690 | (localname (tramp-file-name-unquote-localname vec)) |
| 1687 | (share (when (string-match "^/?\\([^/]+\\)" localname) | 1691 | (share (when (string-match "^/?\\([^/]+\\)" localname) |
| 1688 | (match-string 1 localname))) | 1692 | (match-string 1 localname))) |
| 1689 | (ssl (if (string-match "^davs\\|^nextcloud" method) "true" "false")) | 1693 | (ssl (if (string-match-p "^davs\\|^nextcloud" method) "true" "false")) |
| 1690 | (mount-spec | 1694 | (mount-spec |
| 1691 | `(:array | 1695 | `(:array |
| 1692 | ,@(cond | 1696 | ,@(cond |
| @@ -1694,7 +1698,7 @@ It was \"a(say)\", but has changed to \"a{sv})\"." | |||
| 1694 | (list (tramp-gvfs-mount-spec-entry "type" "smb-share") | 1698 | (list (tramp-gvfs-mount-spec-entry "type" "smb-share") |
| 1695 | (tramp-gvfs-mount-spec-entry "server" host) | 1699 | (tramp-gvfs-mount-spec-entry "server" host) |
| 1696 | (tramp-gvfs-mount-spec-entry "share" share))) | 1700 | (tramp-gvfs-mount-spec-entry "share" share))) |
| 1697 | ((string-match "^dav\\|^nextcloud" method) | 1701 | ((string-match-p "^dav\\|^nextcloud" method) |
| 1698 | (list (tramp-gvfs-mount-spec-entry "type" "dav") | 1702 | (list (tramp-gvfs-mount-spec-entry "type" "dav") |
| 1699 | (tramp-gvfs-mount-spec-entry "host" host) | 1703 | (tramp-gvfs-mount-spec-entry "host" host) |
| 1700 | (tramp-gvfs-mount-spec-entry "ssl" ssl))) | 1704 | (tramp-gvfs-mount-spec-entry "ssl" ssl))) |
| @@ -1708,7 +1712,7 @@ It was \"a(say)\", but has changed to \"a{sv})\"." | |||
| 1708 | ((string-equal "nextcloud" method) | 1712 | ((string-equal "nextcloud" method) |
| 1709 | (list (tramp-gvfs-mount-spec-entry "type" "owncloud") | 1713 | (list (tramp-gvfs-mount-spec-entry "type" "owncloud") |
| 1710 | (tramp-gvfs-mount-spec-entry "host" host))) | 1714 | (tramp-gvfs-mount-spec-entry "host" host))) |
| 1711 | ((string-match "^http" method) | 1715 | ((string-match-p "^http" method) |
| 1712 | (list (tramp-gvfs-mount-spec-entry "type" "http") | 1716 | (list (tramp-gvfs-mount-spec-entry "type" "http") |
| 1713 | (tramp-gvfs-mount-spec-entry | 1717 | (tramp-gvfs-mount-spec-entry |
| 1714 | "uri" | 1718 | "uri" |
| @@ -1725,7 +1729,7 @@ It was \"a(say)\", but has changed to \"a{sv})\"." | |||
| 1725 | ,@(when port | 1729 | ,@(when port |
| 1726 | (list (tramp-gvfs-mount-spec-entry "port" port))))) | 1730 | (list (tramp-gvfs-mount-spec-entry "port" port))))) |
| 1727 | (mount-pref | 1731 | (mount-pref |
| 1728 | (if (and (string-match "^dav" method) | 1732 | (if (and (string-match-p "^dav" method) |
| 1729 | (string-match "^/?[^/]+" localname)) | 1733 | (string-match "^/?[^/]+" localname)) |
| 1730 | (match-string 0 localname) | 1734 | (match-string 0 localname) |
| 1731 | (tramp-gvfs-get-remote-prefix vec)))) | 1735 | (tramp-gvfs-get-remote-prefix vec)))) |
| @@ -1815,7 +1819,7 @@ connection if a previous connection has died for some reason." | |||
| 1815 | (string-equal localname "/")) | 1819 | (string-equal localname "/")) |
| 1816 | (tramp-error vec 'file-error "Filename must contain an AFP volume")) | 1820 | (tramp-error vec 'file-error "Filename must contain an AFP volume")) |
| 1817 | 1821 | ||
| 1818 | (when (and (string-match method "davs?") | 1822 | (when (and (string-match-p "davs?" method) |
| 1819 | (string-equal localname "/")) | 1823 | (string-equal localname "/")) |
| 1820 | (tramp-error vec 'file-error "Filename must contain a WebDAV share")) | 1824 | (tramp-error vec 'file-error "Filename must contain a WebDAV share")) |
| 1821 | 1825 | ||
| @@ -1856,7 +1860,7 @@ connection if a previous connection has died for some reason." | |||
| 1856 | 1860 | ||
| 1857 | ;; The call must be asynchronously, because of the "askPassword" | 1861 | ;; The call must be asynchronously, because of the "askPassword" |
| 1858 | ;; or "askQuestion" callbacks. | 1862 | ;; or "askQuestion" callbacks. |
| 1859 | (if (string-match "(so)$" tramp-gvfs-mountlocation-signature) | 1863 | (if (string-match-p "(so)$" tramp-gvfs-mountlocation-signature) |
| 1860 | (with-tramp-dbus-call-method vec nil | 1864 | (with-tramp-dbus-call-method vec nil |
| 1861 | :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker | 1865 | :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker |
| 1862 | tramp-gvfs-interface-mounttracker tramp-gvfs-mountlocation | 1866 | tramp-gvfs-interface-mounttracker tramp-gvfs-mountlocation |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 900b4b3c277..3f426bb0405 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -1257,18 +1257,17 @@ component is used as the target of the symlink." | |||
| 1257 | (with-parsed-tramp-file-name (expand-file-name filename) nil | 1257 | (with-parsed-tramp-file-name (expand-file-name filename) nil |
| 1258 | (with-tramp-file-property | 1258 | (with-tramp-file-property |
| 1259 | v localname (format "file-attributes-%s" id-format) | 1259 | v localname (format "file-attributes-%s" id-format) |
| 1260 | (save-excursion | 1260 | (tramp-convert-file-attributes |
| 1261 | (tramp-convert-file-attributes | 1261 | v |
| 1262 | v | 1262 | (or |
| 1263 | (or | 1263 | (cond |
| 1264 | (cond | 1264 | ((tramp-get-remote-stat v) |
| 1265 | ((tramp-get-remote-stat v) | 1265 | (tramp-do-file-attributes-with-stat v localname id-format)) |
| 1266 | (tramp-do-file-attributes-with-stat v localname id-format)) | 1266 | ((tramp-get-remote-perl v) |
| 1267 | ((tramp-get-remote-perl v) | 1267 | (tramp-do-file-attributes-with-perl v localname id-format)) |
| 1268 | (tramp-do-file-attributes-with-perl v localname id-format)) | 1268 | (t nil)) |
| 1269 | (t nil)) | 1269 | ;; The scripts could fail, for example with huge file size. |
| 1270 | ;; The scripts could fail, for example with huge file size. | 1270 | (tramp-do-file-attributes-with-ls v localname id-format)))))))) |
| 1271 | (tramp-do-file-attributes-with-ls v localname id-format))))))))) | ||
| 1272 | 1271 | ||
| 1273 | (defun tramp-sh--quoting-style-options (vec) | 1272 | (defun tramp-sh--quoting-style-options (vec) |
| 1274 | (or | 1273 | (or |
| @@ -1335,7 +1334,7 @@ component is used as the target of the symlink." | |||
| 1335 | (when symlinkp | 1334 | (when symlinkp |
| 1336 | (search-forward "-> ") | 1335 | (search-forward "-> ") |
| 1337 | (setq res-symlink-target | 1336 | (setq res-symlink-target |
| 1338 | (if (looking-at "\"") | 1337 | (if (looking-at-p "\"") |
| 1339 | (read (current-buffer)) | 1338 | (read (current-buffer)) |
| 1340 | (buffer-substring (point) (point-at-eol))))) | 1339 | (buffer-substring (point) (point-at-eol))))) |
| 1341 | ;; Return data gathered. | 1340 | ;; Return data gathered. |
| @@ -1383,15 +1382,16 @@ component is used as the target of the symlink." | |||
| 1383 | (tramp-send-command-and-read | 1382 | (tramp-send-command-and-read |
| 1384 | vec | 1383 | vec |
| 1385 | (format | 1384 | (format |
| 1386 | (concat | 1385 | (eval-when-compile |
| 1387 | ;; On Opsware, pdksh (which is the true name of ksh there) | 1386 | (concat |
| 1388 | ;; doesn't parse correctly the sequence "((". Therefore, we add | 1387 | ;; On Opsware, pdksh (which is the true name of ksh there) |
| 1389 | ;; a space. Apostrophes in the stat output are masked as | 1388 | ;; doesn't parse correctly the sequence "((". Therefore, we |
| 1390 | ;; `tramp-stat-marker', in order to make a proper shell escape of | 1389 | ;; add a space. Apostrophes in the stat output are masked as |
| 1391 | ;; them in file names. | 1390 | ;; `tramp-stat-marker', in order to make a proper shell escape |
| 1392 | "( (%s %s || %s -h %s) && (%s -c " | 1391 | ;; of them in file names. |
| 1393 | "'((%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' " | 1392 | "( (%s %s || %s -h %s) && (%s -c " |
| 1394 | "%s | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g') || echo nil)") | 1393 | "'((%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' " |
| 1394 | "%s | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g') || echo nil)")) | ||
| 1395 | (tramp-get-file-exists-command vec) | 1395 | (tramp-get-file-exists-command vec) |
| 1396 | (tramp-shell-quote-argument localname) | 1396 | (tramp-shell-quote-argument localname) |
| 1397 | (tramp-get-test-command vec) | 1397 | (tramp-get-test-command vec) |
| @@ -1399,9 +1399,11 @@ component is used as the target of the symlink." | |||
| 1399 | (tramp-get-remote-stat vec) | 1399 | (tramp-get-remote-stat vec) |
| 1400 | tramp-stat-marker tramp-stat-marker | 1400 | tramp-stat-marker tramp-stat-marker |
| 1401 | (if (eq id-format 'integer) | 1401 | (if (eq id-format 'integer) |
| 1402 | "%u" (concat tramp-stat-marker "%U" tramp-stat-marker)) | 1402 | "%u" |
| 1403 | (eval-when-compile (concat tramp-stat-marker "%U" tramp-stat-marker))) | ||
| 1403 | (if (eq id-format 'integer) | 1404 | (if (eq id-format 'integer) |
| 1404 | "%g" (concat tramp-stat-marker "%G" tramp-stat-marker)) | 1405 | "%g" |
| 1406 | (eval-when-compile (concat tramp-stat-marker "%G" tramp-stat-marker))) | ||
| 1405 | tramp-stat-marker tramp-stat-marker | 1407 | tramp-stat-marker tramp-stat-marker |
| 1406 | (tramp-shell-quote-argument localname) | 1408 | (tramp-shell-quote-argument localname) |
| 1407 | tramp-stat-quoted-marker))) | 1409 | tramp-stat-quoted-marker))) |
| @@ -1558,8 +1560,9 @@ be non-negative integers." | |||
| 1558 | (with-parsed-tramp-file-name filename nil | 1560 | (with-parsed-tramp-file-name filename nil |
| 1559 | (with-tramp-file-property v localname "file-selinux-context" | 1561 | (with-tramp-file-property v localname "file-selinux-context" |
| 1560 | (let ((context '(nil nil nil nil)) | 1562 | (let ((context '(nil nil nil nil)) |
| 1561 | (regexp (concat "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\):" | 1563 | (regexp (eval-when-compile |
| 1562 | "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\)"))) | 1564 | (concat "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\):" |
| 1565 | "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\)")))) | ||
| 1563 | (when (and (tramp-remote-selinux-p v) | 1566 | (when (and (tramp-remote-selinux-p v) |
| 1564 | (tramp-send-command-and-check | 1567 | (tramp-send-command-and-check |
| 1565 | v (format | 1568 | v (format |
| @@ -1663,16 +1666,12 @@ be non-negative integers." | |||
| 1663 | ;; something smarter about it. | 1666 | ;; something smarter about it. |
| 1664 | (defun tramp-sh-handle-file-newer-than-file-p (file1 file2) | 1667 | (defun tramp-sh-handle-file-newer-than-file-p (file1 file2) |
| 1665 | "Like `file-newer-than-file-p' for Tramp files." | 1668 | "Like `file-newer-than-file-p' for Tramp files." |
| 1666 | (cond ((not (file-exists-p file1)) | 1669 | (cond ((not (file-exists-p file1)) nil) |
| 1667 | nil) | 1670 | ((not (file-exists-p file2)) t) |
| 1668 | ((not (file-exists-p file2)) | 1671 | (t ;; We are sure both files exist at this point. We try to |
| 1669 | t) | 1672 | ;; get the mtime of both files. If they are not equal to |
| 1670 | ;; We are sure both files exist at this point. | 1673 | ;; the "dont-know" value, then we subtract the times and |
| 1671 | (t | 1674 | ;; obtain the result. |
| 1672 | (save-excursion | ||
| 1673 | ;; We try to get the mtime of both files. If they are not | ||
| 1674 | ;; equal to the "dont-know" value, then we subtract the times | ||
| 1675 | ;; and obtain the result. | ||
| 1676 | (let ((fa1 (file-attributes file1)) | 1675 | (let ((fa1 (file-attributes file1)) |
| 1677 | (fa2 (file-attributes file2))) | 1676 | (fa2 (file-attributes file2))) |
| 1678 | (if (and | 1677 | (if (and |
| @@ -1701,7 +1700,7 @@ be non-negative integers." | |||
| 1701 | file1 file2))) | 1700 | file1 file2))) |
| 1702 | (with-parsed-tramp-file-name file1 nil | 1701 | (with-parsed-tramp-file-name file1 nil |
| 1703 | (tramp-run-test2 | 1702 | (tramp-run-test2 |
| 1704 | (tramp-get-test-nt-command v) file1 file2)))))))) | 1703 | (tramp-get-test-nt-command v) file1 file2))))))) |
| 1705 | 1704 | ||
| 1706 | ;; Functions implemented using the basic functions above. | 1705 | ;; Functions implemented using the basic functions above. |
| 1707 | 1706 | ||
| @@ -1758,25 +1757,22 @@ be non-negative integers." | |||
| 1758 | (with-tramp-file-property | 1757 | (with-tramp-file-property |
| 1759 | v localname | 1758 | v localname |
| 1760 | (format "directory-files-and-attributes-%s" id-format) | 1759 | (format "directory-files-and-attributes-%s" id-format) |
| 1761 | (save-excursion | 1760 | (mapcar |
| 1762 | (mapcar | 1761 | (lambda (x) |
| 1763 | (lambda (x) | 1762 | (cons (car x) (tramp-convert-file-attributes v (cdr x)))) |
| 1764 | (cons (car x) | 1763 | (cond |
| 1765 | (tramp-convert-file-attributes v (cdr x)))) | 1764 | ((tramp-get-remote-stat v) |
| 1766 | (or | 1765 | (tramp-do-directory-files-and-attributes-with-stat |
| 1767 | (cond | 1766 | v localname id-format)) |
| 1768 | ((tramp-get-remote-stat v) | 1767 | ((tramp-get-remote-perl v) |
| 1769 | (tramp-do-directory-files-and-attributes-with-stat | 1768 | (tramp-do-directory-files-and-attributes-with-perl |
| 1770 | v localname id-format)) | 1769 | v localname id-format)) |
| 1771 | ((tramp-get-remote-perl v) | 1770 | (t nil))))))) |
| 1772 | (tramp-do-directory-files-and-attributes-with-perl | ||
| 1773 | v localname id-format)) | ||
| 1774 | (t nil))))))))) | ||
| 1775 | result item) | 1771 | result item) |
| 1776 | 1772 | ||
| 1777 | (while temp | 1773 | (while temp |
| 1778 | (setq item (pop temp)) | 1774 | (setq item (pop temp)) |
| 1779 | (when (or (null match) (string-match match (car item))) | 1775 | (when (or (null match) (string-match-p match (car item))) |
| 1780 | (when full | 1776 | (when full |
| 1781 | (setcar item (expand-file-name (car item) directory))) | 1777 | (setcar item (expand-file-name (car item) directory))) |
| 1782 | (push item result))) | 1778 | (push item result))) |
| @@ -1810,16 +1806,18 @@ be non-negative integers." | |||
| 1810 | (tramp-send-command-and-read | 1806 | (tramp-send-command-and-read |
| 1811 | vec | 1807 | vec |
| 1812 | (format | 1808 | (format |
| 1813 | (concat | 1809 | (eval-when-compile |
| 1814 | ;; We must care about file names with spaces, or starting with | 1810 | (concat |
| 1815 | ;; "-"; this would confuse xargs. "ls -aQ" might be a solution, | 1811 | ;; We must care about file names with spaces, or starting with |
| 1816 | ;; but it does not work on all remote systems. Apostrophes in | 1812 | ;; "-"; this would confuse xargs. "ls -aQ" might be a |
| 1817 | ;; the stat output are masked as `tramp-stat-marker', in order to | 1813 | ;; solution, but it does not work on all remote systems. |
| 1818 | ;; make a proper shell escape of them in file names. | 1814 | ;; Apostrophes in the stat output are masked as |
| 1819 | "cd %s && echo \"(\"; (%s %s -a | " | 1815 | ;; `tramp-stat-marker', in order to make a proper shell escape |
| 1820 | "xargs %s -c " | 1816 | ;; of them in file names. |
| 1821 | "'(%s%%n%s (%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' " | 1817 | "cd %s && echo \"(\"; (%s %s -a | " |
| 1822 | "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\"") | 1818 | "xargs %s -c " |
| 1819 | "'(%s%%n%s (%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' " | ||
| 1820 | "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\"")) | ||
| 1823 | (tramp-shell-quote-argument localname) | 1821 | (tramp-shell-quote-argument localname) |
| 1824 | (tramp-get-ls-command vec) | 1822 | (tramp-get-ls-command vec) |
| 1825 | ;; On systems which have no quoting style, file names with special | 1823 | ;; On systems which have no quoting style, file names with special |
| @@ -1829,9 +1827,11 @@ be non-negative integers." | |||
| 1829 | tramp-stat-marker tramp-stat-marker | 1827 | tramp-stat-marker tramp-stat-marker |
| 1830 | tramp-stat-marker tramp-stat-marker | 1828 | tramp-stat-marker tramp-stat-marker |
| 1831 | (if (eq id-format 'integer) | 1829 | (if (eq id-format 'integer) |
| 1832 | "%u" (concat tramp-stat-marker "%U" tramp-stat-marker)) | 1830 | "%u" |
| 1831 | (eval-when-compile (concat tramp-stat-marker "%U" tramp-stat-marker))) | ||
| 1833 | (if (eq id-format 'integer) | 1832 | (if (eq id-format 'integer) |
| 1834 | "%g" (concat tramp-stat-marker "%G" tramp-stat-marker)) | 1833 | "%g" |
| 1834 | (eval-when-compile (concat tramp-stat-marker "%G" tramp-stat-marker))) | ||
| 1835 | tramp-stat-marker tramp-stat-marker | 1835 | tramp-stat-marker tramp-stat-marker |
| 1836 | tramp-stat-quoted-marker))) | 1836 | tramp-stat-quoted-marker))) |
| 1837 | 1837 | ||
| @@ -1858,12 +1858,13 @@ be non-negative integers." | |||
| 1858 | (format "tramp_perl_file_name_all_completions %s" | 1858 | (format "tramp_perl_file_name_all_completions %s" |
| 1859 | (tramp-shell-quote-argument localname))) | 1859 | (tramp-shell-quote-argument localname))) |
| 1860 | 1860 | ||
| 1861 | (format (concat | 1861 | (format (eval-when-compile |
| 1862 | "(cd %s 2>&1 && %s -a 2>/dev/null" | 1862 | (concat |
| 1863 | " | while IFS= read f; do" | 1863 | "(cd %s 2>&1 && %s -a 2>/dev/null" |
| 1864 | " if %s -d \"$f\" 2>/dev/null;" | 1864 | " | while IFS= read f; do" |
| 1865 | " then \\echo \"$f/\"; else \\echo \"$f\"; fi; done" | 1865 | " if %s -d \"$f\" 2>/dev/null;" |
| 1866 | " && \\echo ok) || \\echo fail") | 1866 | " then \\echo \"$f/\"; else \\echo \"$f\"; fi; done" |
| 1867 | " && \\echo ok) || \\echo fail")) | ||
| 1867 | (tramp-shell-quote-argument localname) | 1868 | (tramp-shell-quote-argument localname) |
| 1868 | (tramp-get-ls-command v) | 1869 | (tramp-get-ls-command v) |
| 1869 | (tramp-get-test-command v)))) | 1870 | (tramp-get-test-command v)))) |
| @@ -1874,7 +1875,7 @@ be non-negative integers." | |||
| 1874 | 1875 | ||
| 1875 | ;; Check result code, found in last line of output. | 1876 | ;; Check result code, found in last line of output. |
| 1876 | (forward-line -1) | 1877 | (forward-line -1) |
| 1877 | (if (looking-at "^fail$") | 1878 | (if (looking-at-p "^fail$") |
| 1878 | (progn | 1879 | (progn |
| 1879 | ;; Grab error message from line before last line | 1880 | ;; Grab error message from line before last line |
| 1880 | ;; (it was put there by `cd 2>&1'). | 1881 | ;; (it was put there by `cd 2>&1'). |
| @@ -1887,7 +1888,7 @@ be non-negative integers." | |||
| 1887 | ;; then it should end in `ok'. If neither are in the | 1888 | ;; then it should end in `ok'. If neither are in the |
| 1888 | ;; buffer something went seriously wrong on the remote | 1889 | ;; buffer something went seriously wrong on the remote |
| 1889 | ;; side. | 1890 | ;; side. |
| 1890 | (unless (looking-at "^ok$") | 1891 | (unless (looking-at-p "^ok$") |
| 1891 | (tramp-error | 1892 | (tramp-error |
| 1892 | v 'file-error "\ | 1893 | v 'file-error "\ |
| 1893 | tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'" | 1894 | tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'" |
| @@ -2545,12 +2546,11 @@ The method used must be an out-of-band method." | |||
| 2545 | ;; whole cache. | 2546 | ;; whole cache. |
| 2546 | (tramp-flush-directory-properties | 2547 | (tramp-flush-directory-properties |
| 2547 | v (if parents "/" (file-name-directory localname))) | 2548 | v (if parents "/" (file-name-directory localname))) |
| 2548 | (save-excursion | 2549 | (tramp-barf-unless-okay |
| 2549 | (tramp-barf-unless-okay | 2550 | v (format "%s %s" |
| 2550 | v (format "%s %s" | 2551 | (if parents "mkdir -p" "mkdir") |
| 2551 | (if parents "mkdir -p" "mkdir") | 2552 | (tramp-shell-quote-argument localname)) |
| 2552 | (tramp-shell-quote-argument localname)) | 2553 | "Couldn't make directory %s" dir))) |
| 2553 | "Couldn't make directory %s" dir)))) | ||
| 2554 | 2554 | ||
| 2555 | (defun tramp-sh-handle-delete-directory (directory &optional recursive trash) | 2555 | (defun tramp-sh-handle-delete-directory (directory &optional recursive trash) |
| 2556 | "Like `delete-directory' for Tramp files." | 2556 | "Like `delete-directory' for Tramp files." |
| @@ -2584,41 +2584,39 @@ The method used must be an out-of-band method." | |||
| 2584 | ;; Code stolen mainly from dired-aux.el. | 2584 | ;; Code stolen mainly from dired-aux.el. |
| 2585 | (with-parsed-tramp-file-name file nil | 2585 | (with-parsed-tramp-file-name file nil |
| 2586 | (tramp-flush-file-properties v localname) | 2586 | (tramp-flush-file-properties v localname) |
| 2587 | (save-excursion | 2587 | (let ((suffixes dired-compress-file-suffixes) |
| 2588 | (let ((suffixes dired-compress-file-suffixes) | 2588 | suffix) |
| 2589 | suffix) | 2589 | ;; See if any suffix rule matches this file name. |
| 2590 | ;; See if any suffix rule matches this file name. | 2590 | (while suffixes |
| 2591 | (while suffixes | 2591 | (let (case-fold-search) |
| 2592 | (let (case-fold-search) | 2592 | (if (string-match-p (car (car suffixes)) localname) |
| 2593 | (if (string-match (car (car suffixes)) localname) | 2593 | (setq suffix (car suffixes) suffixes nil)) |
| 2594 | (setq suffix (car suffixes) suffixes nil)) | 2594 | (setq suffixes (cdr suffixes)))) |
| 2595 | (setq suffixes (cdr suffixes)))) | 2595 | |
| 2596 | 2596 | (cond ((file-symlink-p file) nil) | |
| 2597 | (cond ((file-symlink-p file) | 2597 | ((and suffix (nth 2 suffix)) |
| 2598 | nil) | 2598 | ;; We found an uncompression rule. |
| 2599 | ((and suffix (nth 2 suffix)) | 2599 | (with-tramp-progress-reporter |
| 2600 | ;; We found an uncompression rule. | 2600 | v 0 (format "Uncompressing %s" file) |
| 2601 | (with-tramp-progress-reporter | 2601 | (when (tramp-send-command-and-check |
| 2602 | v 0 (format "Uncompressing %s" file) | 2602 | v (concat (nth 2 suffix) " " |
| 2603 | (when (tramp-send-command-and-check | 2603 | (tramp-shell-quote-argument localname))) |
| 2604 | v (concat (nth 2 suffix) " " | 2604 | (dired-remove-file file) |
| 2605 | (tramp-shell-quote-argument localname))) | 2605 | (string-match (car suffix) file) |
| 2606 | (dired-remove-file file) | 2606 | (concat (substring file 0 (match-beginning 0)))))) |
| 2607 | (string-match (car suffix) file) | 2607 | (t |
| 2608 | (concat (substring file 0 (match-beginning 0)))))) | 2608 | ;; We don't recognize the file as compressed, so compress it. |
| 2609 | (t | 2609 | ;; Try gzip. |
| 2610 | ;; We don't recognize the file as compressed, so compress it. | 2610 | (with-tramp-progress-reporter v 0 (format "Compressing %s" file) |
| 2611 | ;; Try gzip. | 2611 | (when (tramp-send-command-and-check |
| 2612 | (with-tramp-progress-reporter v 0 (format "Compressing %s" file) | 2612 | v (concat "gzip -f " |
| 2613 | (when (tramp-send-command-and-check | 2613 | (tramp-shell-quote-argument localname))) |
| 2614 | v (concat "gzip -f " | 2614 | (dired-remove-file file) |
| 2615 | (tramp-shell-quote-argument localname))) | 2615 | (cond ((file-exists-p (concat file ".gz")) |
| 2616 | (dired-remove-file file) | 2616 | (concat file ".gz")) |
| 2617 | (cond ((file-exists-p (concat file ".gz")) | 2617 | ((file-exists-p (concat file ".z")) |
| 2618 | (concat file ".gz")) | 2618 | (concat file ".z")) |
| 2619 | ((file-exists-p (concat file ".z")) | 2619 | (t nil))))))))) |
| 2620 | (concat file ".z")) | ||
| 2621 | (t nil)))))))))) | ||
| 2622 | 2620 | ||
| 2623 | (defun tramp-sh-handle-insert-directory | 2621 | (defun tramp-sh-handle-insert-directory |
| 2624 | (filename switches &optional wildcard full-directory-p) | 2622 | (filename switches &optional wildcard full-directory-p) |
| @@ -2698,7 +2696,7 @@ The method used must be an out-of-band method." | |||
| 2698 | 2696 | ||
| 2699 | ;; Check for "--dired" output. | 2697 | ;; Check for "--dired" output. |
| 2700 | (forward-line -2) | 2698 | (forward-line -2) |
| 2701 | (when (looking-at "//SUBDIRED//") | 2699 | (when (looking-at-p "//SUBDIRED//") |
| 2702 | (forward-line -1)) | 2700 | (forward-line -1)) |
| 2703 | (when (looking-at "//DIRED//\\s-+") | 2701 | (when (looking-at "//DIRED//\\s-+") |
| 2704 | (let ((databeg (match-end 0)) | 2702 | (let ((databeg (match-end 0)) |
| @@ -2719,7 +2717,7 @@ The method used must be an out-of-band method." | |||
| 2719 | 2717 | ||
| 2720 | ;; Some busyboxes are reluctant to discard colors. | 2718 | ;; Some busyboxes are reluctant to discard colors. |
| 2721 | (unless | 2719 | (unless |
| 2722 | (string-match "color" (tramp-get-connection-property v "ls" "")) | 2720 | (string-match-p "color" (tramp-get-connection-property v "ls" "")) |
| 2723 | (goto-char beg) | 2721 | (goto-char beg) |
| 2724 | (while | 2722 | (while |
| 2725 | (re-search-forward tramp-display-escape-sequence-regexp nil t) | 2723 | (re-search-forward tramp-display-escape-sequence-regexp nil t) |
| @@ -2787,7 +2785,7 @@ the result will be a local, non-Tramp, file name." | |||
| 2787 | ;; appropriate either, because ssh and companions might | 2785 | ;; appropriate either, because ssh and companions might |
| 2788 | ;; use a user name from the config file. | 2786 | ;; use a user name from the config file. |
| 2789 | (when (and (string-equal uname "~") | 2787 | (when (and (string-equal uname "~") |
| 2790 | (string-match "\\`su\\(do\\)?\\'" method)) | 2788 | (string-match-p "\\`su\\(do\\)?\\'" method)) |
| 2791 | (setq uname (concat uname user))) | 2789 | (setq uname (concat uname user))) |
| 2792 | (setq uname | 2790 | (setq uname |
| 2793 | (with-tramp-connection-property v uname | 2791 | (with-tramp-connection-property v uname |
| @@ -2837,7 +2835,7 @@ the result will be a local, non-Tramp, file name." | |||
| 2837 | ;; it might be that the arguments exceed the command line | 2835 | ;; it might be that the arguments exceed the command line |
| 2838 | ;; length. Therefore, we modify the command. | 2836 | ;; length. Therefore, we modify the command. |
| 2839 | (heredoc (and (stringp program) | 2837 | (heredoc (and (stringp program) |
| 2840 | (string-match "sh$" program) | 2838 | (string-match-p "sh$" program) |
| 2841 | (string-equal "-c" (car args)) | 2839 | (string-equal "-c" (car args)) |
| 2842 | (= (length args) 2))) | 2840 | (= (length args) 2))) |
| 2843 | ;; When PROGRAM is nil, we just provide a tty. | 2841 | ;; When PROGRAM is nil, we just provide a tty. |
| @@ -2861,7 +2859,7 @@ the result will be a local, non-Tramp, file name." | |||
| 2861 | env uenv | 2859 | env uenv |
| 2862 | (env (dolist (elt (cons prompt process-environment) env) | 2860 | (env (dolist (elt (cons prompt process-environment) env) |
| 2863 | (or (member elt (default-toplevel-value 'process-environment)) | 2861 | (or (member elt (default-toplevel-value 'process-environment)) |
| 2864 | (if (string-match "=" elt) | 2862 | (if (string-match-p "=" elt) |
| 2865 | (setq env (append env `(,elt))) | 2863 | (setq env (append env `(,elt))) |
| 2866 | (if (tramp-get-env-with-u-option v) | 2864 | (if (tramp-get-env-with-u-option v) |
| 2867 | (setq env (append `("-u" ,elt) env)) | 2865 | (setq env (append `("-u" ,elt) env)) |
| @@ -2951,7 +2949,7 @@ the result will be a local, non-Tramp, file name." | |||
| 2951 | p))) | 2949 | p))) |
| 2952 | 2950 | ||
| 2953 | ;; Save exit. | 2951 | ;; Save exit. |
| 2954 | (if (string-match tramp-temp-buffer-name (buffer-name)) | 2952 | (if (string-match-p tramp-temp-buffer-name (buffer-name)) |
| 2955 | (ignore-errors | 2953 | (ignore-errors |
| 2956 | (set-process-buffer p nil) | 2954 | (set-process-buffer p nil) |
| 2957 | (kill-buffer (current-buffer))) | 2955 | (kill-buffer (current-buffer))) |
| @@ -2974,7 +2972,7 @@ the result will be a local, non-Tramp, file name." | |||
| 2974 | ;; We use as environment the difference to toplevel `process-environment'. | 2972 | ;; We use as environment the difference to toplevel `process-environment'. |
| 2975 | (dolist (elt process-environment) | 2973 | (dolist (elt process-environment) |
| 2976 | (or (member elt (default-toplevel-value 'process-environment)) | 2974 | (or (member elt (default-toplevel-value 'process-environment)) |
| 2977 | (if (string-match "=" elt) | 2975 | (if (string-match-p "=" elt) |
| 2978 | (setq env (append env `(,elt))) | 2976 | (setq env (append env `(,elt))) |
| 2979 | (if (tramp-get-env-with-u-option v) | 2977 | (if (tramp-get-env-with-u-option v) |
| 2980 | (setq env (append `("-u" ,elt) env)) | 2978 | (setq env (append `("-u" ,elt) env)) |
| @@ -3114,50 +3112,49 @@ the result will be a local, non-Tramp, file name." | |||
| 3114 | 3112 | ||
| 3115 | ;; Use inline encoding for file transfer. | 3113 | ;; Use inline encoding for file transfer. |
| 3116 | (rem-enc | 3114 | (rem-enc |
| 3117 | (save-excursion | 3115 | (with-tramp-progress-reporter |
| 3118 | (with-tramp-progress-reporter | 3116 | v 3 |
| 3119 | v 3 | 3117 | (format-message |
| 3120 | (format-message "Encoding remote file `%s' with `%s'" | 3118 | "Encoding remote file `%s' with `%s'" filename rem-enc) |
| 3121 | filename rem-enc) | 3119 | (tramp-barf-unless-okay |
| 3122 | (tramp-barf-unless-okay | 3120 | v (format rem-enc (tramp-shell-quote-argument localname)) |
| 3123 | v (format rem-enc (tramp-shell-quote-argument localname)) | 3121 | "Encoding remote file failed")) |
| 3124 | "Encoding remote file failed")) | 3122 | |
| 3125 | 3123 | (with-tramp-progress-reporter | |
| 3126 | (with-tramp-progress-reporter | 3124 | v 3 (format-message |
| 3127 | v 3 (format-message "Decoding local file `%s' with `%s'" | 3125 | "Decoding local file `%s' with `%s'" tmpfile loc-dec) |
| 3128 | tmpfile loc-dec) | 3126 | (if (functionp loc-dec) |
| 3129 | (if (functionp loc-dec) | 3127 | ;; If local decoding is a function, we call it. We |
| 3130 | ;; If local decoding is a function, we call it. | 3128 | ;; must disable multibyte, because |
| 3131 | ;; We must disable multibyte, because | 3129 | ;; `uudecode-decode-region' doesn't handle it |
| 3132 | ;; `uudecode-decode-region' doesn't handle it | 3130 | ;; correctly. Unset `file-name-handler-alist'. |
| 3133 | ;; correctly. Unset `file-name-handler-alist'. | 3131 | ;; Otherwise, epa-file gets confused. |
| 3134 | ;; Otherwise, epa-file gets confused. | 3132 | (let (file-name-handler-alist |
| 3135 | (let (file-name-handler-alist | 3133 | (coding-system-for-write 'binary)) |
| 3136 | (coding-system-for-write 'binary)) | 3134 | (with-temp-file tmpfile |
| 3137 | (with-temp-file tmpfile | 3135 | (set-buffer-multibyte nil) |
| 3138 | (set-buffer-multibyte nil) | 3136 | (insert-buffer-substring (tramp-get-buffer v)) |
| 3139 | (insert-buffer-substring (tramp-get-buffer v)) | 3137 | (funcall loc-dec (point-min) (point-max)))) |
| 3140 | (funcall loc-dec (point-min) (point-max)))) | 3138 | |
| 3141 | 3139 | ;; If tramp-decoding-function is not defined for this | |
| 3142 | ;; If tramp-decoding-function is not defined for this | 3140 | ;; method, we invoke tramp-decoding-command instead. |
| 3143 | ;; method, we invoke tramp-decoding-command instead. | 3141 | (let ((tmpfile2 (tramp-compat-make-temp-file filename))) |
| 3144 | (let ((tmpfile2 (tramp-compat-make-temp-file filename))) | 3142 | ;; Unset `file-name-handler-alist'. Otherwise, |
| 3145 | ;; Unset `file-name-handler-alist'. Otherwise, | 3143 | ;; epa-file gets confused. |
| 3146 | ;; epa-file gets confused. | 3144 | (let (file-name-handler-alist |
| 3147 | (let (file-name-handler-alist | 3145 | (coding-system-for-write 'binary)) |
| 3148 | (coding-system-for-write 'binary)) | 3146 | (with-current-buffer (tramp-get-buffer v) |
| 3149 | (with-current-buffer (tramp-get-buffer v) | 3147 | (write-region |
| 3150 | (write-region | 3148 | (point-min) (point-max) tmpfile2 nil 'no-message))) |
| 3151 | (point-min) (point-max) tmpfile2 nil 'no-message))) | 3149 | (unwind-protect |
| 3152 | (unwind-protect | 3150 | (tramp-call-local-coding-command |
| 3153 | (tramp-call-local-coding-command | 3151 | loc-dec tmpfile2 tmpfile) |
| 3154 | loc-dec tmpfile2 tmpfile) | 3152 | (delete-file tmpfile2))))) |
| 3155 | (delete-file tmpfile2))))) | 3153 | |
| 3156 | 3154 | ;; Set proper permissions. | |
| 3157 | ;; Set proper permissions. | 3155 | (set-file-modes tmpfile (tramp-default-file-modes filename)) |
| 3158 | (set-file-modes tmpfile (tramp-default-file-modes filename)) | 3156 | ;; Set local user ownership. |
| 3159 | ;; Set local user ownership. | 3157 | (tramp-set-file-uid-gid tmpfile)) |
| 3160 | (tramp-set-file-uid-gid tmpfile))) | ||
| 3161 | 3158 | ||
| 3162 | ;; Oops, I don't know what to do. | 3159 | ;; Oops, I don't know what to do. |
| 3163 | (t (tramp-error | 3160 | (t (tramp-error |
| @@ -3323,8 +3320,9 @@ the result will be a local, non-Tramp, file name." | |||
| 3323 | loc-enc tmpfile t)) | 3320 | loc-enc tmpfile t)) |
| 3324 | (tramp-error | 3321 | (tramp-error |
| 3325 | v 'file-error | 3322 | v 'file-error |
| 3326 | (concat "Cannot write to `%s', " | 3323 | (eval-when-compile |
| 3327 | "local encoding command `%s' failed") | 3324 | (concat "Cannot write to `%s', " |
| 3325 | "local encoding command `%s' failed")) | ||
| 3328 | filename loc-enc)))) | 3326 | filename loc-enc)))) |
| 3329 | 3327 | ||
| 3330 | ;; Send buffer into remote decoding command which | 3328 | ;; Send buffer into remote decoding command which |
| @@ -3369,8 +3367,9 @@ the result will be a local, non-Tramp, file name." | |||
| 3369 | (buffer-string)))) | 3367 | (buffer-string)))) |
| 3370 | (tramp-error | 3368 | (tramp-error |
| 3371 | v 'file-error | 3369 | v 'file-error |
| 3372 | (concat "Couldn't write region to `%s'," | 3370 | (eval-when-compile |
| 3373 | " decode using `%s' failed") | 3371 | (concat "Couldn't write region to `%s'," |
| 3372 | " decode using `%s' failed")) | ||
| 3374 | filename rem-dec))))) | 3373 | filename rem-dec))))) |
| 3375 | 3374 | ||
| 3376 | ;; Save exit. | 3375 | ;; Save exit. |
| @@ -3380,8 +3379,9 @@ the result will be a local, non-Tramp, file name." | |||
| 3380 | (t | 3379 | (t |
| 3381 | (tramp-error | 3380 | (tramp-error |
| 3382 | v 'file-error | 3381 | v 'file-error |
| 3383 | (concat "Method `%s' should specify both encoding and " | 3382 | (eval-when-compile |
| 3384 | "decoding command or an scp program") | 3383 | (concat "Method `%s' should specify both encoding and " |
| 3384 | "decoding command or an scp program")) | ||
| 3385 | method)))) | 3385 | method)))) |
| 3386 | 3386 | ||
| 3387 | ;; Make `last-coding-system-used' have the right value. | 3387 | ;; Make `last-coding-system-used' have the right value. |
| @@ -3568,11 +3568,13 @@ Fall back to normal file name handler if no Tramp handler exists." | |||
| 3568 | events | 3568 | events |
| 3569 | (cond | 3569 | (cond |
| 3570 | ((and (memq 'change flags) (memq 'attribute-change flags)) | 3570 | ((and (memq 'change flags) (memq 'attribute-change flags)) |
| 3571 | (concat "create,modify,move,moved_from,moved_to,move_self," | 3571 | (eval-when-compile |
| 3572 | "delete,delete_self,attrib,ignored")) | 3572 | (concat "create,modify,move,moved_from,moved_to,move_self," |
| 3573 | "delete,delete_self,attrib,ignored"))) | ||
| 3573 | ((memq 'change flags) | 3574 | ((memq 'change flags) |
| 3574 | (concat "create,modify,move,moved_from,moved_to,move_self," | 3575 | (eval-when-compile |
| 3575 | "delete,delete_self,ignored")) | 3576 | (concat "create,modify,move,moved_from,moved_to,move_self," |
| 3577 | "delete,delete_self,ignored"))) | ||
| 3576 | ((memq 'attribute-change flags) "attrib,ignored")) | 3578 | ((memq 'attribute-change flags) "attrib,ignored")) |
| 3577 | sequence `(,command "-mq" "-e" ,events ,localname) | 3579 | sequence `(,command "-mq" "-e" ,events ,localname) |
| 3578 | ;; Make events a list of symbols. | 3580 | ;; Make events a list of symbols. |
| @@ -3656,14 +3658,16 @@ Fall back to normal file name handler if no Tramp handler exists." | |||
| 3656 | string (replace-regexp-in-string | 3658 | string (replace-regexp-in-string |
| 3657 | "renamed to" "moved" string)) | 3659 | "renamed to" "moved" string)) |
| 3658 | ;; https://bugs.launchpad.net/bugs/1742946 | 3660 | ;; https://bugs.launchpad.net/bugs/1742946 |
| 3659 | (when (string-match "Monitoring not supported\\|No locations given" string) | 3661 | (when |
| 3662 | (string-match-p "Monitoring not supported\\|No locations given" string) | ||
| 3660 | (delete-process proc)) | 3663 | (delete-process proc)) |
| 3661 | 3664 | ||
| 3662 | (while (string-match | 3665 | (while (string-match |
| 3663 | (concat "^[^:]+:" | 3666 | (eval-when-compile |
| 3664 | "[[:space:]]\\([^:]+\\):" | 3667 | (concat "^[^:]+:" |
| 3665 | "[[:space:]]" (regexp-opt tramp-gio-events t) | 3668 | "[[:space:]]\\([^:]+\\):" |
| 3666 | "\\([[:space:]]\\([^:]+\\)\\)?$") | 3669 | "[[:space:]]" (regexp-opt tramp-gio-events t) |
| 3670 | "\\([[:space:]]\\([^:]+\\)\\)?$")) | ||
| 3667 | string) | 3671 | string) |
| 3668 | 3672 | ||
| 3669 | (let* ((file (match-string 1 string)) | 3673 | (let* ((file (match-string 1 string)) |
| @@ -3712,11 +3716,12 @@ file-notify events." | |||
| 3712 | "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string)) | 3716 | "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string)) |
| 3713 | 3717 | ||
| 3714 | (while (string-match | 3718 | (while (string-match |
| 3715 | (concat "^[\n\r]*" | 3719 | (eval-when-compile |
| 3716 | "Directory Monitor Event:[\n\r]+" | 3720 | (concat "^[\n\r]*" |
| 3717 | "Child = \\([^\n\r]+\\)[\n\r]+" | 3721 | "Directory Monitor Event:[\n\r]+" |
| 3718 | "\\(Other = \\([^\n\r]+\\)[\n\r]+\\)?" | 3722 | "Child = \\([^\n\r]+\\)[\n\r]+" |
| 3719 | "Event = \\([^[:blank:]]+\\)[\n\r]+") | 3723 | "\\(Other = \\([^\n\r]+\\)[\n\r]+\\)?" |
| 3724 | "Event = \\([^[:blank:]]+\\)[\n\r]+")) | ||
| 3720 | string) | 3725 | string) |
| 3721 | (let* ((file (match-string 1 string)) | 3726 | (let* ((file (match-string 1 string)) |
| 3722 | (file1 (match-string 3 string)) | 3727 | (file1 (match-string 3 string)) |
| @@ -3755,10 +3760,11 @@ file-notify events." | |||
| 3755 | (tramp-message proc 6 "%S\n%s" proc string) | 3760 | (tramp-message proc 6 "%S\n%s" proc string) |
| 3756 | (dolist (line (split-string string "[\n\r]+" 'omit)) | 3761 | (dolist (line (split-string string "[\n\r]+" 'omit)) |
| 3757 | ;; Check, whether there is a problem. | 3762 | ;; Check, whether there is a problem. |
| 3758 | (unless (string-match | 3763 | (unless (string-match-p |
| 3759 | (concat "^[^[:blank:]]+" | 3764 | (eval-when-compile |
| 3760 | "[[:blank:]]+\\([^[:blank:]]+\\)+" | 3765 | (concat "^[^[:blank:]]+" |
| 3761 | "\\([[:blank:]]+\\([^\n\r]+\\)\\)?") | 3766 | "[[:blank:]]+\\([^[:blank:]]+\\)+" |
| 3767 | "\\([[:blank:]]+\\([^\n\r]+\\)\\)?")) | ||
| 3762 | line) | 3768 | line) |
| 3763 | (tramp-error proc 'file-notify-error "%s" line)) | 3769 | (tramp-error proc 'file-notify-error "%s" line)) |
| 3764 | 3770 | ||
| @@ -3796,9 +3802,10 @@ file-notify events." | |||
| 3796 | (goto-char (point-min)) | 3802 | (goto-char (point-min)) |
| 3797 | (forward-line) | 3803 | (forward-line) |
| 3798 | (when (looking-at | 3804 | (when (looking-at |
| 3799 | (concat "[[:space:]]*\\([[:digit:]]+\\)" | 3805 | (eval-when-compile |
| 3800 | "[[:space:]]+\\([[:digit:]]+\\)" | 3806 | (concat "[[:space:]]*\\([[:digit:]]+\\)" |
| 3801 | "[[:space:]]+\\([[:digit:]]+\\)")) | 3807 | "[[:space:]]+\\([[:digit:]]+\\)" |
| 3808 | "[[:space:]]+\\([[:digit:]]+\\)"))) | ||
| 3802 | (list (string-to-number (match-string 1)) | 3809 | (list (string-to-number (match-string 1)) |
| 3803 | ;; The second value is the used size. We need the | 3810 | ;; The second value is the used size. We need the |
| 3804 | ;; free size. | 3811 | ;; free size. |
| @@ -3823,7 +3830,7 @@ Only send the definition if it has not already been done." | |||
| 3823 | (setq script (replace-regexp-in-string | 3830 | (setq script (replace-regexp-in-string |
| 3824 | (make-string 1 ?\t) (make-string 8 ? ) script)) | 3831 | (make-string 1 ?\t) (make-string 8 ? ) script)) |
| 3825 | ;; The script could contain a call of Perl. This is masked with `%s'. | 3832 | ;; The script could contain a call of Perl. This is masked with `%s'. |
| 3826 | (when (and (string-match "%s" script) | 3833 | (when (and (string-match-p "%s" script) |
| 3827 | (not (tramp-get-remote-perl vec))) | 3834 | (not (tramp-get-remote-perl vec))) |
| 3828 | (tramp-error vec 'file-error "No Perl available on remote host")) | 3835 | (tramp-error vec 'file-error "No Perl available on remote host")) |
| 3829 | (tramp-barf-unless-okay | 3836 | (tramp-barf-unless-okay |
| @@ -3884,12 +3891,12 @@ This function expects to be in the right *tramp* buffer." | |||
| 3884 | ;; 5.11") have problems with this command, we disable the call | 3891 | ;; 5.11") have problems with this command, we disable the call |
| 3885 | ;; therefore. | 3892 | ;; therefore. |
| 3886 | (unless (or ignore-path | 3893 | (unless (or ignore-path |
| 3887 | (string-match | 3894 | (string-match-p |
| 3888 | (regexp-opt '("SunOS 5.10" "SunOS 5.11")) | 3895 | (eval-when-compile (regexp-opt '("SunOS 5.10" "SunOS 5.11"))) |
| 3889 | (tramp-get-connection-property vec "uname" ""))) | 3896 | (tramp-get-connection-property vec "uname" ""))) |
| 3890 | (tramp-send-command vec (format "which \\%s | wc -w" progname)) | 3897 | (tramp-send-command vec (format "which \\%s | wc -w" progname)) |
| 3891 | (goto-char (point-min)) | 3898 | (goto-char (point-min)) |
| 3892 | (if (looking-at "^\\s-*1$") | 3899 | (if (looking-at-p "^\\s-*1$") |
| 3893 | (setq result (concat "\\" progname)))) | 3900 | (setq result (concat "\\" progname)))) |
| 3894 | (unless result | 3901 | (unless result |
| 3895 | (when ignore-tilde | 3902 | (when ignore-tilde |
| @@ -3903,11 +3910,12 @@ This function expects to be in the right *tramp* buffer." | |||
| 3903 | (setq dirlist (nreverse newdl)))) | 3910 | (setq dirlist (nreverse newdl)))) |
| 3904 | (tramp-send-command | 3911 | (tramp-send-command |
| 3905 | vec | 3912 | vec |
| 3906 | (format (concat "while read d; " | 3913 | (format (eval-when-compile |
| 3907 | "do if test -x $d/%s && test -f $d/%s; " | 3914 | (concat "while read d; " |
| 3908 | "then echo tramp_executable $d/%s; " | 3915 | "do if test -x $d/%s && test -f $d/%s; " |
| 3909 | "break; fi; done <<'%s'\n" | 3916 | "then echo tramp_executable $d/%s; " |
| 3910 | "%s\n%s") | 3917 | "break; fi; done <<'%s'\n" |
| 3918 | "%s\n%s")) | ||
| 3911 | progname progname progname | 3919 | progname progname progname |
| 3912 | tramp-end-of-heredoc | 3920 | tramp-end-of-heredoc |
| 3913 | (mapconcat 'identity dirlist "\n") | 3921 | (mapconcat 'identity dirlist "\n") |
| @@ -3996,7 +4004,7 @@ file exists and nonzero exit status otherwise." | |||
| 3996 | item extra-args) | 4004 | item extra-args) |
| 3997 | (while (and alist (null extra-args)) | 4005 | (while (and alist (null extra-args)) |
| 3998 | (setq item (pop alist)) | 4006 | (setq item (pop alist)) |
| 3999 | (when (string-match (car item) shell) | 4007 | (when (string-match-p (car item) shell) |
| 4000 | (setq extra-args (cdr item)))) | 4008 | (setq extra-args (cdr item)))) |
| 4001 | ;; It is useful to set the prompt in the following command | 4009 | ;; It is useful to set the prompt in the following command |
| 4002 | ;; because some people have a setting for $PS1 which /bin/sh | 4010 | ;; because some people have a setting for $PS1 which /bin/sh |
| @@ -4017,9 +4025,10 @@ file exists and nonzero exit status otherwise." | |||
| 4017 | ;; initial probes to ensure the remote shell is usable.) | 4025 | ;; initial probes to ensure the remote shell is usable.) |
| 4018 | (tramp-send-command | 4026 | (tramp-send-command |
| 4019 | vec (format | 4027 | vec (format |
| 4020 | (concat | 4028 | (eval-when-compile |
| 4021 | "exec env TERM='%s' INSIDE_EMACS='%s,tramp:%s' " | 4029 | (concat |
| 4022 | "ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s") | 4030 | "exec env TERM='%s' INSIDE_EMACS='%s,tramp:%s' " |
| 4031 | "ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s")) | ||
| 4023 | tramp-terminal-type | 4032 | tramp-terminal-type |
| 4024 | emacs-version tramp-version ; INSIDE_EMACS | 4033 | emacs-version tramp-version ; INSIDE_EMACS |
| 4025 | (or (getenv-internal "ENV" tramp-remote-process-environment) "") | 4034 | (or (getenv-internal "ENV" tramp-remote-process-environment) "") |
| @@ -4057,13 +4066,14 @@ file exists and nonzero exit status otherwise." | |||
| 4057 | ;; CCC: "root" does not exist always, see my QNAP TS-459. | 4066 | ;; CCC: "root" does not exist always, see my QNAP TS-459. |
| 4058 | ;; Which check could we apply instead? | 4067 | ;; Which check could we apply instead? |
| 4059 | (tramp-send-command vec "echo ~root" t) | 4068 | (tramp-send-command vec "echo ~root" t) |
| 4060 | (if (or (string-match "^~root$" (buffer-string)) | 4069 | (if (or (string-match-p "^~root$" (buffer-string)) |
| 4061 | ;; The default shell (ksh93) of OpenSolaris and | 4070 | ;; The default shell (ksh93) of OpenSolaris and |
| 4062 | ;; Solaris is buggy. We've got reports for | 4071 | ;; Solaris is buggy. We've got reports for |
| 4063 | ;; "SunOS 5.10" and "SunOS 5.11" so far. | 4072 | ;; "SunOS 5.10" and "SunOS 5.11" so far. |
| 4064 | (string-match (regexp-opt '("SunOS 5.10" "SunOS 5.11")) | 4073 | (string-match-p |
| 4065 | (tramp-get-connection-property | 4074 | (eval-when-compile |
| 4066 | vec "uname" ""))) | 4075 | (regexp-opt '("SunOS 5.10" "SunOS 5.11"))) |
| 4076 | (tramp-get-connection-property vec "uname" ""))) | ||
| 4067 | 4077 | ||
| 4068 | (or (tramp-find-executable | 4078 | (or (tramp-find-executable |
| 4069 | vec "bash" (tramp-get-remote-path vec) t t) | 4079 | vec "bash" (tramp-get-remote-path vec) t t) |
| @@ -4074,9 +4084,10 @@ file exists and nonzero exit status otherwise." | |||
| 4074 | default-shell | 4084 | default-shell |
| 4075 | (tramp-message | 4085 | (tramp-message |
| 4076 | vec 2 | 4086 | vec 2 |
| 4077 | (concat | 4087 | (eval-when-compile |
| 4078 | "Couldn't find a remote shell which groks tilde " | 4088 | (concat |
| 4079 | "expansion, using `%s'") | 4089 | "Couldn't find a remote shell which groks tilde " |
| 4090 | "expansion, using `%s'")) | ||
| 4080 | default-shell))) | 4091 | default-shell))) |
| 4081 | 4092 | ||
| 4082 | default-shell))) | 4093 | default-shell))) |
| @@ -4122,7 +4133,7 @@ process to set up. VEC specifies the connection." | |||
| 4122 | (tramp-send-command vec "echo foo" t) | 4133 | (tramp-send-command vec "echo foo" t) |
| 4123 | (with-current-buffer (process-buffer proc) | 4134 | (with-current-buffer (process-buffer proc) |
| 4124 | (goto-char (point-min)) | 4135 | (goto-char (point-min)) |
| 4125 | (when (looking-at "echo foo") | 4136 | (when (looking-at-p "echo foo") |
| 4126 | (tramp-set-connection-property proc "remote-echo" t) | 4137 | (tramp-set-connection-property proc "remote-echo" t) |
| 4127 | (tramp-message vec 5 "Remote echo still on. Ok.") | 4138 | (tramp-message vec 5 "Remote echo still on. Ok.") |
| 4128 | ;; Make sure backspaces and their echo are enabled and no line | 4139 | ;; Make sure backspaces and their echo are enabled and no line |
| @@ -4161,10 +4172,10 @@ process to set up. VEC specifies the connection." | |||
| 4161 | ;; Use MULE to select the right EOL convention for communicating | 4172 | ;; Use MULE to select the right EOL convention for communicating |
| 4162 | ;; with the process. | 4173 | ;; with the process. |
| 4163 | (let ((cs (or (and (memq 'utf-8-hfs (coding-system-list)) | 4174 | (let ((cs (or (and (memq 'utf-8-hfs (coding-system-list)) |
| 4164 | (string-match "^Darwin" uname) | 4175 | (string-match-p "^Darwin" uname) |
| 4165 | (cons 'utf-8-hfs 'utf-8-hfs)) | 4176 | (cons 'utf-8-hfs 'utf-8-hfs)) |
| 4166 | (and (memq 'utf-8 (coding-system-list)) | 4177 | (and (memq 'utf-8 (coding-system-list)) |
| 4167 | (string-match "utf-?8" (tramp-get-remote-locale vec)) | 4178 | (string-match-p "utf-?8" (tramp-get-remote-locale vec)) |
| 4168 | (cons 'utf-8 'utf-8)) | 4179 | (cons 'utf-8 'utf-8)) |
| 4169 | (process-coding-system proc) | 4180 | (process-coding-system proc) |
| 4170 | (cons 'undecided 'undecided))) | 4181 | (cons 'undecided 'undecided))) |
| @@ -4174,7 +4185,7 @@ process to set up. VEC specifies the connection." | |||
| 4174 | cs-encode (or (cdr cs) 'undecided) | 4185 | cs-encode (or (cdr cs) 'undecided) |
| 4175 | cs-encode | 4186 | cs-encode |
| 4176 | (coding-system-change-eol-conversion | 4187 | (coding-system-change-eol-conversion |
| 4177 | cs-encode (if (string-match "^Darwin" uname) 'mac 'unix))) | 4188 | cs-encode (if (string-match-p "^Darwin" uname) 'mac 'unix))) |
| 4178 | (tramp-send-command vec "(echo foo ; echo bar)" t) | 4189 | (tramp-send-command vec "(echo foo ; echo bar)" t) |
| 4179 | (goto-char (point-min)) | 4190 | (goto-char (point-min)) |
| 4180 | (when (search-forward "\r" nil t) | 4191 | (when (search-forward "\r" nil t) |
| @@ -4198,7 +4209,7 @@ process to set up. VEC specifies the connection." | |||
| 4198 | (t | 4209 | (t |
| 4199 | (tramp-message | 4210 | (tramp-message |
| 4200 | vec 5 "Checking remote host type for `send-process-string' bug") | 4211 | vec 5 "Checking remote host type for `send-process-string' bug") |
| 4201 | (if (string-match "^FreeBSD" uname) 500 0)))) | 4212 | (if (string-match-p "^FreeBSD" uname) 500 0)))) |
| 4202 | 4213 | ||
| 4203 | ;; Set remote PATH variable. | 4214 | ;; Set remote PATH variable. |
| 4204 | (tramp-set-remote-path vec) | 4215 | (tramp-set-remote-path vec) |
| @@ -4221,11 +4232,11 @@ process to set up. VEC specifies the connection." | |||
| 4221 | ;; IRIX64 bash expands "!" even when in single quotes. This | 4232 | ;; IRIX64 bash expands "!" even when in single quotes. This |
| 4222 | ;; destroys our shell functions, we must disable it. See | 4233 | ;; destroys our shell functions, we must disable it. See |
| 4223 | ;; <http://stackoverflow.com/questions/3291692/irix-bash-shell-expands-expression-in-single-quotes-yet-shouldnt>. | 4234 | ;; <http://stackoverflow.com/questions/3291692/irix-bash-shell-expands-expression-in-single-quotes-yet-shouldnt>. |
| 4224 | (when (string-match "^IRIX64" uname) | 4235 | (when (string-match-p "^IRIX64" uname) |
| 4225 | (tramp-send-command vec "set +H" t)) | 4236 | (tramp-send-command vec "set +H" t)) |
| 4226 | 4237 | ||
| 4227 | ;; Disable tab expansion. | 4238 | ;; Disable tab expansion. |
| 4228 | (if (string-match "BSD\\|Darwin" uname) | 4239 | (if (string-match-p "BSD\\|Darwin" uname) |
| 4229 | (tramp-send-command vec "stty tabs" t) | 4240 | (tramp-send-command vec "stty tabs" t) |
| 4230 | (tramp-send-command vec "stty tab0" t)) | 4241 | (tramp-send-command vec "stty tab0" t)) |
| 4231 | 4242 | ||
| @@ -4397,7 +4408,7 @@ Goes through the list `tramp-local-coding-commands' and | |||
| 4397 | (throw 'wont-work-remote nil))) | 4408 | (throw 'wont-work-remote nil))) |
| 4398 | ;; Check if remote perl exists when necessary. | 4409 | ;; Check if remote perl exists when necessary. |
| 4399 | (when (and (symbolp rem-enc) | 4410 | (when (and (symbolp rem-enc) |
| 4400 | (string-match "perl" (symbol-name rem-enc)) | 4411 | (string-match-p "perl" (symbol-name rem-enc)) |
| 4401 | (not (tramp-get-remote-perl vec))) | 4412 | (not (tramp-get-remote-perl vec))) |
| 4402 | (throw 'wont-work-remote nil)) | 4413 | (throw 'wont-work-remote nil)) |
| 4403 | ;; Check if remote encoding and decoding commands can be | 4414 | ;; Check if remote encoding and decoding commands can be |
| @@ -4410,7 +4421,7 @@ Goes through the list `tramp-local-coding-commands' and | |||
| 4410 | ;; it might change the permissions of /dev/null! | 4421 | ;; it might change the permissions of /dev/null! |
| 4411 | (when (not (stringp rem-enc)) | 4422 | (when (not (stringp rem-enc)) |
| 4412 | (let ((name (symbol-name rem-enc))) | 4423 | (let ((name (symbol-name rem-enc))) |
| 4413 | (while (string-match (regexp-quote "-") name) | 4424 | (while (string-match "-" name) |
| 4414 | (setq name (replace-match "_" nil t name))) | 4425 | (setq name (replace-match "_" nil t name))) |
| 4415 | (tramp-maybe-send-script vec (symbol-value rem-enc) name) | 4426 | (tramp-maybe-send-script vec (symbol-value rem-enc) name) |
| 4416 | (setq rem-enc name))) | 4427 | (setq rem-enc name))) |
| @@ -4425,9 +4436,9 @@ Goes through the list `tramp-local-coding-commands' and | |||
| 4425 | (let ((name (symbol-name rem-dec)) | 4436 | (let ((name (symbol-name rem-dec)) |
| 4426 | (value (symbol-value rem-dec)) | 4437 | (value (symbol-value rem-dec)) |
| 4427 | tmpfile) | 4438 | tmpfile) |
| 4428 | (while (string-match (regexp-quote "-") name) | 4439 | (while (string-match "-" name) |
| 4429 | (setq name (replace-match "_" nil t name))) | 4440 | (setq name (replace-match "_" nil t name))) |
| 4430 | (when (string-match "\\(^\\|[^%]\\)%t" value) | 4441 | (when (string-match-p "\\(^\\|[^%]\\)%t" value) |
| 4431 | (setq tmpfile | 4442 | (setq tmpfile |
| 4432 | (make-temp-name | 4443 | (make-temp-name |
| 4433 | (expand-file-name | 4444 | (expand-file-name |
| @@ -4452,7 +4463,7 @@ Goes through the list `tramp-local-coding-commands' and | |||
| 4452 | 4463 | ||
| 4453 | (with-current-buffer (tramp-get-buffer vec) | 4464 | (with-current-buffer (tramp-get-buffer vec) |
| 4454 | (goto-char (point-min)) | 4465 | (goto-char (point-min)) |
| 4455 | (unless (looking-at (regexp-quote magic)) | 4466 | (unless (looking-at-p (regexp-quote magic)) |
| 4456 | (throw 'wont-work-remote nil))) | 4467 | (throw 'wont-work-remote nil))) |
| 4457 | 4468 | ||
| 4458 | ;; `rem-enc' and `rem-dec' could be a string meanwhile. | 4469 | ;; `rem-enc' and `rem-dec' could be a string meanwhile. |
| @@ -4482,12 +4493,12 @@ means standard output and thus the current buffer), or nil (which | |||
| 4482 | means discard it)." | 4493 | means discard it)." |
| 4483 | (tramp-call-process | 4494 | (tramp-call-process |
| 4484 | nil tramp-encoding-shell | 4495 | nil tramp-encoding-shell |
| 4485 | (when (and input (not (string-match "%s" cmd))) input) | 4496 | (when (and input (not (string-match-p "%s" cmd))) input) |
| 4486 | (if (eq output t) t nil) | 4497 | (if (eq output t) t nil) |
| 4487 | nil | 4498 | nil |
| 4488 | tramp-encoding-command-switch | 4499 | tramp-encoding-command-switch |
| 4489 | (concat | 4500 | (concat |
| 4490 | (if (string-match "%s" cmd) (format cmd input) cmd) | 4501 | (if (string-match-p "%s" cmd) (format cmd input) cmd) |
| 4491 | (if (stringp output) (concat " >" output) "")))) | 4502 | (if (stringp output) (concat " >" output) "")))) |
| 4492 | 4503 | ||
| 4493 | (defconst tramp-inline-compress-commands | 4504 | (defconst tramp-inline-compress-commands |
| @@ -4598,13 +4609,15 @@ Goes through the list `tramp-inline-compress-commands'." | |||
| 4598 | proxy (eval (nth 2 item))) | 4609 | proxy (eval (nth 2 item))) |
| 4599 | (when (and | 4610 | (when (and |
| 4600 | ;; Host. | 4611 | ;; Host. |
| 4601 | (string-match (or (eval (nth 0 item)) "") | 4612 | (string-match-p |
| 4602 | (or (tramp-file-name-host-port (car target-alist)) | 4613 | (or (eval (nth 0 item)) "") |
| 4603 | "")) | 4614 | (or (tramp-file-name-host-port (car target-alist)) |
| 4615 | "")) | ||
| 4604 | ;; User. | 4616 | ;; User. |
| 4605 | (string-match (or (eval (nth 1 item)) "") | 4617 | (string-match-p |
| 4606 | (or (tramp-file-name-user-domain (car target-alist)) | 4618 | (or (eval (nth 1 item)) "") |
| 4607 | ""))) | 4619 | (or (tramp-file-name-user-domain (car target-alist)) |
| 4620 | ""))) | ||
| 4608 | (if (null proxy) | 4621 | (if (null proxy) |
| 4609 | ;; No more hops needed. | 4622 | ;; No more hops needed. |
| 4610 | (setq choices nil) | 4623 | (setq choices nil) |
| @@ -4646,7 +4659,7 @@ Goes through the list `tramp-inline-compress-commands'." | |||
| 4646 | (member | 4659 | (member |
| 4647 | '("%h") (tramp-get-method-parameter item 'tramp-login-args)) | 4660 | '("%h") (tramp-get-method-parameter item 'tramp-login-args)) |
| 4648 | ;; The host name must match previous hop. | 4661 | ;; The host name must match previous hop. |
| 4649 | (string-match previous-host host)) | 4662 | (string-match-p previous-host host)) |
| 4650 | (tramp-user-error | 4663 | (tramp-user-error |
| 4651 | item "Host name `%s' does not match `%s'" host previous-host)) | 4664 | item "Host name `%s' does not match `%s'" host previous-host)) |
| 4652 | (setq previous-host (concat "^" (regexp-quote host) "$"))))) | 4665 | (setq previous-host (concat "^" (regexp-quote host) "$"))))) |
| @@ -4879,7 +4892,7 @@ connection if a previous connection has died for some reason." | |||
| 4879 | 4892 | ||
| 4880 | ;; Check, whether there is a restricted shell. | 4893 | ;; Check, whether there is a restricted shell. |
| 4881 | (dolist (elt tramp-restricted-shell-hosts-alist) | 4894 | (dolist (elt tramp-restricted-shell-hosts-alist) |
| 4882 | (when (string-match elt current-host) | 4895 | (when (string-match-p elt current-host) |
| 4883 | (setq r-shell t))) | 4896 | (setq r-shell t))) |
| 4884 | (setq current-host l-host) | 4897 | (setq current-host l-host) |
| 4885 | 4898 | ||
| @@ -5121,82 +5134,85 @@ raises an error." | |||
| 5121 | Convert file mode bits to string and set virtual device number. | 5134 | Convert file mode bits to string and set virtual device number. |
| 5122 | Return ATTR." | 5135 | Return ATTR." |
| 5123 | (when attr | 5136 | (when attr |
| 5124 | ;; Remove color escape sequences from symlink. | 5137 | (save-match-data |
| 5125 | (when (stringp (car attr)) | 5138 | ;; Remove color escape sequences from symlink. |
| 5126 | (while (string-match tramp-display-escape-sequence-regexp (car attr)) | ||
| 5127 | (setcar attr (replace-match "" nil nil (car attr))))) | ||
| 5128 | ;; Convert uid and gid. Use `tramp-unknown-id-integer' as | ||
| 5129 | ;; indication of unusable value. | ||
| 5130 | (when (and (numberp (nth 2 attr)) (< (nth 2 attr) 0)) | ||
| 5131 | (setcar (nthcdr 2 attr) tramp-unknown-id-integer)) | ||
| 5132 | (when (and (floatp (nth 2 attr)) | ||
| 5133 | (<= (nth 2 attr) most-positive-fixnum)) | ||
| 5134 | (setcar (nthcdr 2 attr) (round (nth 2 attr)))) | ||
| 5135 | (when (and (numberp (nth 3 attr)) (< (nth 3 attr) 0)) | ||
| 5136 | (setcar (nthcdr 3 attr) tramp-unknown-id-integer)) | ||
| 5137 | (when (and (floatp (nth 3 attr)) | ||
| 5138 | (<= (nth 3 attr) most-positive-fixnum)) | ||
| 5139 | (setcar (nthcdr 3 attr) (round (nth 3 attr)))) | ||
| 5140 | ;; Convert last access time. | ||
| 5141 | (unless (listp (nth 4 attr)) | ||
| 5142 | (setcar (nthcdr 4 attr) (seconds-to-time (nth 4 attr)))) | ||
| 5143 | ;; Convert last modification time. | ||
| 5144 | (unless (listp (nth 5 attr)) | ||
| 5145 | (setcar (nthcdr 5 attr) (seconds-to-time (nth 5 attr)))) | ||
| 5146 | ;; Convert last status change time. | ||
| 5147 | (unless (listp (nth 6 attr)) | ||
| 5148 | (setcar (nthcdr 6 attr) (seconds-to-time (nth 6 attr)))) | ||
| 5149 | ;; Convert file size. | ||
| 5150 | (when (< (nth 7 attr) 0) | ||
| 5151 | (setcar (nthcdr 7 attr) -1)) | ||
| 5152 | (when (and (floatp (nth 7 attr)) | ||
| 5153 | (<= (nth 7 attr) most-positive-fixnum)) | ||
| 5154 | (setcar (nthcdr 7 attr) (round (nth 7 attr)))) | ||
| 5155 | ;; Convert file mode bits to string. | ||
| 5156 | (unless (stringp (nth 8 attr)) | ||
| 5157 | (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr))) | ||
| 5158 | (when (stringp (car attr)) | 5139 | (when (stringp (car attr)) |
| 5159 | (aset (nth 8 attr) 0 ?l))) | 5140 | (while (string-match tramp-display-escape-sequence-regexp (car attr)) |
| 5160 | ;; Convert directory indication bit. | 5141 | (setcar attr (replace-match "" nil nil (car attr))))) |
| 5161 | (when (string-match "^d" (nth 8 attr)) | 5142 | ;; Convert uid and gid. Use `tramp-unknown-id-integer' as |
| 5162 | (setcar attr t)) | 5143 | ;; indication of unusable value. |
| 5163 | ;; Convert symlink from `tramp-do-file-attributes-with-stat'. | 5144 | (when (and (numberp (nth 2 attr)) (< (nth 2 attr) 0)) |
| 5164 | ;; Decode also multibyte string. | 5145 | (setcar (nthcdr 2 attr) tramp-unknown-id-integer)) |
| 5165 | (when (consp (car attr)) | 5146 | (when (and (floatp (nth 2 attr)) |
| 5166 | (setcar attr | 5147 | (<= (nth 2 attr) most-positive-fixnum)) |
| 5167 | (and (stringp (caar attr)) | 5148 | (setcar (nthcdr 2 attr) (round (nth 2 attr)))) |
| 5168 | (string-match ".+ -> .\\(.+\\)." (caar attr)) | 5149 | (when (and (numberp (nth 3 attr)) (< (nth 3 attr) 0)) |
| 5169 | (decode-coding-string (match-string 1 (caar attr)) 'utf-8)))) | 5150 | (setcar (nthcdr 3 attr) tramp-unknown-id-integer)) |
| 5170 | ;; Set file's gid change bit. | 5151 | (when (and (floatp (nth 3 attr)) |
| 5171 | (setcar (nthcdr 9 attr) | 5152 | (<= (nth 3 attr) most-positive-fixnum)) |
| 5172 | (if (numberp (nth 3 attr)) | 5153 | (setcar (nthcdr 3 attr) (round (nth 3 attr)))) |
| 5173 | (not (= (nth 3 attr) | 5154 | ;; Convert last access time. |
| 5174 | (tramp-get-remote-gid vec 'integer))) | 5155 | (unless (listp (nth 4 attr)) |
| 5175 | (not (string-equal | 5156 | (setcar (nthcdr 4 attr) (seconds-to-time (nth 4 attr)))) |
| 5176 | (nth 3 attr) | 5157 | ;; Convert last modification time. |
| 5177 | (tramp-get-remote-gid vec 'string))))) | 5158 | (unless (listp (nth 5 attr)) |
| 5178 | ;; Convert inode. | 5159 | (setcar (nthcdr 5 attr) (seconds-to-time (nth 5 attr)))) |
| 5179 | (when (floatp (nth 10 attr)) | 5160 | ;; Convert last status change time. |
| 5180 | (setcar (nthcdr 10 attr) | 5161 | (unless (listp (nth 6 attr)) |
| 5181 | (condition-case nil | 5162 | (setcar (nthcdr 6 attr) (seconds-to-time (nth 6 attr)))) |
| 5182 | (let ((high (nth 10 attr)) | 5163 | ;; Convert file size. |
| 5183 | middle low) | 5164 | (when (< (nth 7 attr) 0) |
| 5184 | (if (<= high most-positive-fixnum) | 5165 | (setcar (nthcdr 7 attr) -1)) |
| 5185 | (floor high) | 5166 | (when (and (floatp (nth 7 attr)) |
| 5186 | ;; The low 16 bits. | 5167 | (<= (nth 7 attr) most-positive-fixnum)) |
| 5187 | (setq low (mod high #x10000) | 5168 | (setcar (nthcdr 7 attr) (round (nth 7 attr)))) |
| 5188 | high (/ high #x10000)) | 5169 | ;; Convert file mode bits to string. |
| 5170 | (unless (stringp (nth 8 attr)) | ||
| 5171 | (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr))) | ||
| 5172 | (when (stringp (car attr)) | ||
| 5173 | (aset (nth 8 attr) 0 ?l))) | ||
| 5174 | ;; Convert directory indication bit. | ||
| 5175 | (when (string-match-p "^d" (nth 8 attr)) | ||
| 5176 | (setcar attr t)) | ||
| 5177 | ;; Convert symlink from `tramp-do-file-attributes-with-stat'. | ||
| 5178 | ;; Decode also multibyte string. | ||
| 5179 | (when (consp (car attr)) | ||
| 5180 | (setcar attr | ||
| 5181 | (and (stringp (caar attr)) | ||
| 5182 | (string-match ".+ -> .\\(.+\\)." (caar attr)) | ||
| 5183 | (decode-coding-string | ||
| 5184 | (match-string 1 (caar attr)) 'utf-8)))) | ||
| 5185 | ;; Set file's gid change bit. | ||
| 5186 | (setcar (nthcdr 9 attr) | ||
| 5187 | (if (numberp (nth 3 attr)) | ||
| 5188 | (not (= (nth 3 attr) | ||
| 5189 | (tramp-get-remote-gid vec 'integer))) | ||
| 5190 | (not (string-equal | ||
| 5191 | (nth 3 attr) | ||
| 5192 | (tramp-get-remote-gid vec 'string))))) | ||
| 5193 | ;; Convert inode. | ||
| 5194 | (when (floatp (nth 10 attr)) | ||
| 5195 | (setcar (nthcdr 10 attr) | ||
| 5196 | (condition-case nil | ||
| 5197 | (let ((high (nth 10 attr)) | ||
| 5198 | middle low) | ||
| 5189 | (if (<= high most-positive-fixnum) | 5199 | (if (<= high most-positive-fixnum) |
| 5190 | (cons (floor high) (floor low)) | 5200 | (floor high) |
| 5191 | ;; The middle 24 bits. | 5201 | ;; The low 16 bits. |
| 5192 | (setq middle (mod high #x1000000) | 5202 | (setq low (mod high #x10000) |
| 5193 | high (/ high #x1000000)) | 5203 | high (/ high #x10000)) |
| 5194 | (cons (floor high) (cons (floor middle) (floor low)))))) | 5204 | (if (<= high most-positive-fixnum) |
| 5195 | ;; Inodes can be incredible huge. We must hide this. | 5205 | (cons (floor high) (floor low)) |
| 5196 | (error (tramp-get-inode vec))))) | 5206 | ;; The middle 24 bits. |
| 5197 | ;; Set virtual device number. | 5207 | (setq middle (mod high #x1000000) |
| 5198 | (setcar (nthcdr 11 attr) | 5208 | high (/ high #x1000000)) |
| 5199 | (tramp-get-device vec)) | 5209 | (cons (floor high) |
| 5210 | (cons (floor middle) (floor low)))))) | ||
| 5211 | ;; Inodes can be incredible huge. We must hide this. | ||
| 5212 | (error (tramp-get-inode vec))))) | ||
| 5213 | ;; Set virtual device number. | ||
| 5214 | (setcar (nthcdr 11 attr) | ||
| 5215 | (tramp-get-device vec))) | ||
| 5200 | attr)) | 5216 | attr)) |
| 5201 | 5217 | ||
| 5202 | (defun tramp-shell-case-fold (string) | 5218 | (defun tramp-shell-case-fold (string) |
| @@ -5216,9 +5232,9 @@ Return ATTR." | |||
| 5216 | (host (tramp-file-name-host vec)) | 5232 | (host (tramp-file-name-host vec)) |
| 5217 | (localname | 5233 | (localname |
| 5218 | (directory-file-name (tramp-file-name-unquote-localname vec)))) | 5234 | (directory-file-name (tramp-file-name-unquote-localname vec)))) |
| 5219 | (when (string-match tramp-ipv6-regexp host) | 5235 | (when (string-match-p tramp-ipv6-regexp host) |
| 5220 | (setq host (format "[%s]" host))) | 5236 | (setq host (format "[%s]" host))) |
| 5221 | (unless (string-match "ftp$" method) | 5237 | (unless (string-match-p "ftp$" method) |
| 5222 | (setq localname (tramp-shell-quote-argument localname))) | 5238 | (setq localname (tramp-shell-quote-argument localname))) |
| 5223 | (cond | 5239 | (cond |
| 5224 | ((tramp-get-method-parameter vec 'tramp-remote-copy-program) | 5240 | ((tramp-get-method-parameter vec 'tramp-remote-copy-program) |
| @@ -5336,8 +5352,8 @@ Nonexistent directories are removed from spec." | |||
| 5336 | (with-current-buffer (tramp-get-connection-buffer vec) | 5352 | (with-current-buffer (tramp-get-connection-buffer vec) |
| 5337 | (while candidates | 5353 | (while candidates |
| 5338 | (goto-char (point-min)) | 5354 | (goto-char (point-min)) |
| 5339 | (if (string-match (format "^%s\r?$" (regexp-quote (car candidates))) | 5355 | (if (string-match-p (format "^%s\r?$" (regexp-quote (car candidates))) |
| 5340 | (buffer-string)) | 5356 | (buffer-string)) |
| 5341 | (setq locale (car candidates) | 5357 | (setq locale (car candidates) |
| 5342 | candidates nil) | 5358 | candidates nil) |
| 5343 | (setq candidates (cdr candidates))))) | 5359 | (setq candidates (cdr candidates))))) |
| @@ -5408,7 +5424,7 @@ Nonexistent directories are removed from spec." | |||
| 5408 | vec (format "( %s / -nt / )" (tramp-get-test-command vec))) | 5424 | vec (format "( %s / -nt / )" (tramp-get-test-command vec))) |
| 5409 | (with-current-buffer (tramp-get-buffer vec) | 5425 | (with-current-buffer (tramp-get-buffer vec) |
| 5410 | (goto-char (point-min)) | 5426 | (goto-char (point-min)) |
| 5411 | (when (looking-at (regexp-quote tramp-end-of-output)) | 5427 | (when (looking-at-p (regexp-quote tramp-end-of-output)) |
| 5412 | (format "%s %%s -nt %%s" (tramp-get-test-command vec))))) | 5428 | (format "%s %%s -nt %%s" (tramp-get-test-command vec))))) |
| 5413 | (progn | 5429 | (progn |
| 5414 | (tramp-send-command | 5430 | (tramp-send-command |
| @@ -5470,7 +5486,7 @@ Nonexistent directories are removed from spec." | |||
| 5470 | tmp (tramp-send-command-and-read | 5486 | tmp (tramp-send-command-and-read |
| 5471 | vec (format "%s -c '(\"%%N\" %%s)' /" result) 'noerror)) | 5487 | vec (format "%s -c '(\"%%N\" %%s)' /" result) 'noerror)) |
| 5472 | (unless (and (listp tmp) (stringp (car tmp)) | 5488 | (unless (and (listp tmp) (stringp (car tmp)) |
| 5473 | (string-match "^\\(`/'\\|‘/’\\)$" (car tmp)) | 5489 | (string-match-p "^\\(`/'\\|‘/’\\)$" (car tmp)) |
| 5474 | (integerp (cadr tmp))) | 5490 | (integerp (cadr tmp))) |
| 5475 | (setq result nil))) | 5491 | (setq result nil))) |
| 5476 | result))) | 5492 | result))) |
| @@ -5721,14 +5737,14 @@ function cell is returned to be applied on a buffer." | |||
| 5721 | (tramp-find-inline-encoding vec) | 5737 | (tramp-find-inline-encoding vec) |
| 5722 | (tramp-get-connection-property | 5738 | (tramp-get-connection-property |
| 5723 | (tramp-get-connection-process vec) prop nil))) | 5739 | (tramp-get-connection-process vec) prop nil))) |
| 5724 | (prop1 (if (string-match "encoding" prop) | 5740 | (prop1 (if (string-match-p "encoding" prop) |
| 5725 | "inline-compress" "inline-decompress")) | 5741 | "inline-compress" "inline-decompress")) |
| 5726 | compress) | 5742 | compress) |
| 5727 | ;; The connection property might have been cached. So we must | 5743 | ;; The connection property might have been cached. So we must |
| 5728 | ;; send the script to the remote side - maybe. | 5744 | ;; send the script to the remote side - maybe. |
| 5729 | (when (and coding (symbolp coding) (string-match "remote" prop)) | 5745 | (when (and coding (symbolp coding) (string-match-p "remote" prop)) |
| 5730 | (let ((name (symbol-name coding))) | 5746 | (let ((name (symbol-name coding))) |
| 5731 | (while (string-match (regexp-quote "-") name) | 5747 | (while (string-match "-" name) |
| 5732 | (setq name (replace-match "_" nil t name))) | 5748 | (setq name (replace-match "_" nil t name))) |
| 5733 | (tramp-maybe-send-script vec (symbol-value coding) name) | 5749 | (tramp-maybe-send-script vec (symbol-value coding) name) |
| 5734 | (setq coding name))) | 5750 | (setq coding name))) |
| @@ -5738,7 +5754,7 @@ function cell is returned to be applied on a buffer." | |||
| 5738 | ;; Return the value. | 5754 | ;; Return the value. |
| 5739 | (cond | 5755 | (cond |
| 5740 | ((and compress (symbolp coding)) | 5756 | ((and compress (symbolp coding)) |
| 5741 | (if (string-match "decompress" prop1) | 5757 | (if (string-match-p "decompress" prop1) |
| 5742 | `(lambda (beg end) | 5758 | `(lambda (beg end) |
| 5743 | (,coding beg end) | 5759 | (,coding beg end) |
| 5744 | (let ((coding-system-for-write 'binary) | 5760 | (let ((coding-system-for-write 'binary) |
| @@ -5757,16 +5773,16 @@ function cell is returned to be applied on a buffer." | |||
| 5757 | (,coding (point-min) (point-max))))) | 5773 | (,coding (point-min) (point-max))))) |
| 5758 | ((symbolp coding) | 5774 | ((symbolp coding) |
| 5759 | coding) | 5775 | coding) |
| 5760 | ((and compress (string-match "decoding" prop)) | 5776 | ((and compress (string-match-p "decoding" prop)) |
| 5761 | (format | 5777 | (format |
| 5762 | ;; Windows shells need the program file name after | 5778 | ;; Windows shells need the program file name after |
| 5763 | ;; the pipe symbol be quoted if they use forward | 5779 | ;; the pipe symbol be quoted if they use forward |
| 5764 | ;; slashes as directory separators. | 5780 | ;; slashes as directory separators. |
| 5765 | (cond | 5781 | (cond |
| 5766 | ((and (string-match "local" prop) | 5782 | ((and (string-match-p "local" prop) |
| 5767 | (memq system-type '(windows-nt))) | 5783 | (memq system-type '(windows-nt))) |
| 5768 | "(%s | \"%s\")") | 5784 | "(%s | \"%s\")") |
| 5769 | ((string-match "local" prop) "(%s | %s)") | 5785 | ((string-match-p "local" prop) "(%s | %s)") |
| 5770 | (t "(%s | %s >%%s)")) | 5786 | (t "(%s | %s >%%s)")) |
| 5771 | coding compress)) | 5787 | coding compress)) |
| 5772 | (compress | 5788 | (compress |
| @@ -5774,14 +5790,14 @@ function cell is returned to be applied on a buffer." | |||
| 5774 | ;; Windows shells need the program file name after | 5790 | ;; Windows shells need the program file name after |
| 5775 | ;; the pipe symbol be quoted if they use forward | 5791 | ;; the pipe symbol be quoted if they use forward |
| 5776 | ;; slashes as directory separators. | 5792 | ;; slashes as directory separators. |
| 5777 | (if (and (string-match "local" prop) | 5793 | (if (and (string-match-p "local" prop) |
| 5778 | (memq system-type '(windows-nt))) | 5794 | (memq system-type '(windows-nt))) |
| 5779 | "(%s <%%s | \"%s\")" | 5795 | "(%s <%%s | \"%s\")" |
| 5780 | "(%s <%%s | %s)") | 5796 | "(%s <%%s | %s)") |
| 5781 | compress coding)) | 5797 | compress coding)) |
| 5782 | ((string-match "decoding" prop) | 5798 | ((string-match-p "decoding" prop) |
| 5783 | (cond | 5799 | (cond |
| 5784 | ((string-match "local" prop) (format "%s" coding)) | 5800 | ((string-match-p "local" prop) (format "%s" coding)) |
| 5785 | (t (format "%s >%%s" coding)))) | 5801 | (t (format "%s >%%s" coding)))) |
| 5786 | (t | 5802 | (t |
| 5787 | (format "%s <%%s" coding))))))) | 5803 | (format "%s <%%s" coding))))))) |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index d1a922813db..5b7998ac970 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -677,7 +677,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 677 | (when match | 677 | (when match |
| 678 | (setq result | 678 | (setq result |
| 679 | (delete nil | 679 | (delete nil |
| 680 | (mapcar (lambda (x) (when (string-match match x) x)) | 680 | (mapcar (lambda (x) (when (string-match-p match x) x)) |
| 681 | result)))) | 681 | result)))) |
| 682 | ;; Append directory. | 682 | ;; Append directory. |
| 683 | (when full | 683 | (when full |
| @@ -728,10 +728,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 728 | (widen) | 728 | (widen) |
| 729 | (tramp-message vec 10 "\n%s" (buffer-string)) | 729 | (tramp-message vec 10 "\n%s" (buffer-string)) |
| 730 | (goto-char (point-min)) | 730 | (goto-char (point-min)) |
| 731 | (while (and (not (eobp)) (not (looking-at "^REVISION:"))) | 731 | (while (and (not (eobp)) (not (looking-at-p "^REVISION:"))) |
| 732 | (forward-line) | 732 | (forward-line) |
| 733 | (delete-region (point-min) (point))) | 733 | (delete-region (point-min) (point))) |
| 734 | (while (and (not (eobp)) (looking-at "^.+:.+")) | 734 | (while (and (not (eobp)) (looking-at-p "^.+:.+")) |
| 735 | (forward-line)) | 735 | (forward-line)) |
| 736 | (delete-region (point) (point-max)) | 736 | (delete-region (point) (point-max)) |
| 737 | (throw 'tramp-action 'ok)))) | 737 | (throw 'tramp-action 'ok)))) |
| @@ -816,7 +816,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 816 | 816 | ||
| 817 | ;; Check result. | 817 | ;; Check result. |
| 818 | (when entry | 818 | (when entry |
| 819 | (list (and (string-match "d" (nth 1 entry)) | 819 | (list (and (string-match-p "d" (nth 1 entry)) |
| 820 | t) ;0 file type | 820 | t) ;0 file type |
| 821 | -1 ;1 link count | 821 | -1 ;1 link count |
| 822 | uid ;2 uid | 822 | uid ;2 uid |
| @@ -933,15 +933,14 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 933 | filename | 933 | filename |
| 934 | (with-parsed-tramp-file-name (expand-file-name directory) nil | 934 | (with-parsed-tramp-file-name (expand-file-name directory) nil |
| 935 | (with-tramp-file-property v localname "file-name-all-completions" | 935 | (with-tramp-file-property v localname "file-name-all-completions" |
| 936 | (save-match-data | 936 | (delete-dups |
| 937 | (delete-dups | 937 | (mapcar |
| 938 | (mapcar | 938 | (lambda (x) |
| 939 | (lambda (x) | 939 | (list |
| 940 | (list | 940 | (if (string-match-p "d" (nth 1 x)) |
| 941 | (if (string-match "d" (nth 1 x)) | 941 | (file-name-as-directory (nth 0 x)) |
| 942 | (file-name-as-directory (nth 0 x)) | 942 | (nth 0 x)))) |
| 943 | (nth 0 x)))) | 943 | (tramp-smb-get-file-entries directory))))))) |
| 944 | (tramp-smb-get-file-entries directory)))))))) | ||
| 945 | 944 | ||
| 946 | (defun tramp-smb-handle-file-system-info (filename) | 945 | (defun tramp-smb-handle-file-system-info (filename) |
| 947 | "Like `file-system-info' for Tramp files." | 946 | "Like `file-system-info' for Tramp files." |
| @@ -956,9 +955,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 956 | (goto-char (point-min)) | 955 | (goto-char (point-min)) |
| 957 | (forward-line) | 956 | (forward-line) |
| 958 | (when (looking-at | 957 | (when (looking-at |
| 959 | (concat "[[:space:]]*\\([[:digit:]]+\\)" | 958 | (eval-when-compile |
| 960 | " blocks of size \\([[:digit:]]+\\)" | 959 | (concat "[[:space:]]*\\([[:digit:]]+\\)" |
| 961 | "\\. \\([[:digit:]]+\\) blocks available")) | 960 | " blocks of size \\([[:digit:]]+\\)" |
| 961 | "\\. \\([[:digit:]]+\\) blocks available"))) | ||
| 962 | (setq blocksize (string-to-number (match-string 2)) | 962 | (setq blocksize (string-to-number (match-string 2)) |
| 963 | total (* blocksize (string-to-number (match-string 1))) | 963 | total (* blocksize (string-to-number (match-string 1))) |
| 964 | avail (* blocksize (string-to-number (match-string 3))))) | 964 | avail (* blocksize (string-to-number (match-string 3))))) |
| @@ -975,7 +975,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 975 | (defun tramp-smb-handle-file-writable-p (filename) | 975 | (defun tramp-smb-handle-file-writable-p (filename) |
| 976 | "Like `file-writable-p' for Tramp files." | 976 | "Like `file-writable-p' for Tramp files." |
| 977 | (if (file-exists-p filename) | 977 | (if (file-exists-p filename) |
| 978 | (string-match | 978 | (string-match-p |
| 979 | "w" | 979 | "w" |
| 980 | (or (tramp-compat-file-attribute-modes (file-attributes filename)) "")) | 980 | (or (tramp-compat-file-attribute-modes (file-attributes filename)) "")) |
| 981 | (let ((dir (file-name-directory filename))) | 981 | (let ((dir (file-name-directory filename))) |
| @@ -1027,7 +1027,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 1027 | ;; Check for matching entries. | 1027 | ;; Check for matching entries. |
| 1028 | (mapcar | 1028 | (mapcar |
| 1029 | (lambda (x) | 1029 | (lambda (x) |
| 1030 | (when (string-match | 1030 | (when (string-match-p |
| 1031 | (format "^%s" base) (nth 0 x)) | 1031 | (format "^%s" base) (nth 0 x)) |
| 1032 | x)) | 1032 | x)) |
| 1033 | entries) | 1033 | entries) |
| @@ -1039,14 +1039,14 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 1039 | (sort | 1039 | (sort |
| 1040 | entries | 1040 | entries |
| 1041 | (lambda (x y) | 1041 | (lambda (x y) |
| 1042 | (if (string-match "t" switches) | 1042 | (if (string-match-p "t" switches) |
| 1043 | ;; Sort by date. | 1043 | ;; Sort by date. |
| 1044 | (time-less-p (nth 3 y) (nth 3 x)) | 1044 | (time-less-p (nth 3 y) (nth 3 x)) |
| 1045 | ;; Sort by name. | 1045 | ;; Sort by name. |
| 1046 | (string-lessp (nth 0 x) (nth 0 y)))))) | 1046 | (string-lessp (nth 0 x) (nth 0 y)))))) |
| 1047 | 1047 | ||
| 1048 | ;; Handle "-F" switch. | 1048 | ;; Handle "-F" switch. |
| 1049 | (when (string-match "F" switches) | 1049 | (when (string-match-p "F" switches) |
| 1050 | (mapc | 1050 | (mapc |
| 1051 | (lambda (x) | 1051 | (lambda (x) |
| 1052 | (when (not (zerop (length (car x)))) | 1052 | (when (not (zerop (length (car x)))) |
| @@ -1075,7 +1075,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 1075 | (expand-file-name | 1075 | (expand-file-name |
| 1076 | (nth 0 x) (file-name-directory filename)) | 1076 | (nth 0 x) (file-name-directory filename)) |
| 1077 | 'string))))) | 1077 | 'string))))) |
| 1078 | (when (string-match "l" switches) | 1078 | (when (string-match-p "l" switches) |
| 1079 | (insert | 1079 | (insert |
| 1080 | (format | 1080 | (format |
| 1081 | "%10s %3d %-8s %-8s %8s %s " | 1081 | "%10s %3d %-8s %-8s %8s %s " |
| @@ -1106,7 +1106,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 1106 | (put-text-property start (point) 'dired-filename t)) | 1106 | (put-text-property start (point) 'dired-filename t)) |
| 1107 | 1107 | ||
| 1108 | ;; Insert symlink. | 1108 | ;; Insert symlink. |
| 1109 | (when (and (string-match "l" switches) | 1109 | (when (and (string-match-p "l" switches) |
| 1110 | (stringp (tramp-compat-file-attribute-type attr))) | 1110 | (stringp (tramp-compat-file-attribute-type attr))) |
| 1111 | (insert " -> " (tramp-compat-file-attribute-type attr)))) | 1111 | (insert " -> " (tramp-compat-file-attribute-type attr)))) |
| 1112 | 1112 | ||
| @@ -1121,18 +1121,17 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 1121 | (unless (file-name-absolute-p dir) | 1121 | (unless (file-name-absolute-p dir) |
| 1122 | (setq dir (expand-file-name dir default-directory))) | 1122 | (setq dir (expand-file-name dir default-directory))) |
| 1123 | (with-parsed-tramp-file-name dir nil | 1123 | (with-parsed-tramp-file-name dir nil |
| 1124 | (save-match-data | 1124 | (let* ((ldir (file-name-directory dir))) |
| 1125 | (let* ((ldir (file-name-directory dir))) | 1125 | ;; Make missing directory parts. |
| 1126 | ;; Make missing directory parts. | 1126 | (when (and parents |
| 1127 | (when (and parents | 1127 | (tramp-smb-get-share v) |
| 1128 | (tramp-smb-get-share v) | 1128 | (not (file-directory-p ldir))) |
| 1129 | (not (file-directory-p ldir))) | 1129 | (make-directory ldir parents)) |
| 1130 | (make-directory ldir parents)) | 1130 | ;; Just do it. |
| 1131 | ;; Just do it. | 1131 | (when (file-directory-p ldir) |
| 1132 | (when (file-directory-p ldir) | 1132 | (make-directory-internal dir)) |
| 1133 | (make-directory-internal dir)) | 1133 | (unless (file-directory-p dir) |
| 1134 | (unless (file-directory-p dir) | 1134 | (tramp-error v 'file-error "Couldn't make directory %s" dir))))) |
| 1135 | (tramp-error v 'file-error "Couldn't make directory %s" dir)))))) | ||
| 1136 | 1135 | ||
| 1137 | (defun tramp-smb-handle-make-directory-internal (directory) | 1136 | (defun tramp-smb-handle-make-directory-internal (directory) |
| 1138 | "Like `make-directory-internal' for Tramp files." | 1137 | "Like `make-directory-internal' for Tramp files." |
| @@ -1140,21 +1139,19 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 1140 | (unless (file-name-absolute-p directory) | 1139 | (unless (file-name-absolute-p directory) |
| 1141 | (setq directory (expand-file-name directory default-directory))) | 1140 | (setq directory (expand-file-name directory default-directory))) |
| 1142 | (with-parsed-tramp-file-name directory nil | 1141 | (with-parsed-tramp-file-name directory nil |
| 1143 | (save-match-data | 1142 | (let* ((file (tramp-smb-get-localname v))) |
| 1144 | (let* ((file (tramp-smb-get-localname v))) | 1143 | (when (file-directory-p (file-name-directory directory)) |
| 1145 | (when (file-directory-p (file-name-directory directory)) | 1144 | (tramp-smb-send-command |
| 1146 | (tramp-smb-send-command | 1145 | v |
| 1147 | v | 1146 | (if (tramp-smb-get-cifs-capabilities v) |
| 1148 | (if (tramp-smb-get-cifs-capabilities v) | 1147 | (format "posix_mkdir \"%s\" %o" file (default-file-modes)) |
| 1149 | (format "posix_mkdir \"%s\" %o" file (default-file-modes)) | 1148 | (format "mkdir \"%s\"" file))) |
| 1150 | (format "mkdir \"%s\"" file))) | 1149 | ;; We must also flush the cache of the directory, because |
| 1151 | ;; We must also flush the cache of the directory, because | 1150 | ;; `file-attributes' reads the values from there. |
| 1152 | ;; `file-attributes' reads the values from there. | 1151 | (tramp-flush-file-properties v (file-name-directory localname)) |
| 1153 | (tramp-flush-file-properties v (file-name-directory localname)) | 1152 | (tramp-flush-file-properties v localname)) |
| 1154 | (tramp-flush-file-properties v localname)) | 1153 | (unless (file-directory-p directory) |
| 1155 | (unless (file-directory-p directory) | 1154 | (tramp-error v 'file-error "Couldn't make directory %s" directory))))) |
| 1156 | (tramp-error | ||
| 1157 | v 'file-error "Couldn't make directory %s" directory)))))) | ||
| 1158 | 1155 | ||
| 1159 | (defun tramp-smb-handle-make-symbolic-link | 1156 | (defun tramp-smb-handle-make-symbolic-link |
| 1160 | (target linkname &optional ok-if-already-exists) | 1157 | (target linkname &optional ok-if-already-exists) |
| @@ -1510,7 +1507,7 @@ component is used as the target of the symlink." | |||
| 1510 | 1507 | ||
| 1511 | ;; Save exit. | 1508 | ;; Save exit. |
| 1512 | (with-current-buffer (tramp-get-connection-buffer v) | 1509 | (with-current-buffer (tramp-get-connection-buffer v) |
| 1513 | (if (string-match tramp-temp-buffer-name (buffer-name)) | 1510 | (if (string-match-p tramp-temp-buffer-name (buffer-name)) |
| 1514 | (progn | 1511 | (progn |
| 1515 | (set-process-buffer (tramp-get-connection-process v) nil) | 1512 | (set-process-buffer (tramp-get-connection-process v) nil) |
| 1516 | (kill-buffer (current-buffer))) | 1513 | (kill-buffer (current-buffer))) |
| @@ -1621,7 +1618,7 @@ If VEC has no cifs capabilities, exchange \"/\" by \"\\\\\"." | |||
| 1621 | 1618 | ||
| 1622 | ;; A period followed by a space, or trailing periods and spaces, | 1619 | ;; A period followed by a space, or trailing periods and spaces, |
| 1623 | ;; are not supported. | 1620 | ;; are not supported. |
| 1624 | (when (string-match "\\. \\|\\.$\\| $" localname) | 1621 | (when (string-match-p "\\. \\|\\.$\\| $" localname) |
| 1625 | (tramp-error | 1622 | (tramp-error |
| 1626 | vec 'file-error | 1623 | vec 'file-error |
| 1627 | "Invalid file name %s" (tramp-make-tramp-file-name vec localname))) | 1624 | "Invalid file name %s" (tramp-make-tramp-file-name vec localname))) |
| @@ -1775,7 +1772,7 @@ Result is the list (LOCALNAME MODE SIZE MTIME)." | |||
| 1775 | (cl-return)) | 1772 | (cl-return)) |
| 1776 | 1773 | ||
| 1777 | ;; weekday. | 1774 | ;; weekday. |
| 1778 | (if (string-match "\\(\\w+\\)$" line) | 1775 | (if (string-match-p "\\(\\w+\\)$" line) |
| 1779 | (setq line (substring line 0 -5)) | 1776 | (setq line (substring line 0 -5)) |
| 1780 | (cl-return)) | 1777 | (cl-return)) |
| 1781 | 1778 | ||
| @@ -2086,7 +2083,6 @@ Returns nil if an error message has appeared." | |||
| 2086 | 2083 | ||
| 2087 | (defun tramp-smb-call-winexe (vec) | 2084 | (defun tramp-smb-call-winexe (vec) |
| 2088 | "Apply a remote command, if possible, using `tramp-smb-winexe-program'." | 2085 | "Apply a remote command, if possible, using `tramp-smb-winexe-program'." |
| 2089 | |||
| 2090 | ;; Check for program. | 2086 | ;; Check for program. |
| 2091 | (unless (executable-find tramp-smb-winexe-program) | 2087 | (unless (executable-find tramp-smb-winexe-program) |
| 2092 | (tramp-error | 2088 | (tramp-error |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index ab30a43de0d..02870faf649 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1290,8 +1290,8 @@ This is METHOD, if non-nil. Otherwise, do a lookup in | |||
| 1290 | lmethod item) | 1290 | lmethod item) |
| 1291 | (while choices | 1291 | (while choices |
| 1292 | (setq item (pop choices)) | 1292 | (setq item (pop choices)) |
| 1293 | (when (and (string-match (or (nth 0 item) "") (or host "")) | 1293 | (when (and (string-match-p (or (nth 0 item) "") (or host "")) |
| 1294 | (string-match (or (nth 1 item) "") (or user ""))) | 1294 | (string-match-p (or (nth 1 item) "") (or user ""))) |
| 1295 | (setq lmethod (nth 2 item)) | 1295 | (setq lmethod (nth 2 item)) |
| 1296 | (setq choices nil))) | 1296 | (setq choices nil))) |
| 1297 | lmethod) | 1297 | lmethod) |
| @@ -1311,8 +1311,8 @@ This is USER, if non-nil. Otherwise, do a lookup in | |||
| 1311 | luser item) | 1311 | luser item) |
| 1312 | (while choices | 1312 | (while choices |
| 1313 | (setq item (pop choices)) | 1313 | (setq item (pop choices)) |
| 1314 | (when (and (string-match (or (nth 0 item) "") (or method "")) | 1314 | (when (and (string-match-p (or (nth 0 item) "") (or method "")) |
| 1315 | (string-match (or (nth 1 item) "") (or host ""))) | 1315 | (string-match-p (or (nth 1 item) "") (or host ""))) |
| 1316 | (setq luser (nth 2 item)) | 1316 | (setq luser (nth 2 item)) |
| 1317 | (setq choices nil))) | 1317 | (setq choices nil))) |
| 1318 | luser) | 1318 | luser) |
| @@ -1332,8 +1332,8 @@ This is HOST, if non-nil. Otherwise, do a lookup in | |||
| 1332 | lhost item) | 1332 | lhost item) |
| 1333 | (while choices | 1333 | (while choices |
| 1334 | (setq item (pop choices)) | 1334 | (setq item (pop choices)) |
| 1335 | (when (and (string-match (or (nth 0 item) "") (or method "")) | 1335 | (when (and (string-match-p (or (nth 0 item) "") (or method "")) |
| 1336 | (string-match (or (nth 1 item) "") (or user ""))) | 1336 | (string-match-p (or (nth 1 item) "") (or user ""))) |
| 1337 | (setq lhost (nth 2 item)) | 1337 | (setq lhost (nth 2 item)) |
| 1338 | (setq choices nil))) | 1338 | (setq choices nil))) |
| 1339 | lhost) | 1339 | lhost) |
| @@ -1381,7 +1381,7 @@ default values are used." | |||
| 1381 | (setq v (tramp-dissect-hop-name hop) | 1381 | (setq v (tramp-dissect-hop-name hop) |
| 1382 | hop (and hop (tramp-make-tramp-hop-name v)))) | 1382 | hop (and hop (tramp-make-tramp-hop-name v)))) |
| 1383 | (let ((tramp-default-host | 1383 | (let ((tramp-default-host |
| 1384 | (or (and v (not (string-match "%h" (tramp-file-name-host v))) | 1384 | (or (and v (not (string-match-p "%h" (tramp-file-name-host v))) |
| 1385 | (tramp-file-name-host v)) | 1385 | (tramp-file-name-host v)) |
| 1386 | tramp-default-host))) | 1386 | tramp-default-host))) |
| 1387 | (setq method (tramp-find-method method user host) | 1387 | (setq method (tramp-find-method method user host) |
| @@ -1481,7 +1481,7 @@ the form (METHOD USER DOMAIN HOST PORT LOCALNAME &optional HOP)." | |||
| 1481 | (unless (zerop (length user)) | 1481 | (unless (zerop (length user)) |
| 1482 | tramp-postfix-user-format) | 1482 | tramp-postfix-user-format) |
| 1483 | (when host | 1483 | (when host |
| 1484 | (if (string-match tramp-ipv6-regexp host) | 1484 | (if (string-match-p tramp-ipv6-regexp host) |
| 1485 | (concat | 1485 | (concat |
| 1486 | tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) | 1486 | tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) |
| 1487 | host)) | 1487 | host)) |
| @@ -1510,7 +1510,7 @@ necessary only. This function will be used in file name completion." | |||
| 1510 | (concat user tramp-postfix-user-format)) | 1510 | (concat user tramp-postfix-user-format)) |
| 1511 | (unless (zerop (length host)) | 1511 | (unless (zerop (length host)) |
| 1512 | (concat | 1512 | (concat |
| 1513 | (if (string-match tramp-ipv6-regexp host) | 1513 | (if (string-match-p tramp-ipv6-regexp host) |
| 1514 | (concat | 1514 | (concat |
| 1515 | tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) | 1515 | tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) |
| 1516 | host) | 1516 | host) |
| @@ -1655,22 +1655,23 @@ ARGUMENTS to actually emit the message (if applicable)." | |||
| 1655 | (setq fn (symbol-name btf)) | 1655 | (setq fn (symbol-name btf)) |
| 1656 | (unless | 1656 | (unless |
| 1657 | (and | 1657 | (and |
| 1658 | (string-match "^tramp" fn) | 1658 | (string-match-p "^tramp" fn) |
| 1659 | (not | 1659 | (not |
| 1660 | (string-match | 1660 | (string-match-p |
| 1661 | (concat | 1661 | (eval-when-compile |
| 1662 | "^" | 1662 | (concat |
| 1663 | (regexp-opt | 1663 | "^" |
| 1664 | '("tramp-backtrace" | 1664 | (regexp-opt |
| 1665 | "tramp-compat-funcall" | 1665 | '("tramp-backtrace" |
| 1666 | "tramp-condition-case-unless-debug" | 1666 | "tramp-compat-funcall" |
| 1667 | "tramp-debug-message" | 1667 | "tramp-condition-case-unless-debug" |
| 1668 | "tramp-error" | 1668 | "tramp-debug-message" |
| 1669 | "tramp-error-with-buffer" | 1669 | "tramp-error" |
| 1670 | "tramp-message" | 1670 | "tramp-error-with-buffer" |
| 1671 | "tramp-user-error") | 1671 | "tramp-message" |
| 1672 | t) | 1672 | "tramp-user-error") |
| 1673 | "$") | 1673 | t) |
| 1674 | "$")) | ||
| 1674 | fn))) | 1675 | fn))) |
| 1675 | (setq fn nil))) | 1676 | (setq fn nil))) |
| 1676 | (setq btn (1+ btn)))) | 1677 | (setq btn (1+ btn)))) |
| @@ -1708,39 +1709,37 @@ control string and the remaining ARGUMENTS to actually emit the message (if | |||
| 1708 | applicable)." | 1709 | applicable)." |
| 1709 | (ignore-errors | 1710 | (ignore-errors |
| 1710 | (when (<= level tramp-verbose) | 1711 | (when (<= level tramp-verbose) |
| 1711 | ;; Match data must be preserved! | 1712 | ;; Display only when there is a minimum level. |
| 1712 | (save-match-data | 1713 | (when (and tramp-message-show-message (<= level 3)) |
| 1713 | ;; Display only when there is a minimum level. | 1714 | (apply 'message |
| 1714 | (when (and tramp-message-show-message (<= level 3)) | 1715 | (concat |
| 1715 | (apply 'message | 1716 | (cond |
| 1716 | (concat | 1717 | ((= level 0) "") |
| 1717 | (cond | 1718 | ((= level 1) "") |
| 1718 | ((= level 0) "") | 1719 | ((= level 2) "Warning: ") |
| 1719 | ((= level 1) "") | 1720 | (t "Tramp: ")) |
| 1720 | ((= level 2) "Warning: ") | 1721 | fmt-string) |
| 1721 | (t "Tramp: ")) | 1722 | arguments)) |
| 1722 | fmt-string) | 1723 | ;; Log only when there is a minimum level. |
| 1723 | arguments)) | 1724 | (when (>= tramp-verbose 4) |
| 1724 | ;; Log only when there is a minimum level. | 1725 | (let ((tramp-verbose 0)) |
| 1725 | (when (>= tramp-verbose 4) | 1726 | ;; Append connection buffer for error messages. |
| 1726 | (let ((tramp-verbose 0)) | 1727 | (when (= level 1) |
| 1727 | ;; Append connection buffer for error messages. | 1728 | (with-current-buffer |
| 1728 | (when (= level 1) | 1729 | (if (processp vec-or-proc) |
| 1729 | (with-current-buffer | 1730 | (process-buffer vec-or-proc) |
| 1730 | (if (processp vec-or-proc) | 1731 | (tramp-get-connection-buffer vec-or-proc)) |
| 1731 | (process-buffer vec-or-proc) | 1732 | (setq fmt-string (concat fmt-string "\n%s") |
| 1732 | (tramp-get-connection-buffer vec-or-proc)) | 1733 | arguments (append arguments (list (buffer-string)))))) |
| 1733 | (setq fmt-string (concat fmt-string "\n%s") | 1734 | ;; Translate proc to vec. |
| 1734 | arguments (append arguments (list (buffer-string)))))) | 1735 | (when (processp vec-or-proc) |
| 1735 | ;; Translate proc to vec. | 1736 | (setq vec-or-proc (process-get vec-or-proc 'vector)))) |
| 1736 | (when (processp vec-or-proc) | 1737 | ;; Do it. |
| 1737 | (setq vec-or-proc (process-get vec-or-proc 'vector)))) | 1738 | (when (tramp-file-name-p vec-or-proc) |
| 1738 | ;; Do it. | 1739 | (apply 'tramp-debug-message |
| 1739 | (when (tramp-file-name-p vec-or-proc) | 1740 | vec-or-proc |
| 1740 | (apply 'tramp-debug-message | 1741 | (concat (format "(%d) # " level) fmt-string) |
| 1741 | vec-or-proc | 1742 | arguments)))))) |
| 1742 | (concat (format "(%d) # " level) fmt-string) | ||
| 1743 | arguments))))))) | ||
| 1744 | 1743 | ||
| 1745 | (defsubst tramp-backtrace (&optional vec-or-proc) | 1744 | (defsubst tramp-backtrace (&optional vec-or-proc) |
| 1746 | "Dump a backtrace into the debug buffer. | 1745 | "Dump a backtrace into the debug buffer. |
| @@ -1884,7 +1883,7 @@ If VAR is nil, then we bind `v' to the structure and `method', `user', | |||
| 1884 | "Report progress of an operation for Tramp." | 1883 | "Report progress of an operation for Tramp." |
| 1885 | (let* ((parameters (cdr reporter)) | 1884 | (let* ((parameters (cdr reporter)) |
| 1886 | (message (aref parameters 3))) | 1885 | (message (aref parameters 3))) |
| 1887 | (when (string-match message (or (current-message) "")) | 1886 | (when (string-match-p message (or (current-message) "")) |
| 1888 | (progress-reporter-update reporter value)))) | 1887 | (progress-reporter-update reporter value)))) |
| 1889 | 1888 | ||
| 1890 | (defmacro with-tramp-progress-reporter (vec level message &rest body) | 1889 | (defmacro with-tramp-progress-reporter (vec level message &rest body) |
| @@ -1979,7 +1978,6 @@ Example: | |||
| 1979 | \"ssh\" | 1978 | \"ssh\" |
| 1980 | \\='((tramp-parse-sconfig \"/etc/ssh_config\") | 1979 | \\='((tramp-parse-sconfig \"/etc/ssh_config\") |
| 1981 | (tramp-parse-sconfig \"~/.ssh/config\")))" | 1980 | (tramp-parse-sconfig \"~/.ssh/config\")))" |
| 1982 | |||
| 1983 | (let ((r function-list) | 1981 | (let ((r function-list) |
| 1984 | (v function-list)) | 1982 | (v function-list)) |
| 1985 | (setq tramp-completion-function-alist | 1983 | (setq tramp-completion-function-alist |
| @@ -1994,13 +1992,13 @@ Example: | |||
| 1994 | (unless (and (functionp (nth 0 (car v))) | 1992 | (unless (and (functionp (nth 0 (car v))) |
| 1995 | (cond | 1993 | (cond |
| 1996 | ;; Windows registry. | 1994 | ;; Windows registry. |
| 1997 | ((string-match "^HKEY_CURRENT_USER" (nth 1 (car v))) | 1995 | ((string-match-p "^HKEY_CURRENT_USER" (nth 1 (car v))) |
| 1998 | (and (memq system-type '(cygwin windows-nt)) | 1996 | (and (memq system-type '(cygwin windows-nt)) |
| 1999 | (zerop | 1997 | (zerop |
| 2000 | (tramp-call-process | 1998 | (tramp-call-process |
| 2001 | v "reg" nil nil nil "query" (nth 1 (car v)))))) | 1999 | v "reg" nil nil nil "query" (nth 1 (car v)))))) |
| 2002 | ;; Zeroconf service type. | 2000 | ;; Zeroconf service type. |
| 2003 | ((string-match | 2001 | ((string-match-p |
| 2004 | "^_[[:alpha:]]+\\._[[:alpha:]]+$" (nth 1 (car v)))) | 2002 | "^_[[:alpha:]]+\\._[[:alpha:]]+$" (nth 1 (car v)))) |
| 2005 | ;; Configuration file. | 2003 | ;; Configuration file. |
| 2006 | (t (file-exists-p (nth 1 (car v)))))) | 2004 | (t (file-exists-p (nth 1 (car v)))))) |
| @@ -2077,7 +2075,7 @@ been set up by `rfn-eshadow-setup-minibuffer'." | |||
| 2077 | (save-excursion | 2075 | (save-excursion |
| 2078 | (save-restriction | 2076 | (save-restriction |
| 2079 | (narrow-to-region | 2077 | (narrow-to-region |
| 2080 | (1+ (or (string-match | 2078 | (1+ (or (string-match-p |
| 2081 | (tramp-rfn-eshadow-update-overlay-regexp) | 2079 | (tramp-rfn-eshadow-update-overlay-regexp) |
| 2082 | (buffer-string) end) | 2080 | (buffer-string) end) |
| 2083 | end)) | 2081 | end)) |
| @@ -2145,7 +2143,7 @@ expression, which matches more than the file name suffix, the | |||
| 2145 | coding system might not be determined. This function repairs it." | 2143 | coding system might not be determined. This function repairs it." |
| 2146 | (let (result) | 2144 | (let (result) |
| 2147 | (dolist (elt file-coding-system-alist (nreverse result)) | 2145 | (dolist (elt file-coding-system-alist (nreverse result)) |
| 2148 | (when (and (consp elt) (string-match (car elt) filename)) | 2146 | (when (and (consp elt) (string-match-p (car elt) filename)) |
| 2149 | ;; We found a matching entry in `file-coding-system-alist'. | 2147 | ;; We found a matching entry in `file-coding-system-alist'. |
| 2150 | ;; So we add a similar entry, but with the temporary file name | 2148 | ;; So we add a similar entry, but with the temporary file name |
| 2151 | ;; as regexp. | 2149 | ;; as regexp. |
| @@ -2217,18 +2215,16 @@ ARGS are the arguments OPERATION has been called with." | |||
| 2217 | ;; file name to be checked. Handled properly in | 2215 | ;; file name to be checked. Handled properly in |
| 2218 | ;; `tramp-handle-*-make-symbolic-link'. | 2216 | ;; `tramp-handle-*-make-symbolic-link'. |
| 2219 | file-newer-than-file-p make-symbolic-link rename-file)) | 2217 | file-newer-than-file-p make-symbolic-link rename-file)) |
| 2220 | (save-match-data | 2218 | (cond |
| 2221 | (cond | 2219 | ((tramp-tramp-file-p (nth 0 args)) (nth 0 args)) |
| 2222 | ((tramp-tramp-file-p (nth 0 args)) (nth 0 args)) | 2220 | ((tramp-tramp-file-p (nth 1 args)) (nth 1 args)) |
| 2223 | ((tramp-tramp-file-p (nth 1 args)) (nth 1 args)) | 2221 | (t default-directory))) |
| 2224 | (t default-directory)))) | ||
| 2225 | ;; FILE DIRECTORY resp FILE1 FILE2. | 2222 | ;; FILE DIRECTORY resp FILE1 FILE2. |
| 2226 | ((eq operation 'expand-file-name) | 2223 | ((eq operation 'expand-file-name) |
| 2227 | (save-match-data | 2224 | (cond |
| 2228 | (cond | 2225 | ((file-name-absolute-p (nth 0 args)) (nth 0 args)) |
| 2229 | ((file-name-absolute-p (nth 0 args)) (nth 0 args)) | 2226 | ((tramp-tramp-file-p (nth 1 args)) (nth 1 args)) |
| 2230 | ((tramp-tramp-file-p (nth 1 args)) (nth 1 args)) | 2227 | (t default-directory))) |
| 2231 | (t default-directory)))) | ||
| 2232 | ;; START END FILE. | 2228 | ;; START END FILE. |
| 2233 | ((eq operation 'write-region) | 2229 | ((eq operation 'write-region) |
| 2234 | (if (file-name-absolute-p (nth 2 args)) | 2230 | (if (file-name-absolute-p (nth 2 args)) |
| @@ -2464,7 +2460,7 @@ remote file names." | |||
| 2464 | (lambda (atom) | 2460 | (lambda (atom) |
| 2465 | (when (and (functionp atom) | 2461 | (when (and (functionp atom) |
| 2466 | (autoloadp (symbol-function atom)) | 2462 | (autoloadp (symbol-function atom)) |
| 2467 | (string-match files-regexp (cadr (symbol-function atom)))) | 2463 | (string-match-p files-regexp (cadr (symbol-function atom)))) |
| 2468 | (ignore-errors | 2464 | (ignore-errors |
| 2469 | (setf (cadr (symbol-function atom)) | 2465 | (setf (cadr (symbol-function atom)) |
| 2470 | (expand-file-name (cadr (symbol-function atom)) dir)))))))) | 2466 | (expand-file-name (cadr (symbol-function atom)) dir)))))))) |
| @@ -2589,7 +2585,6 @@ not in completion mode." | |||
| 2589 | ;; completions. | 2585 | ;; completions. |
| 2590 | (defun tramp-completion-handle-file-name-all-completions (filename directory) | 2586 | (defun tramp-completion-handle-file-name-all-completions (filename directory) |
| 2591 | "Like `file-name-all-completions' for partial Tramp files." | 2587 | "Like `file-name-all-completions' for partial Tramp files." |
| 2592 | |||
| 2593 | (let ((fullname | 2588 | (let ((fullname |
| 2594 | (tramp-drop-volume-letter (expand-file-name filename directory))) | 2589 | (tramp-drop-volume-letter (expand-file-name filename directory))) |
| 2595 | hop result result1) | 2590 | hop result result1) |
| @@ -2686,7 +2681,6 @@ not in completion mode." | |||
| 2686 | (defun tramp-completion-dissect-file-name (name) | 2681 | (defun tramp-completion-dissect-file-name (name) |
| 2687 | "Returns a list of `tramp-file-name' structures. | 2682 | "Returns a list of `tramp-file-name' structures. |
| 2688 | They are collected by `tramp-completion-dissect-file-name1'." | 2683 | They are collected by `tramp-completion-dissect-file-name1'." |
| 2689 | |||
| 2690 | (let* ((x-nil "\\|\\(\\)") | 2684 | (let* ((x-nil "\\|\\(\\)") |
| 2691 | (tramp-completion-ipv6-regexp | 2685 | (tramp-completion-ipv6-regexp |
| 2692 | (format | 2686 | (format |
| @@ -2761,7 +2755,6 @@ They are collected by `tramp-completion-dissect-file-name1'." | |||
| 2761 | "Returns a `tramp-file-name' structure matching STRUCTURE. | 2755 | "Returns a `tramp-file-name' structure matching STRUCTURE. |
| 2762 | The structure consists of remote method, remote user, | 2756 | The structure consists of remote method, remote user, |
| 2763 | remote host and localname (filename on remote host)." | 2757 | remote host and localname (filename on remote host)." |
| 2764 | |||
| 2765 | (save-match-data | 2758 | (save-match-data |
| 2766 | (when (string-match (nth 0 structure) name) | 2759 | (when (string-match (nth 0 structure) name) |
| 2767 | (make-tramp-file-name | 2760 | (make-tramp-file-name |
| @@ -2779,7 +2772,7 @@ remote host and localname (filename on remote host)." | |||
| 2779 | (mapcar | 2772 | (mapcar |
| 2780 | (lambda (method) | 2773 | (lambda (method) |
| 2781 | (and method | 2774 | (and method |
| 2782 | (string-match (concat "^" (regexp-quote partial-method)) method) | 2775 | (string-match-p (concat "^" (regexp-quote partial-method)) method) |
| 2783 | (tramp-completion-make-tramp-file-name method nil nil nil))) | 2776 | (tramp-completion-make-tramp-file-name method nil nil nil))) |
| 2784 | (mapcar 'car tramp-methods))) | 2777 | (mapcar 'car tramp-methods))) |
| 2785 | 2778 | ||
| @@ -2792,7 +2785,7 @@ PARTIAL-USER must match USER, PARTIAL-HOST must match HOST." | |||
| 2792 | 2785 | ||
| 2793 | ((and partial-user partial-host) | 2786 | ((and partial-user partial-host) |
| 2794 | (if (and host | 2787 | (if (and host |
| 2795 | (string-match (concat "^" (regexp-quote partial-host)) host) | 2788 | (string-match-p (concat "^" (regexp-quote partial-host)) host) |
| 2796 | (string-equal partial-user (or user partial-user))) | 2789 | (string-equal partial-user (or user partial-user))) |
| 2797 | (setq user partial-user) | 2790 | (setq user partial-user) |
| 2798 | (setq user nil | 2791 | (setq user nil |
| @@ -2801,13 +2794,15 @@ PARTIAL-USER must match USER, PARTIAL-HOST must match HOST." | |||
| 2801 | (partial-user | 2794 | (partial-user |
| 2802 | (setq host nil) | 2795 | (setq host nil) |
| 2803 | (unless | 2796 | (unless |
| 2804 | (and user (string-match (concat "^" (regexp-quote partial-user)) user)) | 2797 | (and user |
| 2798 | (string-match-p (concat "^" (regexp-quote partial-user)) user)) | ||
| 2805 | (setq user nil))) | 2799 | (setq user nil))) |
| 2806 | 2800 | ||
| 2807 | (partial-host | 2801 | (partial-host |
| 2808 | (setq user nil) | 2802 | (setq user nil) |
| 2809 | (unless | 2803 | (unless |
| 2810 | (and host (string-match (concat "^" (regexp-quote partial-host)) host)) | 2804 | (and host |
| 2805 | (string-match-p (concat "^" (regexp-quote partial-host)) host)) | ||
| 2811 | (setq host nil))) | 2806 | (setq host nil))) |
| 2812 | 2807 | ||
| 2813 | (t (setq user nil | 2808 | (t (setq user nil |
| @@ -3086,7 +3081,7 @@ User is always nil." | |||
| 3086 | 3081 | ||
| 3087 | (while temp | 3082 | (while temp |
| 3088 | (setq item (directory-file-name (pop temp))) | 3083 | (setq item (directory-file-name (pop temp))) |
| 3089 | (when (or (null match) (string-match match item)) | 3084 | (when (or (null match) (string-match-p match item)) |
| 3090 | (push (if full (concat directory item) item) | 3085 | (push (if full (concat directory item) item) |
| 3091 | result))) | 3086 | result))) |
| 3092 | (if nosort result (sort result 'string<))))) | 3087 | (if nosort result (sort result 'string<))))) |
| @@ -3188,7 +3183,7 @@ User is always nil." | |||
| 3188 | ;; Check, whether we find an existing file with | 3183 | ;; Check, whether we find an existing file with |
| 3189 | ;; lower case letters. This avoids us to create a | 3184 | ;; lower case letters. This avoids us to create a |
| 3190 | ;; temporary file. | 3185 | ;; temporary file. |
| 3191 | (while (and (string-match | 3186 | (while (and (string-match-p |
| 3192 | "[a-z]" (file-remote-p candidate 'localname)) | 3187 | "[a-z]" (file-remote-p candidate 'localname)) |
| 3193 | (not (file-exists-p candidate))) | 3188 | (not (file-exists-p candidate))) |
| 3194 | (setq candidate | 3189 | (setq candidate |
| @@ -3199,7 +3194,7 @@ User is always nil." | |||
| 3199 | ;; to Emacs 26+ like `file-name-case-insensitive-p', | 3194 | ;; to Emacs 26+ like `file-name-case-insensitive-p', |
| 3200 | ;; so there is no compatibility problem calling it. | 3195 | ;; so there is no compatibility problem calling it. |
| 3201 | (unless | 3196 | (unless |
| 3202 | (string-match | 3197 | (string-match-p |
| 3203 | "[a-z]" (file-remote-p candidate 'localname)) | 3198 | "[a-z]" (file-remote-p candidate 'localname)) |
| 3204 | (setq tmpfile | 3199 | (setq tmpfile |
| 3205 | (let ((default-directory | 3200 | (let ((default-directory |
| @@ -3229,7 +3224,7 @@ User is always nil." | |||
| 3229 | (not | 3224 | (not |
| 3230 | (and | 3225 | (and |
| 3231 | completion-ignored-extensions | 3226 | completion-ignored-extensions |
| 3232 | (string-match | 3227 | (string-match-p |
| 3233 | (concat (regexp-opt completion-ignored-extensions 'paren) "$") x) | 3228 | (concat (regexp-opt completion-ignored-extensions 'paren) "$") x) |
| 3234 | ;; We remember the hit. | 3229 | ;; We remember the hit. |
| 3235 | (push x hits-ignored-extensions)))))) | 3230 | (push x hits-ignored-extensions)))))) |
| @@ -3346,7 +3341,7 @@ User is always nil." | |||
| 3346 | (tramp-error | 3341 | (tramp-error |
| 3347 | v1 'file-error | 3342 | v1 'file-error |
| 3348 | "Maximum number (%d) of symlinks exceeded" numchase-limit))) | 3343 | "Maximum number (%d) of symlinks exceeded" numchase-limit))) |
| 3349 | (file-local-name (directory-file-name result)))))))) | 3344 | (file-remote-p (directory-file-name result) 'localname))))))) |
| 3350 | 3345 | ||
| 3351 | (defun tramp-handle-find-backup-file-name (filename) | 3346 | (defun tramp-handle-find-backup-file-name (filename) |
| 3352 | "Like `find-backup-file-name' for Tramp files." | 3347 | "Like `find-backup-file-name' for Tramp files." |
| @@ -3383,7 +3378,7 @@ User is always nil." | |||
| 3383 | (list filename switches wildcard full-directory-p)) | 3378 | (list filename switches wildcard full-directory-p)) |
| 3384 | ;; `ls-lisp' always returns full listings. We must remove | 3379 | ;; `ls-lisp' always returns full listings. We must remove |
| 3385 | ;; superfluous parts. | 3380 | ;; superfluous parts. |
| 3386 | (unless (string-match "l" switches) | 3381 | (unless (string-match-p "l" switches) |
| 3387 | (save-excursion | 3382 | (save-excursion |
| 3388 | (goto-char (point-min)) | 3383 | (goto-char (point-min)) |
| 3389 | (while (setq start | 3384 | (while (setq start |
| @@ -3527,7 +3522,7 @@ User is always nil." | |||
| 3527 | ;; The first condition is always true for absolute file names. | 3522 | ;; The first condition is always true for absolute file names. |
| 3528 | ;; Included for safety's sake. | 3523 | ;; Included for safety's sake. |
| 3529 | (unless (or (file-name-directory file) | 3524 | (unless (or (file-name-directory file) |
| 3530 | (string-match "\\.elc?\\'" file)) | 3525 | (string-match-p "\\.elc?\\'" file)) |
| 3531 | (tramp-error | 3526 | (tramp-error |
| 3532 | v 'file-error | 3527 | v 'file-error |
| 3533 | "File `%s' does not include a `.el' or `.elc' suffix" file))) | 3528 | "File `%s' does not include a `.el' or `.elc' suffix" file))) |
| @@ -3562,7 +3557,7 @@ support symbolic links." | |||
| 3562 | (defun tramp-handle-shell-command | 3557 | (defun tramp-handle-shell-command |
| 3563 | (command &optional output-buffer error-buffer) | 3558 | (command &optional output-buffer error-buffer) |
| 3564 | "Like `shell-command' for Tramp files." | 3559 | "Like `shell-command' for Tramp files." |
| 3565 | (let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command)) | 3560 | (let* ((asynchronous (string-match-p "[ \t]*&[ \t]*\\'" command)) |
| 3566 | ;; We cannot use `shell-file-name' and `shell-command-switch', | 3561 | ;; We cannot use `shell-file-name' and `shell-command-switch', |
| 3567 | ;; they are variables of the local host. | 3562 | ;; they are variables of the local host. |
| 3568 | (args (append | 3563 | (args (append |
| @@ -3809,7 +3804,7 @@ Send \"yes\" to remote process on confirmation, abort otherwise. | |||
| 3809 | See also `tramp-action-yn'." | 3804 | See also `tramp-action-yn'." |
| 3810 | (save-window-excursion | 3805 | (save-window-excursion |
| 3811 | (let ((enable-recursive-minibuffers t)) | 3806 | (let ((enable-recursive-minibuffers t)) |
| 3812 | (save-match-data (pop-to-buffer (tramp-get-connection-buffer vec))) | 3807 | (pop-to-buffer (tramp-get-connection-buffer vec)) |
| 3813 | (unless (yes-or-no-p (match-string 0)) | 3808 | (unless (yes-or-no-p (match-string 0)) |
| 3814 | (kill-process proc) | 3809 | (kill-process proc) |
| 3815 | (throw 'tramp-action 'permission-denied)) | 3810 | (throw 'tramp-action 'permission-denied)) |
| @@ -3823,7 +3818,7 @@ Send \"y\" to remote process on confirmation, abort otherwise. | |||
| 3823 | See also `tramp-action-yesno'." | 3818 | See also `tramp-action-yesno'." |
| 3824 | (save-window-excursion | 3819 | (save-window-excursion |
| 3825 | (let ((enable-recursive-minibuffers t)) | 3820 | (let ((enable-recursive-minibuffers t)) |
| 3826 | (save-match-data (pop-to-buffer (tramp-get-connection-buffer vec))) | 3821 | (pop-to-buffer (tramp-get-connection-buffer vec)) |
| 3827 | (unless (y-or-n-p (match-string 0)) | 3822 | (unless (y-or-n-p (match-string 0)) |
| 3828 | (kill-process proc) | 3823 | (kill-process proc) |
| 3829 | (throw 'tramp-action 'permission-denied)) | 3824 | (throw 'tramp-action 'permission-denied)) |
| @@ -3933,9 +3928,10 @@ connection buffer." | |||
| 3933 | (tramp-get-connection-buffer vec))) | 3928 | (tramp-get-connection-buffer vec))) |
| 3934 | ((eq exit 'process-died) | 3929 | ((eq exit 'process-died) |
| 3935 | (substitute-command-keys | 3930 | (substitute-command-keys |
| 3936 | (concat | 3931 | (eval-when-compile |
| 3937 | "Tramp failed to connect. If this happens repeatedly, try\n" | 3932 | (concat |
| 3938 | " `\\[tramp-cleanup-this-connection]'"))) | 3933 | "Tramp failed to connect. If this happens repeatedly, try\n" |
| 3934 | " `\\[tramp-cleanup-this-connection]'")))) | ||
| 3939 | ((eq exit 'timeout) | 3935 | ((eq exit 'timeout) |
| 3940 | (format-message | 3936 | (format-message |
| 3941 | "Timeout reached, see buffer `%s' for details" | 3937 | "Timeout reached, see buffer `%s' for details" |
| @@ -4119,53 +4115,52 @@ would yield t. On the other hand, the following check results in nil: | |||
| 4119 | (other-read (aref mode-chars 7)) | 4115 | (other-read (aref mode-chars 7)) |
| 4120 | (other-write (aref mode-chars 8)) | 4116 | (other-write (aref mode-chars 8)) |
| 4121 | (other-execute-or-sticky (aref mode-chars 9))) | 4117 | (other-execute-or-sticky (aref mode-chars 9))) |
| 4122 | (save-match-data | 4118 | (logior |
| 4123 | (logior | 4119 | (cond |
| 4124 | (cond | 4120 | ((char-equal owner-read ?r) (string-to-number "00400" 8)) |
| 4125 | ((char-equal owner-read ?r) (string-to-number "00400" 8)) | 4121 | ((char-equal owner-read ?-) 0) |
| 4126 | ((char-equal owner-read ?-) 0) | 4122 | (t (error "Second char `%c' must be one of `r-'" owner-read))) |
| 4127 | (t (error "Second char `%c' must be one of `r-'" owner-read))) | 4123 | (cond |
| 4128 | (cond | 4124 | ((char-equal owner-write ?w) (string-to-number "00200" 8)) |
| 4129 | ((char-equal owner-write ?w) (string-to-number "00200" 8)) | 4125 | ((char-equal owner-write ?-) 0) |
| 4130 | ((char-equal owner-write ?-) 0) | 4126 | (t (error "Third char `%c' must be one of `w-'" owner-write))) |
| 4131 | (t (error "Third char `%c' must be one of `w-'" owner-write))) | 4127 | (cond |
| 4132 | (cond | 4128 | ((char-equal owner-execute-or-setid ?x) (string-to-number "00100" 8)) |
| 4133 | ((char-equal owner-execute-or-setid ?x) (string-to-number "00100" 8)) | 4129 | ((char-equal owner-execute-or-setid ?S) (string-to-number "04000" 8)) |
| 4134 | ((char-equal owner-execute-or-setid ?S) (string-to-number "04000" 8)) | 4130 | ((char-equal owner-execute-or-setid ?s) (string-to-number "04100" 8)) |
| 4135 | ((char-equal owner-execute-or-setid ?s) (string-to-number "04100" 8)) | 4131 | ((char-equal owner-execute-or-setid ?-) 0) |
| 4136 | ((char-equal owner-execute-or-setid ?-) 0) | 4132 | (t (error "Fourth char `%c' must be one of `xsS-'" |
| 4137 | (t (error "Fourth char `%c' must be one of `xsS-'" | 4133 | owner-execute-or-setid))) |
| 4138 | owner-execute-or-setid))) | 4134 | (cond |
| 4139 | (cond | 4135 | ((char-equal group-read ?r) (string-to-number "00040" 8)) |
| 4140 | ((char-equal group-read ?r) (string-to-number "00040" 8)) | 4136 | ((char-equal group-read ?-) 0) |
| 4141 | ((char-equal group-read ?-) 0) | 4137 | (t (error "Fifth char `%c' must be one of `r-'" group-read))) |
| 4142 | (t (error "Fifth char `%c' must be one of `r-'" group-read))) | 4138 | (cond |
| 4143 | (cond | 4139 | ((char-equal group-write ?w) (string-to-number "00020" 8)) |
| 4144 | ((char-equal group-write ?w) (string-to-number "00020" 8)) | 4140 | ((char-equal group-write ?-) 0) |
| 4145 | ((char-equal group-write ?-) 0) | 4141 | (t (error "Sixth char `%c' must be one of `w-'" group-write))) |
| 4146 | (t (error "Sixth char `%c' must be one of `w-'" group-write))) | 4142 | (cond |
| 4147 | (cond | 4143 | ((char-equal group-execute-or-setid ?x) (string-to-number "00010" 8)) |
| 4148 | ((char-equal group-execute-or-setid ?x) (string-to-number "00010" 8)) | 4144 | ((char-equal group-execute-or-setid ?S) (string-to-number "02000" 8)) |
| 4149 | ((char-equal group-execute-or-setid ?S) (string-to-number "02000" 8)) | 4145 | ((char-equal group-execute-or-setid ?s) (string-to-number "02010" 8)) |
| 4150 | ((char-equal group-execute-or-setid ?s) (string-to-number "02010" 8)) | 4146 | ((char-equal group-execute-or-setid ?-) 0) |
| 4151 | ((char-equal group-execute-or-setid ?-) 0) | 4147 | (t (error "Seventh char `%c' must be one of `xsS-'" |
| 4152 | (t (error "Seventh char `%c' must be one of `xsS-'" | 4148 | group-execute-or-setid))) |
| 4153 | group-execute-or-setid))) | 4149 | (cond |
| 4154 | (cond | 4150 | ((char-equal other-read ?r) (string-to-number "00004" 8)) |
| 4155 | ((char-equal other-read ?r) (string-to-number "00004" 8)) | 4151 | ((char-equal other-read ?-) 0) |
| 4156 | ((char-equal other-read ?-) 0) | 4152 | (t (error "Eighth char `%c' must be one of `r-'" other-read))) |
| 4157 | (t (error "Eighth char `%c' must be one of `r-'" other-read))) | 4153 | (cond |
| 4158 | (cond | 4154 | ((char-equal other-write ?w) (string-to-number "00002" 8)) |
| 4159 | ((char-equal other-write ?w) (string-to-number "00002" 8)) | 4155 | ((char-equal other-write ?-) 0) |
| 4160 | ((char-equal other-write ?-) 0) | 4156 | (t (error "Ninth char `%c' must be one of `w-'" other-write))) |
| 4161 | (t (error "Ninth char `%c' must be one of `w-'" other-write))) | 4157 | (cond |
| 4162 | (cond | 4158 | ((char-equal other-execute-or-sticky ?x) (string-to-number "00001" 8)) |
| 4163 | ((char-equal other-execute-or-sticky ?x) (string-to-number "00001" 8)) | 4159 | ((char-equal other-execute-or-sticky ?T) (string-to-number "01000" 8)) |
| 4164 | ((char-equal other-execute-or-sticky ?T) (string-to-number "01000" 8)) | 4160 | ((char-equal other-execute-or-sticky ?t) (string-to-number "01001" 8)) |
| 4165 | ((char-equal other-execute-or-sticky ?t) (string-to-number "01001" 8)) | 4161 | ((char-equal other-execute-or-sticky ?-) 0) |
| 4166 | ((char-equal other-execute-or-sticky ?-) 0) | 4162 | (t (error "Tenth char `%c' must be one of `xtT-'" |
| 4167 | (t (error "Tenth char `%c' must be one of `xtT-'" | 4163 | other-execute-or-sticky)))))) |
| 4168 | other-execute-or-sticky))))))) | ||
| 4169 | 4164 | ||
| 4170 | (defconst tramp-file-mode-type-map | 4165 | (defconst tramp-file-mode-type-map |
| 4171 | '((0 . "-") ; Normal file (SVID-v2 and XPG2) | 4166 | '((0 . "-") ; Normal file (SVID-v2 and XPG2) |
| @@ -4246,8 +4241,9 @@ VEC is used for tracing." | |||
| 4246 | nil "locale" nil t nil "-a")))) | 4241 | nil "locale" nil t nil "-a")))) |
| 4247 | (while candidates | 4242 | (while candidates |
| 4248 | (goto-char (point-min)) | 4243 | (goto-char (point-min)) |
| 4249 | (if (string-match (format "^%s\r?$" (regexp-quote (car candidates))) | 4244 | (if (string-match-p |
| 4250 | (buffer-string)) | 4245 | (format "^%s\r?$" (regexp-quote (car candidates))) |
| 4246 | (buffer-string)) | ||
| 4251 | (setq locale (car candidates) | 4247 | (setq locale (car candidates) |
| 4252 | candidates nil) | 4248 | candidates nil) |
| 4253 | (setq candidates (cdr candidates)))))) | 4249 | (setq candidates (cdr candidates)))))) |
| @@ -4324,7 +4320,7 @@ This handles also chrooted environments, which are not regarded as local." | |||
| 4324 | (port (tramp-file-name-port vec))) | 4320 | (port (tramp-file-name-port vec))) |
| 4325 | (and | 4321 | (and |
| 4326 | (stringp tramp-local-host-regexp) (stringp host) | 4322 | (stringp tramp-local-host-regexp) (stringp host) |
| 4327 | (string-match tramp-local-host-regexp host) | 4323 | (string-match-p tramp-local-host-regexp host) |
| 4328 | ;; A port is an indication for an ssh tunnel or alike. | 4324 | ;; A port is an indication for an ssh tunnel or alike. |
| 4329 | (null port) | 4325 | (null port) |
| 4330 | ;; The method shall be applied to one of the shell file name | 4326 | ;; The method shall be applied to one of the shell file name |