Function: projectile--frecency-record
projectile--frecency-record is a byte-compiled function defined in
projectile.el.
Signature
(projectile--frecency-record PROJECT-ROOT)
Documentation
Record a visit to the current buffer's file under PROJECT-ROOT.
Remote projects are not tracked, to keep the visit hook free of TRAMP round-trips.
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--frecency-record (project-root)
"Record a visit to the current buffer's file under PROJECT-ROOT.
Remote projects are not tracked, to keep the visit hook free of
TRAMP round-trips."
(when (and projectile-enable-frecency
project-root
buffer-file-name
(not (file-remote-p project-root)))
;; `projectile-project-root' is symlink-resolved, so resolve the
;; visited file the same way; otherwise a project reached through a
;; symlink produces a `../'-relative name and tracking is dropped for
;; the whole project. The recorded name then also matches the
;; completion candidates, which are relative to the resolved root.
(let ((file (projectile--project-relative-name
(file-truename buffer-file-name) project-root)))
;; Still skip anything genuinely outside the project.
(unless (string-prefix-p ".." file)
(let* ((table (projectile--frecency-data))
(files (or (gethash project-root table)
(puthash project-root
(make-hash-table :test 'equal) table)))
(entry (gethash file files)))
(puthash file (cons (1+ (or (car entry) 0))
(projectile-time-seconds))
files)
(setq projectile--frecency-dirty t)
(when (> (hash-table-count files) (* 2 projectile-frecency-max-files))
(projectile--frecency-prune files)))))))