Reduce autoloaded objects in Tramp

* lisp/net/tramp-adb.el (tramp-adb-program)
(tramp-adb-connect-if-not-connected, tramp-adb-prompt):
Remove autoload cookie.

* lisp/net/tramp-cache.el (tramp-connection-properties)
(tramp-persistency-file-name): Remove autoload cookie.

* lisp/net/tramp-ftp.el (tramp-ftp-enable-ange-ftp):
Use `tramp-autoload' cookie.

* lisp/net/tramp-gvfs.el (tramp-gvfs-zeroconf-domain):
Remove autoload cookie.

* lisp/net/tramp-rclone.el (tramp-rclone-program): Remove autoload
cookie.
(tramp-set-completion-function): Use `tramp--with-startup'.

* lisp/net/tramp-sh.el (tramp-inline-compress-start-size)
(tramp-copy-size-limit, tramp-histfile-override)
(tramp-use-ssh-controlmaster-options, tramp-remote-path)
(tramp-remote-process-environment, tramp-sh-extra-args):
Remove autoload cookie.
(tramp-stat-marker, tramp-stat-quoted-marker): Move to tramp.el.

* lisp/net/tramp-smb.el (tramp-smb-program)
(tramp-smb-acl-program, tramp-smb-conf)
(tramp-smb-winexe-program, tramp-smb-winexe-shell-command)
(tramp-smb-winexe-shell-command-switch): Remove autoload cookie.

* lisp/net/tramp-sudoedit.el (server, tramp-sh): Do not require.

* lisp/net/tramp.el (tramp--startup-hook): Define.
(tramp-stat-marker, tramp-stat-quoted-marker): New defconsts,
taken from tramp-sh.el.

* test/lisp/net/tramp-archive-tests.el (tramp-copy-size-limit)
(tramp-persistency-file-name): Declare.

* test/lisp/net/tramp-tests.el (tramp-connection-properties)
(tramp-display-escape-sequence-regexp)
(tramp-inline-compress-start-size, tramp-remote-path): Declare.
This commit is contained in:
Michael Albinus 2018-12-17 11:50:06 +01:00
parent 522acbf49c
commit 3e9ecaec3b
11 changed files with 21 additions and 34 deletions

View file

