Function: tramp-register-file-name-handlers

tramp-register-file-name-handlers is a byte-compiled function defined in tramp.el.gz.

Signature

(tramp-register-file-name-handlers)

Documentation

Add Tramp file name handlers to file-name-handler-alist.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defun tramp-register-file-name-handlers ()
  "Add Tramp file name handlers to `file-name-handler-alist'."
  ;; Remove autoloaded handlers from file name handler alist.  Useful,
  ;; if `tramp-syntax' has been changed.
  (tramp-unload-file-name-handlers)

  ;; Add the handlers.  We do not add anything to the `operations'
  ;; property of `tramp-file-name-handler',
  ;; `tramp-archive-file-name-handler' and
  ;; `tramp-crypt-file-name-handler', this shall be done by the
  ;; respective foreign handlers.
  (add-to-list 'file-name-handler-alist
	       (cons tramp-file-name-regexp #'tramp-file-name-handler))
  (put #'tramp-file-name-handler 'safe-magic t)

  (tramp-register-crypt-file-name-handler)

  (add-to-list 'file-name-handler-alist
	       (cons tramp-completion-file-name-regexp
		     #'tramp-completion-file-name-handler))
  (put #'tramp-completion-file-name-handler 'safe-magic t)
  ;; Mark `operations' the handler is responsible for.
  (put #'tramp-completion-file-name-handler 'operations
       (mapcar #'car tramp-completion-file-name-handler-alist))

  (when (bound-and-true-p tramp-archive-enabled)
    (add-to-list 'file-name-handler-alist
                 (cons tramp-archive-file-name-regexp
		       #'tramp-archive-file-name-handler))
    (put #'tramp-archive-file-name-handler 'safe-magic t))

  ;; If jka-compr or epa-file are already loaded, move them to the
  ;; front of `file-name-handler-alist'.
  (dolist (fnh '(epa-file-handler jka-compr-handler))
    (when-let ((entry (rassoc fnh file-name-handler-alist)))
      (setq file-name-handler-alist
	    (cons entry (delete entry file-name-handler-alist))))))