Function: tramp-vc-file-name-handler

tramp-vc-file-name-handler is a byte-compiled function defined in tramp-sh.el.gz.

Signature

(tramp-vc-file-name-handler OPERATION &rest ARGS)

Documentation

Invoke special file name handler, which collects files to be handled.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
(defun tramp-vc-file-name-handler (operation &rest args)
  "Invoke special file name handler, which collects files to be handled."
  (save-match-data
    (if-let* ((filename
	       (tramp-replace-environment-variables
		(apply #'tramp-file-name-for-operation operation args)))
	      ((tramp-tramp-file-p filename))
	      (fn (assoc operation tramp-sh-file-name-handler-alist)))
	(with-parsed-tramp-file-name filename nil
	  (cond
	   ;; That's what we want: file names, for which checks are
	   ;; applied.  We assume that VC uses only `file-exists-p',
	   ;; `file-readable-p' and `file-directory-p' checks;
	   ;; otherwise we must extend the list.  The respective cache
	   ;; value must be set for these functions in
	   ;; `tramp-bundle-read-file-names'.
	   ;; We do not perform any action, but return nil, in order
	   ;; to keep `vc-registered' running.
	   ((memq operation '(file-exists-p file-readable-p file-directory-p))
	    (add-to-list 'tramp-vc-registered-file-names localname 'append)
	    nil)
	   ;; `process-file' and `start-file-process' shall be ignored.
	   ((eq operation 'process-file) 0)
	   ((eq operation 'start-file-process) nil)
	   ;; Tramp file name handlers like `expand-file-name'.  They
	   ;; must still work.
	   (t (save-match-data (apply (cdr fn) args)))))

      ;; When `tramp-mode' is not enabled, or the file name is not a
      ;; remote file name, we don't do anything.  Same for default
      ;; file name handlers.
      (tramp-run-real-handler operation args))))