Commit cac8884d authored by Michael Albinus's avatar Michael Albinus

Require less packages in Tramp

* lisp/net/tramp-compat.el (format-spec): Do not require advice, cl-lib,
custom, password-cache, timer and ucs-normalize.

* lisp/net/tramp-gvfs.el: Do not require zeroconf.  Declare
zeroconf-* functions.
(tramp-gvfs-enabled): Autoload `zeroconf-init'.

* lisp/net/tramp-sh.el: Do not require dired.

* lisp/net/tramp.el (tramp-get-debug-buffer): Do not require outline.
(tramp-file-name-for-operation): Extend docstring.
(tramp-parse-netrc): Do not require netrc.  Autoload `netrc-parse'.
parent 1943220d
......@@ -35,15 +35,9 @@
(defun tramp-unload-file-name-handlers ())
(require 'auth-source)
(require 'advice)
(require 'cl-lib)
(require 'custom)
(require 'format-spec)
(require 'parse-time)
(require 'password-cache)
(require 'shell)
(require 'timer)
(require 'ucs-normalize)
(declare-function tramp-handle-temporary-file-directory "tramp")
......
......@@ -99,16 +99,21 @@
(eval-when-compile (require 'cl-lib))
(require 'tramp)
(require 'dbus)
(require 'url-parse)
(require 'url-util)
(require 'zeroconf)
;; Pacify byte-compiler.
(eval-when-compile
(require 'custom))
(declare-function zeroconf-init "zeroconf")
(declare-function zeroconf-list-service-types "zeroconf")
(declare-function zeroconf-list-services "zeroconf")
(declare-function zeroconf-service-host "zeroconf")
(declare-function zeroconf-service-port "zeroconf")
(declare-function zeroconf-service-txt "zeroconf")
;; We don't call `dbus-ping', because this would load dbus.el.
(defconst tramp-gvfs-enabled
(ignore-errors
......
......@@ -31,10 +31,10 @@
;; Pacify byte-compiler.
(require 'cl-lib)
(declare-function recentf-cleanup "recentf")
(declare-function tramp-dissect-file-name "tramp")
(declare-function tramp-file-name-equal-p "tramp")
(declare-function tramp-tramp-file-p "tramp")
(declare-function recentf-cleanup "recentf")
(defvar eshell-path-env)
(defvar recentf-exclude)
(defvar tramp-current-connection)
......
......@@ -30,10 +30,6 @@
(eval-when-compile (require 'cl-lib))
(require 'tramp)
;; Pacify byte-compiler.
(eval-when-compile
(require 'dired))
(declare-function dired-remove-file "dired-aux")
(defvar dired-compress-file-suffixes)
(defvar vc-handled-backends)
......
......@@ -1641,8 +1641,6 @@ The outline level is equal to the verbosity of the Tramp message."
(get-buffer-create (tramp-debug-buffer-name vec))
(when (bobp)
(setq buffer-undo-list t)
;; So it does not get loaded while `outline-regexp' is let-bound.
(require 'outline)
;; Activate `outline-mode'. This runs `text-mode-hook' and
;; `outline-mode-hook'. We must prevent that local processes
;; die. Yes: I've seen `flyspell-mode', which starts "ispell".
......@@ -2142,7 +2140,11 @@ pass to the OPERATION."
;; function as well but regexp only.
(defun tramp-file-name-for-operation (operation &rest args)
"Return file name related to OPERATION file primitive.
ARGS are the arguments OPERATION has been called with."
ARGS are the arguments OPERATION has been called with.
It does not always return a Tramp file name, for example if the
first argument of `expand-file-name' is absolute and not remote.
Must be handled by the callers."
(cond
;; FILE resp DIRECTORY.
((member operation
......@@ -2954,7 +2956,9 @@ Host is always \"localhost\"."
(defun tramp-parse-netrc (filename)
"Return a list of (user host) tuples allowed to access.
User may be nil."
(require 'netrc)
;; The declaration is not sufficient at runtime, because netrc.el is
;; not autoloaded.
(autoload 'netrc-parse "netrc")
(mapcar
(lambda (item)
(and (assoc "machine" item)
......@@ -3387,6 +3391,7 @@ User is always nil."
(access-file filename "Reading directory"))
(with-parsed-tramp-file-name (expand-file-name filename) nil
(with-tramp-progress-reporter v 0 (format "Opening directory %s" filename)
;; We must load it in order to get the advice around `insert-directory'.
(require 'ls-lisp)
(let (ls-lisp-use-insert-directory-program start)
(tramp-run-real-handler
......@@ -4879,7 +4884,6 @@ Only works for Bourne-like shells."
;; - Unload all `tramp-*' packages
;; - Reset `file-name-handler-alist'
;; - Cleanup hooks where Tramp functions are in
;; - Cleanup advised functions
;; - Cleanup autoloads
;;;###autoload
(defun tramp-unload-tramp ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment