Function: projectile-find-file-hook-function

projectile-find-file-hook-function is a byte-compiled function defined in projectile.el.

Signature

(projectile-find-file-hook-function)

Documentation

Called by find-file-hook when projectile-mode(var)/projectile-mode(fun) is on.

For remote (TRAMP) buffers the slow operations are skipped: the mode-line update probes many project-type markers on cold cache. The cheap operations - caching the visited file, registering the project as a known project, and the open-buffer-count cap - run regardless of remoteness; they were previously skipped only because the original blanket guard was overly broad.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-find-file-hook-function ()
  "Called by `find-file-hook' when `projectile-mode' is on.

For remote (TRAMP) buffers the slow operations are skipped: the
mode-line update probes many project-type markers on cold cache.  The
cheap operations - caching the visited file, registering the project as
a known project, and the open-buffer-count cap - run regardless of
remoteness; they were previously skipped only because the original
blanket guard was overly broad."
  (let ((remote (file-remote-p default-directory))
        ;; Resolve the project root once and thread it through the
        ;; sub-hooks, so a single `find-file' doesn't repeat the lookup.
        (project-root (projectile-project-p)))
    (projectile-maybe-limit-project-file-buffers project-root)
    (when projectile-auto-update-cache
      (projectile-cache-files-find-file-hook project-root))
    (projectile-track-known-projects-find-file-hook project-root)
    (projectile--maybe-run-project-changed-functions project-root)
    (projectile--frecency-record project-root)
    (unless remote
      (when projectile-dynamic-mode-line
        (projectile-update-mode-line)))))