]> git.eshelyaron.com Git - emacs.git/commitdiff
Do not register Tramp file name handlers twice
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 28 Mar 2022 10:02:23 +0000 (12:02 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 28 Mar 2022 10:02:23 +0000 (12:02 +0200)
* 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.

lisp/net/tramp-archive.el
lisp/net/tramp.el

index 788e4573679103b115bf9e6b5450d317425d3fa9..890c8dbb755a044210e2259a9610245f72559145 100644 (file)
@@ -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))
index 0192a63a10423bfacd449a8ae907765e4cc418a6..580cfea1f85d5d3837d1ff6707a01675fd3d88ca 100644 (file)
@@ -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)