@ -35,14 +35,12 @@
(require 'tramp)
;;;###tramp-autoload
(defcustom tramp-adb-program "adb"
"Name of the Android Debug Bridge program."
:group 'tramp
:version "24.4"
:type 'string)
;;;###tramp-autoload
(defcustom tramp-adb-connect-if-not-connected nil
"Try to run `adb connect' if provided device is not connected currently.
It is used for TCP/IP devices."
@ -54,7 +52,6 @@ It is used for TCP/IP devices."
(defconst tramp-adb-method "adb"
"When this method name is used, forward all calls to Android Debug Bridge.")
;;;###tramp-autoload
(defcustom tramp-adb-prompt
"^\\(?:[[:digit:]]*|?\\)?\\(?:[[:alnum:]\e;[]*@?[[:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]"
"Regexp used as prompt in almquist shell."

View file

@ -72,7 +72,6 @@
(defvar tramp-cache-data (make-hash-table :test 'equal)
"Hash table for remote files properties.")
;;;###tramp-autoload
(defcustom tramp-connection-properties nil
"List of static connection properties.
Every entry has the form (REGEXP PROPERTY VALUE). The regexp
@ -86,7 +85,6 @@ details see the info pages."
(choice :tag " Property" string)
(choice :tag " Value" sexp))))
;;;###tramp-autoload
(defcustom tramp-persistency-file-name
(expand-file-name (locate-user-emacs-file "tramp"))
"File which keeps connection history for Tramp connections."

View file

@ -57,7 +57,7 @@ present for backward compatibility."
'(when (functionp 'tramp-disable-ange-ftp)
(tramp-disable-ange-ftp)))
;;;###autoload
;;;###tramp-autoload
(defun tramp-ftp-enable-ange-ftp ()
"Reenable Ange-FTP, when Tramp is unloaded."
;; The following code is commented out in Ange-FTP.

View file

@ -155,7 +155,6 @@
(add-to-list 'tramp-default-host-alist
'("\\`gdrive\\'" nil ,(match-string 2 user-mail-address)))))
;;;###tramp-autoload
(defcustom tramp-gvfs-zeroconf-domain "local"
"Zeroconf domain to be used for discovering services, like host names."
:group 'tramp

View file

@ -42,7 +42,6 @@
(defconst tramp-rclone-method "rclone"
"When this method name is used, forward all calls to rclone mounts.")
;;;###tramp-autoload
(defcustom tramp-rclone-program "rclone"
"Name of the rclone program."
:group 'tramp
@ -60,9 +59,9 @@
(tramp-about-args ("--full")))))
;;;###tramp-autoload
(eval-after-load 'tramp
'(tramp-set-completion-function
tramp-rclone-method '((tramp-rclone-parse-device-names ""))))
(tramp--with-startup
(tramp-set-completion-function
tramp-rclone-method '((tramp-rclone-parse-device-names ""))))
;; New handlers should be added here.

View file

@ -41,8 +41,6 @@
(defvar vc-git-program)
(defvar vc-hg-program)
;; FIXME: Why autoload all those defcustoms?
;;;###tramp-autoload
(defcustom tramp-inline-compress-start-size 4096
"The minimum size of compressing where inline transfer.
When inline transfer, compress transferred data of file
@ -51,7 +49,6 @@ If it is nil, no compression at all will be applied."
:group 'tramp
:type '(choice (const nil) integer))
;;;###tramp-autoload
(defcustom tramp-copy-size-limit 10240
"The maximum file size where inline copying is preferred over an \
out-of-the-band copy.
@ -68,7 +65,6 @@ files conditionalize this setup based on the TERM environment variable."
:group 'tramp
:type 'string)
;;;###tramp-autoload
(defcustom tramp-histfile-override "~/.tramp_history"
"When invoking a shell, override the HISTFILE with this value.
When setting to a string, it redirects the shell history to that
@ -110,7 +106,6 @@ detected as prompt when being sent on echoing hosts, therefore.")
(defconst tramp-end-of-heredoc (md5 tramp-end-of-output)
"String used to recognize end of heredoc strings.")
;;;###tramp-autoload
(defcustom tramp-use-ssh-controlmaster-options t
"Whether to use `tramp-ssh-controlmaster-options'."
:group 'tramp
@ -471,7 +466,6 @@ The string is used in `tramp-methods'.")
;; Darwin: /usr/bin:/bin:/usr/sbin:/sbin
;; IRIX64: /usr/bin
;; QNAP QTS: ---
;;;###tramp-autoload
(defcustom tramp-remote-path
'(tramp-default-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin"
"/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin"
@ -501,7 +495,6 @@ the list by the special value `tramp-own-remote-path'."
(const :tag "Private Directories" tramp-own-remote-path)
(string :tag "Directory"))))
;;;###tramp-autoload
(defcustom tramp-remote-process-environment
'("ENV=''" "TMOUT=0" "LC_CTYPE=''"
"CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat"
@ -525,7 +518,6 @@ based on the Tramp and Emacs versions, and should not be set here."
:version "26.1"
:type '(repeat string))
;;;###tramp-autoload
(defcustom tramp-sh-extra-args '(("/bash\\'" . "-norc -noprofile"))
"Alist specifying extra arguments to pass to the remote shell.
Entries are (REGEXP . ARGS) where REGEXP is a regular expression
@ -920,13 +912,6 @@ od -v -t x1 -A n </dev/null && \
busybox awk '{}' </dev/null"
"Test command for checking `tramp-awk-encode' and `tramp-awk-decode'.")
(eval-and-compile
(defconst tramp-stat-marker "/////"
"Marker in stat commands for file attributes."))
(defconst tramp-stat-quoted-marker "\\/\\/\\/\\/\\/"
"Quoted marker in stat commands for file attributes.")
(defconst tramp-vc-registered-read-file-names
"echo \"(\"
while read file; do
@ -5092,6 +5077,7 @@ raises an error."
"`%s' does not return a valid Lisp expression: `%s'"
command (buffer-string))))))))
;; FIXME: Move to tramp.el?
;;;###tramp-autoload
(defun tramp-convert-file-attributes (vec attr)
"Convert `file-attributes' ATTR generated by perl script, stat or ls.

View file

@ -64,20 +64,17 @@
tramp-smb-method
'((tramp-parse-netrc "~/.netrc"))))
;;;###tramp-autoload
(defcustom tramp-smb-program "smbclient"
"Name of SMB client to run."
:group 'tramp
:type 'string)
;;;###tramp-autoload
(defcustom tramp-smb-acl-program "smbcacls"
"Name of SMB acls to run."
:group 'tramp
:type 'string
:version "24.4")
;;;###tramp-autoload
(defcustom tramp-smb-conf "/dev/null"
"Path of the smb.conf file.
If it is nil, no smb.conf will be added to the `tramp-smb-program'
@ -292,7 +289,6 @@ See `tramp-actions-before-shell' for more info.")
Operations not mentioned here will be handled by the default Emacs primitives.")
;; Options for remote processes via winexe.
;;;###tramp-autoload
(defcustom tramp-smb-winexe-program "winexe"
"Name of winexe client to run.
If it isn't found in the local $PATH, the absolute path of winexe
@ -301,7 +297,6 @@ shall be given. This is needed for remote processes."
:type 'string
:version "24.3")
;;;###tramp-autoload
(defcustom tramp-smb-winexe-shell-command "powershell.exe"
"Shell to be used for processes on remote machines.
This must be Powershell V2 compatible."
@ -309,7 +304,6 @@ This must be Powershell V2 compatible."
:type 'string
:version "24.3")
;;;###tramp-autoload
(defcustom tramp-smb-winexe-shell-command-switch "-file -"
"Command switch used together with `tramp-smb-winexe-shell-command'.
This can be used to disable echo etc."

View file

@ -35,8 +35,6 @@
;;; Code:
(require 'tramp)
(eval-when-compile (require 'tramp-sh)) ;For tramp-stat-marker
(require 'server)
;;;###tramp-autoload
(defconst tramp-sudoedit-method "sudoedit"

View file

@ -76,6 +76,9 @@
:version "22.1")
(eval-and-compile ;; So it's also available in tramp-loaddefs.el!
(defvar tramp--startup-hook nil
"Forms to be executed at the end of tramp.el.")
(defmacro tramp--with-startup (&rest body)
"Schedule BODY to be executed at the end of tramp.el."
`(add-hook 'tramp--startup-hook (lambda () ,@body))))
@ -3831,6 +3834,13 @@ of."
(tramp-message v 0 "Wrote %s" filename))
(run-hooks 'tramp-handle-write-region-hook)))
;; This is used in tramp-sh.el and tramp-sudoedit.el.
(defconst tramp-stat-marker "/////"
"Marker in stat commands for file attributes.")
(defconst tramp-stat-quoted-marker "\\/\\/\\/\\/\\/"
"Quoted marker in stat commands for file attributes.")
;; This is used in tramp-gvfs.el and tramp-sh.el.
(defconst tramp-gio-events
'("attribute-changed" "changed" "changes-done-hint"

View file

@ -24,6 +24,8 @@
(require 'ert)
(require 'tramp-archive)
(defvar tramp-copy-size-limit)
(defvar tramp-persistency-file-name)
(defconst tramp-archive-test-resource-directory
(let ((default-directory

View file

@ -57,8 +57,12 @@
(declare-function tramp-method-out-of-band-p "tramp-sh")
(declare-function tramp-smb-get-localname "tramp-smb")
(defvar auto-save-file-name-transforms)
(defvar tramp-connection-properties)
(defvar tramp-copy-size-limit)
(defvar tramp-display-escape-sequence-regexp)
(defvar tramp-inline-compress-start-size)
(defvar tramp-persistency-file-name)
(defvar tramp-remote-path)
(defvar tramp-remote-process-environment)
;; Beautify batch mode.