Skip to content

Resolve the state files with locate-user-emacs-file - #2145

Merged
bbatsov merged 1 commit into
masterfrom
fix/locate-user-emacs-file
Jul 29, 2026
Merged

Resolve the state files with locate-user-emacs-file#2145
bbatsov merged 1 commit into
masterfrom
fix/locate-user-emacs-file

Conversation

@bbatsov

@bbatsov bbatsov commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Projectile's three global state paths - the known projects file, the frecency
store and the session directory - were each expanded against
user-emacs-directory by hand.

Since Emacs 27 a configuration can live in ~/.config/emacs, and
locate-user-emacs-file is the thing that knows it. That's why bookmark,
recentf, savehist and project.el's own project-list-file all go through
it. Projectile's didn't, so for anyone with an XDG-style configuration these
three files were dropped into a ~/.emacs.d that holds nothing else.

Nothing moves for a configuration in the usual place - there's a spec pinning
that. The :package-version tags are bumped because the effective default does
change for everyone else.

Two things deliberately left alone, having looked at what core does with them:

  • The per-project file cache (.projectile-cache.eld) stays in the project.
    That was a considered decision and XDG has nothing to offer it.
  • Nothing moves to xdg-cache-home. Core does use it - org-persist and
    tramp both do - but only for data that regenerates freely. Projectile's
    frecency store is earned: losing it to a cache clear would quietly degrade
    find-file ranking with nothing to indicate why. The known projects and the
    saved sessions are irreplaceable outright.

Also worth noting for anyone wondering about no-littering: it already themes
these paths individually, and this change doesn't interfere with that.

The known projects file, the frecency store and the session directory
were each expanded against user-emacs-directory by hand. Since Emacs 27
a configuration can live in ~/.config/emacs, and locate-user-emacs-file
is what knows that - which is why bookmark, recentf, savehist and
project.el all go through it. Projectile's three didn't, so they landed
in ~/.emacs.d for people whose Emacs state is elsewhere.

Nothing moves for a configuration in the usual place, which is what the
last spec pins. The :package-version tags are bumped because the default
does change for everyone else.

The per-project file cache is deliberately untouched: it lives in the
project on purpose, and XDG has nothing to offer it.
@bbatsov
bbatsov merged commit e27c473 into master Jul 29, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant