Fix error in tramp-archive-autoload-file-name-handler

* lisp/net/tramp-archive.el (tramp-archive-autoload-file-name-handler):
Always call `tramp-autoload-file-name'.  Otherwise, when
`tramp-archive-enabled’ is nil and
`tramp-archive-autoload-file-name-handler’ is in the
`file-name-handler-alist’ results in an error “Invalid handler in
`file-name-handler-alist” once Emacs calls
`tramp-archive-autoload-file-name-handler’ with a handler that
does not expect nil.  Always returning nil is also false in
general.

Copyright-paperwork-exempt: yes
This commit is contained in:
Felix Dietrich 2022-04-07 12:04:22 +02:00 committed by Michael Albinus
parent 11a1f7817e
commit aab36e1895

View file

@ -356,14 +356,13 @@ arguments to pass to the OPERATION."
(progn (defun tramp-archive-autoload-file-name-handler (operation &rest args)
"Load Tramp archive file name handler, and perform OPERATION."
(defvar tramp-archive-autoload)
(when tramp-archive-enabled
;; We cannot use `tramp-compat-temporary-file-directory' here due
;; to autoload. When installing Tramp's GNU ELPA package, there
;; might be an older, incompatible version active. We try to
;; overload this.
(let ((default-directory temporary-file-directory)
(tramp-archive-autoload t))
(apply #'tramp-autoload-file-name-handler operation args)))))
(let (;; We cannot use `tramp-compat-temporary-file-directory' here
;; due to autoload. When installing Tramp's GNU ELPA package,
;; there might be an older, incompatible version active. We
;; try to overload this.
(default-directory temporary-file-directory)
(tramp-archive-autoload tramp-archive-enabled))
(apply #'tramp-autoload-file-name-handler operation args))))
(put #'tramp-archive-autoload-file-name-handler 'tramp-autoload t)