diff options
| author | Michael Albinus | 2020-01-24 14:41:44 +0100 |
|---|---|---|
| committer | Michael Albinus | 2020-01-24 14:41:44 +0100 |
| commit | 0debadb4e3427d22a2240ada88d2a8fec3b0d804 (patch) | |
| tree | 2573818bb07cffea68add7706a805764b08438b6 | |
| parent | 984903868bb2fdfadc8f3c08e15434d44c4d08f4 (diff) | |
| download | emacs-0debadb4e3427d22a2240ada88d2a8fec3b0d804.tar.gz emacs-0debadb4e3427d22a2240ada88d2a8fec3b0d804.zip | |
Minor code cleanup in Tramp
| -rw-r--r-- | lisp/net/tramp-rclone.el | 8 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 30 | ||||
| -rw-r--r-- | lisp/net/tramp-sudoedit.el | 8 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 33 |
4 files changed, 39 insertions, 40 deletions
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index 3e029e44ff5..445098a5bca 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el | |||
| @@ -270,8 +270,8 @@ file names." | |||
| 270 | (filename newname &optional ok-if-already-exists keep-date | 270 | (filename newname &optional ok-if-already-exists keep-date |
| 271 | preserve-uid-gid preserve-extended-attributes) | 271 | preserve-uid-gid preserve-extended-attributes) |
| 272 | "Like `copy-file' for Tramp files." | 272 | "Like `copy-file' for Tramp files." |
| 273 | (setq filename (expand-file-name filename)) | 273 | (setq filename (expand-file-name filename) |
| 274 | (setq newname (expand-file-name newname)) | 274 | newname (expand-file-name newname)) |
| 275 | ;; At least one file a Tramp file? | 275 | ;; At least one file a Tramp file? |
| 276 | (if (or (tramp-tramp-file-p filename) | 276 | (if (or (tramp-tramp-file-p filename) |
| 277 | (tramp-tramp-file-p newname)) | 277 | (tramp-tramp-file-p newname)) |
| @@ -428,8 +428,8 @@ file names." | |||
| 428 | (defun tramp-rclone-handle-rename-file | 428 | (defun tramp-rclone-handle-rename-file |
| 429 | (filename newname &optional ok-if-already-exists) | 429 | (filename newname &optional ok-if-already-exists) |
| 430 | "Like `rename-file' for Tramp files." | 430 | "Like `rename-file' for Tramp files." |
| 431 | (setq filename (expand-file-name filename)) | 431 | (setq filename (expand-file-name filename) |
| 432 | (setq newname (expand-file-name newname)) | 432 | newname (expand-file-name newname)) |
| 433 | ;; At least one file a Tramp file? | 433 | ;; At least one file a Tramp file? |
| 434 | (if (or (tramp-tramp-file-p filename) | 434 | (if (or (tramp-tramp-file-p filename) |
| 435 | (tramp-tramp-file-p newname)) | 435 | (tramp-tramp-file-p newname)) |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 5f2c1ad3d56..23ce048720d 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -1199,9 +1199,9 @@ component is used as the target of the symlink." | |||
| 1199 | (tramp-error | 1199 | (tramp-error |
| 1200 | v 'file-error | 1200 | v 'file-error |
| 1201 | "Maximum number (%d) of symlinks exceeded" numchase-limit)) | 1201 | "Maximum number (%d) of symlinks exceeded" numchase-limit)) |
| 1202 | (setq result (reverse result)) | 1202 | (setq result (reverse result) |
| 1203 | ;; Combine list to form string. | 1203 | ;; Combine list to form string. |
| 1204 | (setq result | 1204 | result |
| 1205 | (if result (string-join (cons "" result) "/") "/")) | 1205 | (if result (string-join (cons "" result) "/") "/")) |
| 1206 | (when (string-empty-p result) (setq result "/"))))) | 1206 | (when (string-empty-p result) (setq result "/"))))) |
| 1207 | 1207 | ||
| @@ -1987,8 +1987,8 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'" | |||
| 1987 | "Like `rename-file' for Tramp files." | 1987 | "Like `rename-file' for Tramp files." |
| 1988 | ;; Check if both files are local -- invoke normal rename-file. | 1988 | ;; Check if both files are local -- invoke normal rename-file. |
| 1989 | ;; Otherwise, use Tramp from local system. | 1989 | ;; Otherwise, use Tramp from local system. |
| 1990 | (setq filename (expand-file-name filename)) | 1990 | (setq filename (expand-file-name filename) |
| 1991 | (setq newname (expand-file-name newname)) | 1991 | newname (expand-file-name newname)) |
| 1992 | ;; At least one file a Tramp file? | 1992 | ;; At least one file a Tramp file? |
| 1993 | (if (or (tramp-tramp-file-p filename) | 1993 | (if (or (tramp-tramp-file-p filename) |
| 1994 | (tramp-tramp-file-p newname)) | 1994 | (tramp-tramp-file-p newname)) |
| @@ -3976,8 +3976,8 @@ This function expects to be in the right *tramp* buffer." | |||
| 3976 | ;; Remove all ~/foo directories from dirlist. | 3976 | ;; Remove all ~/foo directories from dirlist. |
| 3977 | (let (newdl d) | 3977 | (let (newdl d) |
| 3978 | (while dirlist | 3978 | (while dirlist |
| 3979 | (setq d (car dirlist)) | 3979 | (setq d (car dirlist) |
| 3980 | (setq dirlist (cdr dirlist)) | 3980 | dirlist (cdr dirlist)) |
| 3981 | (unless (char-equal ?~ (aref d 0)) | 3981 | (unless (char-equal ?~ (aref d 0)) |
| 3982 | (setq newdl (cons d newdl)))) | 3982 | (setq newdl (cons d newdl)))) |
| 3983 | (setq dirlist (nreverse newdl)))) | 3983 | (setq dirlist (nreverse newdl)))) |
| @@ -4470,8 +4470,8 @@ Goes through the list `tramp-local-coding-commands' and | |||
| 4470 | (catch 'wont-work-local | 4470 | (catch 'wont-work-local |
| 4471 | (let ((format (nth 0 litem)) | 4471 | (let ((format (nth 0 litem)) |
| 4472 | (remote-commands tramp-remote-coding-commands)) | 4472 | (remote-commands tramp-remote-coding-commands)) |
| 4473 | (setq loc-enc (nth 1 litem)) | 4473 | (setq loc-enc (nth 1 litem) |
| 4474 | (setq loc-dec (nth 2 litem)) | 4474 | loc-dec (nth 2 litem)) |
| 4475 | ;; If the local encoder or decoder is a string, the | 4475 | ;; If the local encoder or decoder is a string, the |
| 4476 | ;; corresponding command has to work locally. | 4476 | ;; corresponding command has to work locally. |
| 4477 | (if (not (stringp loc-enc)) | 4477 | (if (not (stringp loc-enc)) |
| @@ -4493,9 +4493,9 @@ Goes through the list `tramp-local-coding-commands' and | |||
| 4493 | (setq ritem (pop remote-commands)) | 4493 | (setq ritem (pop remote-commands)) |
| 4494 | (catch 'wont-work-remote | 4494 | (catch 'wont-work-remote |
| 4495 | (when (equal format (nth 0 ritem)) | 4495 | (when (equal format (nth 0 ritem)) |
| 4496 | (setq rem-enc (nth 1 ritem)) | 4496 | (setq rem-enc (nth 1 ritem) |
| 4497 | (setq rem-dec (nth 2 ritem)) | 4497 | rem-dec (nth 2 ritem) |
| 4498 | (setq rem-test (nth 3 ritem)) | 4498 | rem-test (nth 3 ritem)) |
| 4499 | ;; Check the remote test command if exists. | 4499 | ;; Check the remote test command if exists. |
| 4500 | (when (stringp rem-test) | 4500 | (when (stringp rem-test) |
| 4501 | (tramp-message | 4501 | (tramp-message |
| @@ -4592,9 +4592,9 @@ Goes through the list `tramp-local-coding-commands' and | |||
| 4592 | (throw 'wont-work-remote nil))) | 4592 | (throw 'wont-work-remote nil))) |
| 4593 | 4593 | ||
| 4594 | ;; `rem-enc' and `rem-dec' could be a string meanwhile. | 4594 | ;; `rem-enc' and `rem-dec' could be a string meanwhile. |
| 4595 | (setq rem-enc (nth 1 ritem)) | 4595 | (setq rem-enc (nth 1 ritem) |
| 4596 | (setq rem-dec (nth 2 ritem)) | 4596 | rem-dec (nth 2 ritem) |
| 4597 | (setq found t))))))) | 4597 | found t))))))) |
| 4598 | 4598 | ||
| 4599 | (when found | 4599 | (when found |
| 4600 | ;; Set connection properties. Since the commands are risky | 4600 | ;; Set connection properties. Since the commands are risky |
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el index 9f08d5f1e64..f258ad6b931 100644 --- a/lisp/net/tramp-sudoedit.el +++ b/lisp/net/tramp-sudoedit.el | |||
| @@ -302,8 +302,8 @@ absolute file names." | |||
| 302 | (filename newname &optional ok-if-already-exists keep-date | 302 | (filename newname &optional ok-if-already-exists keep-date |
| 303 | preserve-uid-gid preserve-extended-attributes) | 303 | preserve-uid-gid preserve-extended-attributes) |
| 304 | "Like `copy-file' for Tramp files." | 304 | "Like `copy-file' for Tramp files." |
| 305 | (setq filename (expand-file-name filename)) | 305 | (setq filename (expand-file-name filename) |
| 306 | (setq newname (expand-file-name newname)) | 306 | newname (expand-file-name newname)) |
| 307 | ;; At least one file a Tramp file? | 307 | ;; At least one file a Tramp file? |
| 308 | (if (or (tramp-tramp-file-p filename) | 308 | (if (or (tramp-tramp-file-p filename) |
| 309 | (tramp-tramp-file-p newname)) | 309 | (tramp-tramp-file-p newname)) |
| @@ -640,8 +640,8 @@ component is used as the target of the symlink." | |||
| 640 | (defun tramp-sudoedit-handle-rename-file | 640 | (defun tramp-sudoedit-handle-rename-file |
| 641 | (filename newname &optional ok-if-already-exists) | 641 | (filename newname &optional ok-if-already-exists) |
| 642 | "Like `rename-file' for Tramp files." | 642 | "Like `rename-file' for Tramp files." |
| 643 | (setq filename (expand-file-name filename)) | 643 | (setq filename (expand-file-name filename) |
| 644 | (setq newname (expand-file-name newname)) | 644 | newname (expand-file-name newname)) |
| 645 | ;; At least one file a Tramp file? | 645 | ;; At least one file a Tramp file? |
| 646 | (if (or (tramp-tramp-file-p filename) | 646 | (if (or (tramp-tramp-file-p filename) |
| 647 | (tramp-tramp-file-p newname)) | 647 | (tramp-tramp-file-p newname)) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 324b2a24b80..81c79bf5d7e 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1369,8 +1369,8 @@ This is METHOD, if non-nil. Otherwise, do a lookup in | |||
| 1369 | (setq item (pop choices)) | 1369 | (setq item (pop choices)) |
| 1370 | (when (and (string-match-p (or (nth 0 item) "") (or host "")) | 1370 | (when (and (string-match-p (or (nth 0 item) "") (or host "")) |
| 1371 | (string-match-p (or (nth 1 item) "") (or user ""))) | 1371 | (string-match-p (or (nth 1 item) "") (or user ""))) |
| 1372 | (setq lmethod (nth 2 item)) | 1372 | (setq lmethod (nth 2 item) |
| 1373 | (setq choices nil))) | 1373 | choices nil))) |
| 1374 | lmethod) | 1374 | lmethod) |
| 1375 | tramp-default-method))) | 1375 | tramp-default-method))) |
| 1376 | ;; We must mark, whether a default value has been used. | 1376 | ;; We must mark, whether a default value has been used. |
| @@ -1390,8 +1390,8 @@ This is USER, if non-nil. Otherwise, do a lookup in | |||
| 1390 | (setq item (pop choices)) | 1390 | (setq item (pop choices)) |
| 1391 | (when (and (string-match-p (or (nth 0 item) "") (or method "")) | 1391 | (when (and (string-match-p (or (nth 0 item) "") (or method "")) |
| 1392 | (string-match-p (or (nth 1 item) "") (or host ""))) | 1392 | (string-match-p (or (nth 1 item) "") (or host ""))) |
| 1393 | (setq luser (nth 2 item)) | 1393 | (setq luser (nth 2 item) |
| 1394 | (setq choices nil))) | 1394 | choices nil))) |
| 1395 | luser) | 1395 | luser) |
| 1396 | tramp-default-user))) | 1396 | tramp-default-user))) |
| 1397 | ;; We must mark, whether a default value has been used. | 1397 | ;; We must mark, whether a default value has been used. |
| @@ -1411,8 +1411,8 @@ This is HOST, if non-nil. Otherwise, do a lookup in | |||
| 1411 | (setq item (pop choices)) | 1411 | (setq item (pop choices)) |
| 1412 | (when (and (string-match-p (or (nth 0 item) "") (or method "")) | 1412 | (when (and (string-match-p (or (nth 0 item) "") (or method "")) |
| 1413 | (string-match-p (or (nth 1 item) "") (or user ""))) | 1413 | (string-match-p (or (nth 1 item) "") (or user ""))) |
| 1414 | (setq lhost (nth 2 item)) | 1414 | (setq lhost (nth 2 item) |
| 1415 | (setq choices nil))) | 1415 | choices nil))) |
| 1416 | lhost) | 1416 | lhost) |
| 1417 | tramp-default-host))) | 1417 | tramp-default-host))) |
| 1418 | ;; We must mark, whether a default value has been used. | 1418 | ;; We must mark, whether a default value has been used. |
| @@ -3554,8 +3554,8 @@ User is always nil." | |||
| 3554 | ;; Save exit. | 3554 | ;; Save exit. |
| 3555 | (progn | 3555 | (progn |
| 3556 | (when visit | 3556 | (when visit |
| 3557 | (setq buffer-file-name filename) | 3557 | (setq buffer-file-name filename |
| 3558 | (setq buffer-read-only (not (file-writable-p filename))) | 3558 | buffer-read-only (not (file-writable-p filename))) |
| 3559 | (set-visited-file-modtime) | 3559 | (set-visited-file-modtime) |
| 3560 | (set-buffer-modified-p nil)) | 3560 | (set-buffer-modified-p nil)) |
| 3561 | (when (and (stringp local-copy) | 3561 | (when (and (stringp local-copy) |
| @@ -4069,9 +4069,9 @@ See `tramp-process-actions' for the format of ACTIONS." | |||
| 4069 | (while (tramp-accept-process-output proc 0)) | 4069 | (while (tramp-accept-process-output proc 0)) |
| 4070 | (setq todo actions) | 4070 | (setq todo actions) |
| 4071 | (while todo | 4071 | (while todo |
| 4072 | (setq item (pop todo)) | 4072 | (setq item (pop todo) |
| 4073 | (setq pattern (format "\\(%s\\)\\'" (symbol-value (nth 0 item)))) | 4073 | pattern (format "\\(%s\\)\\'" (symbol-value (nth 0 item))) |
| 4074 | (setq action (nth 1 item)) | 4074 | action (nth 1 item)) |
| 4075 | (tramp-message | 4075 | (tramp-message |
| 4076 | vec 5 "Looking for regexp \"%s\" from remote shell" pattern) | 4076 | vec 5 "Looking for regexp \"%s\" from remote shell" pattern) |
| 4077 | (when (tramp-check-for-regexp proc pattern) | 4077 | (when (tramp-check-for-regexp proc pattern) |
| @@ -4121,9 +4121,8 @@ performed successfully. Any other value means an error." | |||
| 4121 | (catch 'tramp-action | 4121 | (catch 'tramp-action |
| 4122 | (tramp-process-one-action proc vec actions))))) | 4122 | (tramp-process-one-action proc vec actions))))) |
| 4123 | (while (not exit) | 4123 | (while (not exit) |
| 4124 | (setq exit | 4124 | (setq exit (catch 'tramp-action |
| 4125 | (catch 'tramp-action | 4125 | (tramp-process-one-action proc vec actions))))) |
| 4126 | (tramp-process-one-action proc vec actions))))) | ||
| 4127 | (with-current-buffer (tramp-get-connection-buffer vec) | 4126 | (with-current-buffer (tramp-get-connection-buffer vec) |
| 4128 | (widen) | 4127 | (widen) |
| 4129 | (tramp-message vec 6 "\n%s" (buffer-string))) | 4128 | (tramp-message vec 6 "\n%s" (buffer-string))) |
| @@ -4441,9 +4440,9 @@ This is used to map a mode number to a permission string.") | |||
| 4441 | (suid (> (logand (ash mode -9) 4) 0)) | 4440 | (suid (> (logand (ash mode -9) 4) 0)) |
| 4442 | (sgid (> (logand (ash mode -9) 2) 0)) | 4441 | (sgid (> (logand (ash mode -9) 2) 0)) |
| 4443 | (sticky (> (logand (ash mode -9) 1) 0))) | 4442 | (sticky (> (logand (ash mode -9) 1) 0))) |
| 4444 | (setq user (tramp-file-mode-permissions user suid "s")) | 4443 | (setq user (tramp-file-mode-permissions user suid "s") |
| 4445 | (setq group (tramp-file-mode-permissions group sgid "s")) | 4444 | group (tramp-file-mode-permissions group sgid "s") |
| 4446 | (setq other (tramp-file-mode-permissions other sticky "t")) | 4445 | other (tramp-file-mode-permissions other sticky "t")) |
| 4447 | (concat type user group other))) | 4446 | (concat type user group other))) |
| 4448 | 4447 | ||
| 4449 | (defun tramp-file-mode-permissions (perm suid suid-text) | 4448 | (defun tramp-file-mode-permissions (perm suid suid-text) |