Skip to content

Commit 0debadb

Browse files
committed
Minor code cleanup in Tramp
1 parent 9849038 commit 0debadb

File tree

4 files changed

+39
-40
lines changed

4 files changed

+39
-40
lines changed

lisp/net/tramp-rclone.el

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ file names."
270270
(filename newname &optional ok-if-already-exists keep-date
271271
preserve-uid-gid preserve-extended-attributes)
272272
"Like `copy-file' for Tramp files."
273-
(setq filename (expand-file-name filename))
274-
(setq newname (expand-file-name newname))
273+
(setq filename (expand-file-name filename)
274+
newname (expand-file-name newname))
275275
;; At least one file a Tramp file?
276276
(if (or (tramp-tramp-file-p filename)
277277
(tramp-tramp-file-p newname))
@@ -428,8 +428,8 @@ file names."
428428
(defun tramp-rclone-handle-rename-file
429429
(filename newname &optional ok-if-already-exists)
430430
"Like `rename-file' for Tramp files."
431-
(setq filename (expand-file-name filename))
432-
(setq newname (expand-file-name newname))
431+
(setq filename (expand-file-name filename)
432+
newname (expand-file-name newname))
433433
;; At least one file a Tramp file?
434434
(if (or (tramp-tramp-file-p filename)
435435
(tramp-tramp-file-p newname))

lisp/net/tramp-sh.el

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,9 +1199,9 @@ component is used as the target of the symlink."
11991199
(tramp-error
12001200
v 'file-error
12011201
"Maximum number (%d) of symlinks exceeded" numchase-limit))
1202-
(setq result (reverse result))
1203-
;; Combine list to form string.
1204-
(setq result
1202+
(setq result (reverse result)
1203+
;; Combine list to form string.
1204+
result
12051205
(if result (string-join (cons "" result) "/") "/"))
12061206
(when (string-empty-p result) (setq result "/")))))
12071207

@@ -1987,8 +1987,8 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'"
19871987
"Like `rename-file' for Tramp files."
19881988
;; Check if both files are local -- invoke normal rename-file.
19891989
;; Otherwise, use Tramp from local system.
1990-
(setq filename (expand-file-name filename))
1991-
(setq newname (expand-file-name newname))
1990+
(setq filename (expand-file-name filename)
1991+
newname (expand-file-name newname))
19921992
;; At least one file a Tramp file?
19931993
(if (or (tramp-tramp-file-p filename)
19941994
(tramp-tramp-file-p newname))
@@ -3976,8 +3976,8 @@ This function expects to be in the right *tramp* buffer."
39763976
;; Remove all ~/foo directories from dirlist.
39773977
(let (newdl d)
39783978
(while dirlist
3979-
(setq d (car dirlist))
3980-
(setq dirlist (cdr dirlist))
3979+
(setq d (car dirlist)
3980+
dirlist (cdr dirlist))
39813981
(unless (char-equal ?~ (aref d 0))
39823982
(setq newdl (cons d newdl))))
39833983
(setq dirlist (nreverse newdl))))
@@ -4470,8 +4470,8 @@ Goes through the list `tramp-local-coding-commands' and
44704470
(catch 'wont-work-local
44714471
(let ((format (nth 0 litem))
44724472
(remote-commands tramp-remote-coding-commands))
4473-
(setq loc-enc (nth 1 litem))
4474-
(setq loc-dec (nth 2 litem))
4473+
(setq loc-enc (nth 1 litem)
4474+
loc-dec (nth 2 litem))
44754475
;; If the local encoder or decoder is a string, the
44764476
;; corresponding command has to work locally.
44774477
(if (not (stringp loc-enc))
@@ -4493,9 +4493,9 @@ Goes through the list `tramp-local-coding-commands' and
44934493
(setq ritem (pop remote-commands))
44944494
(catch 'wont-work-remote
44954495
(when (equal format (nth 0 ritem))
4496-
(setq rem-enc (nth 1 ritem))
4497-
(setq rem-dec (nth 2 ritem))
4498-
(setq rem-test (nth 3 ritem))
4496+
(setq rem-enc (nth 1 ritem)
4497+
rem-dec (nth 2 ritem)
4498+
rem-test (nth 3 ritem))
44994499
;; Check the remote test command if exists.
45004500
(when (stringp rem-test)
45014501
(tramp-message
@@ -4592,9 +4592,9 @@ Goes through the list `tramp-local-coding-commands' and
45924592
(throw 'wont-work-remote nil)))
45934593

45944594
;; `rem-enc' and `rem-dec' could be a string meanwhile.
4595-
(setq rem-enc (nth 1 ritem))
4596-
(setq rem-dec (nth 2 ritem))
4597-
(setq found t)))))))
4595+
(setq rem-enc (nth 1 ritem)
4596+
rem-dec (nth 2 ritem)
4597+
found t)))))))
45984598

