Function: projectile-dashboard--recent-files

projectile-dashboard--recent-files is a byte-compiled function defined in projectile.el.

Signature

(projectile-dashboard--recent-files ROOT)

Documentation

Return ROOT's most frecent files, best first.

This is the ranking projectile-find-file completion uses (see projectile--frecency-score), capped at projectile-dashboard-recent-files.

The history outlives the files it tracks, so candidates are checked for existence as they are taken - which normally means one check per file shown, and never more than the tracked history. The check is skipped for a remote ROOT, where each one would be a round-trip (nothing is tracked for remote projects in the first place).

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-dashboard--recent-files (root)
  "Return ROOT's most frecent files, best first.
This is the ranking `projectile-find-file' completion uses (see
`projectile--frecency-score'), capped at
`projectile-dashboard-recent-files'.

The history outlives the files it tracks, so candidates are checked for
existence as they are taken - which normally means one check per file
shown, and never more than the tracked history.  The check is skipped
for a remote ROOT, where each one would be a round-trip (nothing is
tracked for remote projects in the first place)."
  (when projectile-enable-frecency
    (when-let* ((files (gethash root (projectile--frecency-data))))
      (let ((now (projectile-time-seconds))
            entries)
        (maphash (lambda (file entry)
                   (push (cons file (projectile--frecency-score entry now))
                         entries))
                 files)
        (let ((ranked (seq-sort-by #'cdr #'> entries))
              (remote (file-remote-p root))
              (taken 0)
              recent)
          (while (and ranked (< taken projectile-dashboard-recent-files))
            (let ((entry (pop ranked)))
              (when (or remote
                        (file-exists-p (expand-file-name (car entry) root)))
                (push entry recent)
                (setq taken (1+ taken)))))
          (nreverse recent))))))