From: Michael Albinus Date: Mon, 28 Mar 2022 10:02:23 +0000 (+0200) Subject: Do not register Tramp file name handlers twice X-Git-Tag: emacs-29.0.90~1931^2~884 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a5841b196f12894df4c1bb073f28ddadb6faa3cf;p=emacs.git Do not register Tramp file name handlers twice * lisp/net/tramp.el (tramp-register-autoload-file-name-handlers): * lisp/net/tramp-archive.el (tramp-register-archive-file-name-handler): Check, whether the real file name handler is already registered. --- diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index 788e4573679..890c8dbb755 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el @@ -374,7 +374,9 @@ arguments to pass to the OPERATION." ;;;###autoload (progn (defun tramp-register-archive-file-name-handler () "Add archive file name handler to `file-name-handler-alist'." - (when tramp-archive-enabled + (when (and tramp-archive-enabled + (not + (rassq #'tramp-archive-file-name-handler file-name-handler-alist))) (add-to-list 'file-name-handler-alist (cons (tramp-archive-autoload-file-name-regexp) #'tramp-archive-autoload-file-name-handler)) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 0192a63a104..580cfea1f85 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2756,10 +2756,11 @@ Falls back to normal file name handler if no Tramp file name handler exists." ;;;###autoload (progn (defun tramp-register-autoload-file-name-handlers () "Add Tramp file name handlers to `file-name-handler-alist' during autoload." - (add-to-list 'file-name-handler-alist - (cons tramp-autoload-file-name-regexp - #'tramp-autoload-file-name-handler)) - (put #'tramp-autoload-file-name-handler 'safe-magic t))) + (unless (rassq #'tramp-file-name-handler file-name-handler-alist) + (add-to-list 'file-name-handler-alist + (cons tramp-autoload-file-name-regexp + #'tramp-autoload-file-name-handler)) + (put #'tramp-autoload-file-name-handler 'safe-magic t)))) (put #'tramp-register-autoload-file-name-handlers 'tramp-autoload t) ;;;###autoload (tramp-register-autoload-file-name-handlers)