aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2017-03-23 14:58:04 +0100
committerMichael Albinus2017-03-23 14:58:04 +0100
commite1392faae5c5cc7805b52efacbb25a71213afdeb (patch)
treee094f7eeaa13bd26a28f202a51b026e7c9c12017
parente472cfe8f3b01f29a49614f6207e4128e8b36b8c (diff)
downloademacs-e1392faae5c5cc7805b52efacbb25a71213afdeb.tar.gz
emacs-e1392faae5c5cc7805b52efacbb25a71213afdeb.zip
Use lexical-bind in Tramp
* lisp/net/tramp*.el: Add lexical-binding cookie. Move declarations up. * lisp/net/tramp-adb.el (tramp-adb-parse-device-names): Use `push' rather than `add-to-list'. (tramp-adb-get-device): Remove unused variable. * lisp/net/tramp-gvfs.el (tramp-gvfs-parse-device-names): Remove unused variable. * lisp/net/tramp.el (auto-save-file-name-transforms): Declare. (tramp-find-file-name-coding-system-alist): Use `push' rather than `add-to-list'. * test/lisp/net/tramp-tests.el: Add lexical-binding cookie. Require 'dired. Move declarations up. (tramp-test32-make-nearby-temp-file): Wrap `make-nearby-temp-file' and `temporary-file-directory' calls with `with-no-warnings'. (tramp-test35-asynchronous-requests): Mark unused variable.
-rw-r--r--lisp/net/tramp-adb.el7
-rw-r--r--lisp/net/tramp-cache.el2
-rw-r--r--lisp/net/tramp-cmds.el2
-rw-r--r--lisp/net/tramp-compat.el2
-rw-r--r--lisp/net/tramp-ftp.el2
-rw-r--r--lisp/net/tramp-gvfs.el5
-rw-r--r--lisp/net/tramp-sh.el8
-rw-r--r--lisp/net/tramp-smb.el2
-rw-r--r--lisp/net/tramp-uu.el2
-rw-r--r--lisp/net/tramp.el20
-rw-r--r--lisp/net/trampver.el2
-rw-r--r--test/lisp/net/tramp-tests.el18
12 files changed, 35 insertions, 37 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index bf89ab37123..4191c3ec93a 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1,4 +1,4 @@
1;;; tramp-adb.el --- Functions for calling Android Debug Bridge from Tramp 1;;; tramp-adb.el --- Functions for calling Android Debug Bridge from Tramp -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2011-2017 Free Software Foundation, Inc. 3;; Copyright (C) 2011-2017 Free Software Foundation, Inc.
4 4
@@ -209,7 +209,7 @@ pass to the OPERATION."
209 (tramp-message v 6 "\n%s" (buffer-string)) 209 (tramp-message v 6 "\n%s" (buffer-string))
210 (goto-char (point-min)) 210 (goto-char (point-min))
211 (while (search-forward-regexp "^\\(\\S-+\\)[[:space:]]+device$" nil t) 211 (while (search-forward-regexp "^\\(\\S-+\\)[[:space:]]+device$" nil t)
212 (add-to-list 'result (list nil (match-string 1)))) 212 (push (list nil (match-string 1)) result))
213 213
214 ;; Replace ":" by "#". 214 ;; Replace ":" by "#".
215 (mapc 215 (mapc
@@ -1060,8 +1060,7 @@ E.g. a host name \"192.168.1.1#5555\" returns \"192.168.1.1:5555\"
1060 ;; unwanted entries first. 1060 ;; unwanted entries first.
1061 (tramp-flush-connection-property nil) 1061 (tramp-flush-connection-property nil)
1062 (with-tramp-connection-property (tramp-get-connection-process vec) "device" 1062 (with-tramp-connection-property (tramp-get-connection-process vec) "device"
1063 (let* ((method (tramp-file-name-method vec)) 1063 (let* ((host (tramp-file-name-host vec))
1064 (host (tramp-file-name-host vec))
1065 (port (tramp-file-name-port vec)) 1064 (port (tramp-file-name-port vec))
1066 (devices (mapcar 'cadr (tramp-adb-parse-device-names nil)))) 1065 (devices (mapcar 'cadr (tramp-adb-parse-device-names nil))))
1067 (replace-regexp-in-string 1066 (replace-regexp-in-string
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index ce7df02e094..64268cfc25a 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -1,4 +1,4 @@
1;;; tramp-cache.el --- file information caching for Tramp 1;;; tramp-cache.el --- file information caching for Tramp -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2000, 2005-2017 Free Software Foundation, Inc. 3;; Copyright (C) 2000, 2005-2017 Free Software Foundation, Inc.
4 4
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index 576f9b1eadc..c41b5b5659e 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -1,4 +1,4 @@
1;;; tramp-cmds.el --- Interactive commands for Tramp 1;;; tramp-cmds.el --- Interactive commands for Tramp -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2007-2017 Free Software Foundation, Inc. 3;; Copyright (C) 2007-2017 Free Software Foundation, Inc.
4 4
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 8e5b3e45d13..8f346eb4409 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -1,4 +1,4 @@
1;;; tramp-compat.el --- Tramp compatibility functions 1;;; tramp-compat.el --- Tramp compatibility functions -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2007-2017 Free Software Foundation, Inc. 3;; Copyright (C) 2007-2017 Free Software Foundation, Inc.
4 4
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el
index 85e4f2b0f0c..231383fde3d 100644
--- a/lisp/net/tramp-ftp.el
+++ b/lisp/net/tramp-ftp.el
@@ -1,4 +1,4 @@
1;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP 1;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2002-2017 Free Software Foundation, Inc. 3;; Copyright (C) 2002-2017 Free Software Foundation, Inc.
4 4
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 7725d40f198..561f6c8f79d 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1,4 +1,4 @@
1;;; tramp-gvfs.el --- Tramp access functions for GVFS daemon 1;;; tramp-gvfs.el --- Tramp access functions for GVFS daemon -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2009-2017 Free Software Foundation, Inc. 3;; Copyright (C) 2009-2017 Free Software Foundation, Inc.
4 4
@@ -1874,12 +1874,9 @@ This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi."
1874 (lambda (x) 1874 (lambda (x)
1875 (let* ((list (split-string x ";")) 1875 (let* ((list (split-string x ";"))
1876 (host (nth 6 list)) 1876 (host (nth 6 list))
1877 (port (nth 8 list))
1878 (text (tramp-compat-funcall 1877 (text (tramp-compat-funcall
1879 'split-string (nth 9 list) "\" \"" 'omit "\"")) 1878 'split-string (nth 9 list) "\" \"" 'omit "\""))
1880 user) 1879 user)
1881; (when (and port (not (string-equal port "0")))
1882; (setq host (format "%s%s%s" host tramp-prefix-port-regexp port)))
1883 ;; A user is marked in a TXT field like "u=guest". 1880 ;; A user is marked in a TXT field like "u=guest".
1884 (while text 1881 (while text
1885 (when (string-match "u=\\(.+\\)$" (car text)) 1882 (when (string-match "u=\\(.+\\)$" (car text))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index af27d3e28ec..486e002facf 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1,4 +1,4 @@
1;;; tramp-sh.el --- Tramp access functions for (s)sh-like connections 1;;; tramp-sh.el --- Tramp access functions for (s)sh-like connections -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 1998-2017 Free Software Foundation, Inc. 3;; Copyright (C) 1998-2017 Free Software Foundation, Inc.
4 4
@@ -33,6 +33,9 @@
33(eval-when-compile 33(eval-when-compile
34 (require 'cl) 34 (require 'cl)
35 (require 'dired)) 35 (require 'dired))
36
37(declare-function dired-remove-file "dired-aux")
38(defvar dired-compress-file-suffixes)
36(defvar vc-handled-backends) 39(defvar vc-handled-backends)
37(defvar vc-bzr-program) 40(defvar vc-bzr-program)
38(defvar vc-git-program) 41(defvar vc-git-program)
@@ -2593,9 +2596,6 @@ The method used must be an out-of-band method."
2593 2596
2594;; Dired. 2597;; Dired.
2595 2598
2596(defvar dired-compress-file-suffixes)
2597(declare-function dired-remove-file "dired-aux")
2598
2599(defun tramp-sh-handle-dired-compress-file (file) 2599(defun tramp-sh-handle-dired-compress-file (file)
2600 "Like `dired-compress-file' for Tramp files." 2600 "Like `dired-compress-file' for Tramp files."
2601 ;; Code stolen mainly from dired-aux.el. 2601 ;; Code stolen mainly from dired-aux.el.
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 91f69567573..eaa8ac655e0 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -1,4 +1,4 @@
1;;; tramp-smb.el --- Tramp access functions for SMB servers 1;;; tramp-smb.el --- Tramp access functions for SMB servers -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2002-2017 Free Software Foundation, Inc. 3;; Copyright (C) 2002-2017 Free Software Foundation, Inc.
4 4
diff --git a/lisp/net/tramp-uu.el b/lisp/net/tramp-uu.el
index 0aa2cc09924..5e5f05da4a8 100644
--- a/lisp/net/tramp-uu.el
+++ b/lisp/net/tramp-uu.el
@@ -1,4 +1,4 @@
1;;; tramp-uu.el --- uuencode in Lisp 1;;; tramp-uu.el --- uuencode in Lisp -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2002-2017 Free Software Foundation, Inc. 3;; Copyright (C) 2002-2017 Free Software Foundation, Inc.
4 4
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index fdd4661decb..a9254693adb 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1,4 +1,4 @@
1;;; tramp.el --- Transparent Remote Access, Multiple Protocol 1;;; tramp.el --- Transparent Remote Access, Multiple Protocol -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 1998-2017 Free Software Foundation, Inc. 3;; Copyright (C) 1998-2017 Free Software Foundation, Inc.
4 4
@@ -60,7 +60,10 @@
60;; Pacify byte-compiler. 60;; Pacify byte-compiler.
61(eval-when-compile 61(eval-when-compile
62 (require 'cl)) 62 (require 'cl))
63(defvar auto-save-file-name-transforms)
63(defvar eshell-path-env) 64(defvar eshell-path-env)
65(defvar ls-lisp-use-insert-directory-program)
66(defvar outline-regexp)
64 67
65;;; User Customizable Internal Variables: 68;;; User Customizable Internal Variables:
66 69
@@ -1374,8 +1377,6 @@ Point must be at the beginning of a header line.
1374The outline level is equal to the verbosity of the Tramp message." 1377The outline level is equal to the verbosity of the Tramp message."
1375 (1+ (string-to-number (match-string 1)))) 1378 (1+ (string-to-number (match-string 1))))
1376 1379
1377(defvar outline-regexp)
1378
1379(defun tramp-get-debug-buffer (vec) 1380(defun tramp-get-debug-buffer (vec)
1380 "Get the debug buffer for VEC." 1381 "Get the debug buffer for VEC."
1381 (with-current-buffer 1382 (with-current-buffer
@@ -1871,13 +1872,12 @@ temporary file names. If `file-coding-system-alist' contains an
1871expression, which matches more than the file name suffix, the 1872expression, which matches more than the file name suffix, the
1872coding system might not be determined. This function repairs it." 1873coding system might not be determined. This function repairs it."
1873 (let (result) 1874 (let (result)
1874 (dolist (elt file-coding-system-alist result) 1875 (dolist (elt file-coding-system-alist (nreverse result))
1875 (when (and (consp elt) (string-match (car elt) filename)) 1876 (when (and (consp elt) (string-match (car elt) filename))
1876 ;; We found a matching entry in `file-coding-system-alist'. 1877 ;; We found a matching entry in `file-coding-system-alist'.
1877 ;; So we add a similar entry, but with the temporary file name 1878 ;; So we add a similar entry, but with the temporary file name
1878 ;; as regexp. 1879 ;; as regexp.
1879 (add-to-list 1880 (push (cons (regexp-quote tmpname) (cdr elt)) result)))))
1880 'result (cons (regexp-quote tmpname) (cdr elt)) 'append)))))
1881 1881
1882;;;###autoload 1882;;;###autoload
1883(progn (defun tramp-run-real-handler (operation args) 1883(progn (defun tramp-run-real-handler (operation args)
@@ -2328,9 +2328,9 @@ not in completion mode."
2328 (when elt 2328 (when elt
2329 (string-match tramp-prefix-regexp elt) 2329 (string-match tramp-prefix-regexp elt)
2330 (setq elt (replace-match (concat tramp-prefix-format hop) nil nil elt)) 2330 (setq elt (replace-match (concat tramp-prefix-format hop) nil nil elt))
2331 (add-to-list 2331 (push
2332 'result1 2332 (substring elt (length (tramp-drop-volume-letter directory)))
2333 (substring elt (length (tramp-drop-volume-letter directory)))))) 2333 result1)))
2334 2334
2335 ;; Complete local parts. 2335 ;; Complete local parts.
2336 (append 2336 (append
@@ -2955,8 +2955,6 @@ User is always nil."
2955 backup-directory-alist))) 2955 backup-directory-alist)))
2956 (tramp-run-real-handler 'find-backup-file-name (list filename))))) 2956 (tramp-run-real-handler 'find-backup-file-name (list filename)))))
2957 2957
2958(defvar ls-lisp-use-insert-directory-program)
2959
2960(defun tramp-handle-insert-directory 2958(defun tramp-handle-insert-directory
2961 (filename switches &optional wildcard full-directory-p) 2959 (filename switches &optional wildcard full-directory-p)
2962 "Like `insert-directory' for Tramp files." 2960 "Like `insert-directory' for Tramp files."
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 35ad2f0acff..35b5eb6728a 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -1,4 +1,4 @@
1;;; trampver.el --- Transparent Remote Access, Multiple Protocol 1;;; trampver.el --- Transparent Remote Access, Multiple Protocol -*- lexical-binding:t -*-
2;;; lisp/trampver.el. Generated from trampver.el.in by configure. 2;;; lisp/trampver.el. Generated from trampver.el.in by configure.
3 3
4;; Copyright (C) 2003-2017 Free Software Foundation, Inc. 4;; Copyright (C) 2003-2017 Free Software Foundation, Inc.
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 45b4ff2f5ab..2a4ef740a04 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -1,4 +1,4 @@
1;;; tramp-tests.el --- Tests of remote file access 1;;; tramp-tests.el --- Tests of remote file access -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2013-2017 Free Software Foundation, Inc. 3;; Copyright (C) 2013-2017 Free Software Foundation, Inc.
4 4
@@ -37,6 +37,7 @@
37 37
38;;; Code: 38;;; Code:
39 39
40(require 'dired)
40(require 'ert) 41(require 'ert)
41(require 'tramp) 42(require 'tramp)
42(require 'vc) 43(require 'vc)
@@ -44,11 +45,11 @@
44(require 'vc-git) 45(require 'vc-git)
45(require 'vc-hg) 46(require 'vc-hg)
46 47
47(autoload 'dired-uncache "dired")
48(declare-function tramp-find-executable "tramp-sh") 48(declare-function tramp-find-executable "tramp-sh")
49(declare-function tramp-get-remote-path "tramp-sh") 49(declare-function tramp-get-remote-path "tramp-sh")
50(declare-function tramp-get-remote-stat "tramp-sh") 50(declare-function tramp-get-remote-stat "tramp-sh")
51(declare-function tramp-get-remote-perl "tramp-sh") 51(declare-function tramp-get-remote-perl "tramp-sh")
52(defvar auto-save-file-name-transforms)
52(defvar tramp-copy-size-limit) 53(defvar tramp-copy-size-limit)
53(defvar tramp-persistency-file-name) 54(defvar tramp-persistency-file-name)
54(defvar tramp-remote-process-environment) 55(defvar tramp-remote-process-environment)
@@ -2083,17 +2084,20 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
2083 (skip-unless 2084 (skip-unless
2084 (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory))) 2085 (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory)))
2085 2086
2087 ;; `make-nearby-temp-file' and `temporary-file-directory' exists
2088 ;; since Emacs 26. We don't want to see compiler warnings for older
2089 ;; Emacsen."
2086 (let ((default-directory tramp-test-temporary-file-directory) 2090 (let ((default-directory tramp-test-temporary-file-directory)
2087 tmp-file) 2091 tmp-file)
2088 ;; The remote host shall know a temporary file directory. 2092 ;; The remote host shall know a temporary file directory.
2089 (should (stringp (temporary-file-directory))) 2093 (should (stringp (with-no-warnings (temporary-file-directory))))
2090 (should 2094 (should
2091 (string-equal 2095 (string-equal
2092 (file-remote-p default-directory) 2096 (file-remote-p default-directory)
2093 (file-remote-p (temporary-file-directory)))) 2097 (file-remote-p (with-no-warnings (temporary-file-directory)))))
2094 2098
2095 ;; The temporary file shall be located on the remote host. 2099 ;; The temporary file shall be located on the remote host.
2096 (setq tmp-file (make-nearby-temp-file "tramp-test")) 2100 (setq tmp-file (with-no-warnings (make-nearby-temp-file "tramp-test")))
2097 (should (file-exists-p tmp-file)) 2101 (should (file-exists-p tmp-file))
2098 (should (file-regular-p tmp-file)) 2102 (should (file-regular-p tmp-file))
2099 (should 2103 (should
@@ -2103,7 +2107,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
2103 (delete-file tmp-file) 2107 (delete-file tmp-file)
2104 (should-not (file-exists-p tmp-file)) 2108 (should-not (file-exists-p tmp-file))
2105 2109
2106 (setq tmp-file (make-nearby-temp-file "tramp-test" 'dir)) 2110 (setq tmp-file (with-no-warnings (make-nearby-temp-file "tramp-test" 'dir)))
2107 (should (file-exists-p tmp-file)) 2111 (should (file-exists-p tmp-file))
2108 (should (file-directory-p tmp-file)) 2112 (should (file-directory-p tmp-file))
2109 (delete-directory tmp-file) 2113 (delete-directory tmp-file)
@@ -2582,7 +2586,7 @@ process sentinels. They shall not disturb each other."
2582 ;; Create temporary buffers. The number of buffers 2586 ;; Create temporary buffers. The number of buffers
2583 ;; corresponds to the number of processes; it could be 2587 ;; corresponds to the number of processes; it could be
2584 ;; increased in order to make pressure on Tramp. 2588 ;; increased in order to make pressure on Tramp.
2585 (dotimes (i 5) 2589 (dotimes (_i 5)
2586 (add-to-list 'buffers (generate-new-buffer "*temp*"))) 2590 (add-to-list 'buffers (generate-new-buffer "*temp*")))
2587 2591
2588 ;; Open asynchronous processes. Set process sentinel. 2592 ;; Open asynchronous processes. Set process sentinel.