45994599
(when found
46004600
;; Set connection properties. Since the commands are risky

lisp/net/tramp-sudoedit.el

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ absolute file names."
302302
(filename newname &optional ok-if-already-exists keep-date
303303
preserve-uid-gid preserve-extended-attributes)
304304
"Like `copy-file' for Tramp files."
305-
(setq filename (expand-file-name filename))
306-
(setq newname (expand-file-name newname))
305+
(setq filename (expand-file-name filename)
306+
newname (expand-file-name newname))
307307
;; At least one file a Tramp file?
308308
(if (or (tramp-tramp-file-p filename)
309309
(tramp-tramp-file-p newname))
@@ -640,8 +640,8 @@ component is used as the target of the symlink."
640640
(defun tramp-sudoedit-handle-rename-file
641641
(filename newname &optional ok-if-already-exists)
642642
"Like `rename-file' for Tramp files."
643-
(setq filename (expand-file-name filename))
644-
(setq newname (expand-file-name newname))
643+
(setq filename (expand-file-name filename)
644+
newname (expand-file-name newname))
645645
;; At least one file a Tramp file?
646646
(if (or (tramp-tramp-file-p filename)
647647
(tramp-tramp-file-p newname))

lisp/net/tramp.el

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,8 +1369,8 @@ This is METHOD, if non-nil. Otherwise, do a lookup in
13691369
(setq item (pop choices))
13701370
(when (and (string-match-p (or (nth 0 item) "") (or host ""))
13711371
(string-match-p (or (nth 1 item) "") (or user "")))
1372-
(setq lmethod (nth 2 item))
1373-
(setq choices nil)))
1372+
(setq lmethod (nth 2 item)
1373+
choices nil)))
13741374
lmethod)
13751375
tramp-default-method)))
13761376
;; 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
13901390
(setq item (pop choices))
13911391
(when (and (string-match-p (or (nth 0 item) "") (or method ""))
13921392
(string-match-p (or (nth 1 item) "") (or host "")))
1393-
(setq luser (nth 2 item))
1394-
(setq choices nil)))
1393+
(setq luser (nth 2 item)
1394+
choices nil)))
13951395
luser)
13961396
tramp-default-user)))
13971397
;; 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
14111411
(setq item (pop choices))
14121412
(when (and (string-match-p (or (nth 0 item) "") (or method ""))
14131413
(string-match-p (or (nth 1 item) "") (or user "")))
1414-
(setq lhost (nth 2 item))
1415-
(setq choices nil)))
1414+
(setq lhost (nth 2 item)
1415+
choices nil)))
14161416
lhost)
14171417
tramp-default-host)))
14181418
;; We must mark, whether a default value has been used.
@@ -3554,8 +3554,8 @@ User is always nil."
35543554
;; Save exit.
35553555
(progn
35563556
(when visit
3557-
(setq buffer-file-name filename)
3558-
(setq buffer-read-only (not (file-writable-p filename)))
3557+
(setq buffer-file-name filename
3558+
buffer-read-only (not (file-writable-p filename)))
35593559
(set-visited-file-modtime)
35603560
(set-buffer-modified-p nil))
35613561
(when (and (stringp local-copy)
@@ -4069,9 +4069,9 @@ See `tramp-process-actions' for the format of ACTIONS."
40694069
(while (tramp-accept-process-output proc 0))
40704070
(setq todo actions)
40714071
(while todo
4072-
(setq item (pop todo))
4073-
(setq pattern (format "\\(%s\\)\\'" (symbol-value (nth 0 item))))
4074-
(setq action (nth 1 item))
4072+
(setq item (pop todo)
4073+
pattern (format "\\(%s\\)\\'" (symbol-value (nth 0 item)))
4074+
action (nth 1 item))
40754075
(tramp-message
40764076
vec 5 "Looking for regexp \"%s\" from remote shell" pattern)
40774077
(when (tramp-check-for-regexp proc pattern)
@@ -4121,9 +4121,8 @@ performed successfully. Any other value means an error."
41214121
(catch 'tramp-action
41224122
(tramp-process-one-action proc vec actions)))))
41234123
(while (not exit)
4124-
(setq exit
4125-
(catch 'tramp-action
4126-
(tramp-process-one-action proc vec actions)))))
4124+
(setq exit (catch 'tramp-action
4125+
(tramp-process-one-action proc vec actions)))))
41274126
(with-current-buffer (tramp-get-connection-buffer vec)
41284127
(widen)
41294128
(tramp-message vec 6 "\n%s" (buffer-string)))
@@ -4441,9 +4440,9 @@ This is used to map a mode number to a permission string.")
44414440
(suid (> (logand (ash mode -9) 4) 0))
44424441
(sgid (> (logand (ash mode -9) 2) 0))
44434442
(sticky (> (logand (ash mode -9) 1) 0)))
4444-
(setq user (tramp-file-mode-permissions user suid "s"))
4445-
(setq group (tramp-file-mode-permissions group sgid "s"))
4446-
(setq other (tramp-file-mode-permissions other sticky "t"))
4443+
(setq user (tramp-file-mode-permissions user suid "s")
4444+
group (tramp-file-mode-permissions group sgid "s")
4445+
other (tramp-file-mode-permissions other sticky "t"))
44474446
(concat type user group other)))
44484447

44494448
(defun tramp-file-mode-permissions (perm suid suid-text)

0 commit comments

Comments
 (0)