Consider storing persistent history under XDG_STATE_HOME

Open
#2,284 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Domain
backend

Research direction

Start by locating how Lem resolves lem-home and how persistent history paths are constructed; the issue does not name specific files or tests. Check the project’s existing path and configuration conventions, then determine how history can use an XDG state directory while preserving LEM_HOME compatibility. Done means persistent history uses the separate state location with the stated fallback, while configuration remains under LEM_HOME.

Written by the indexing model from the issue text.

Description

Lem currently stores persistent history under (lem-home)/history,
which normally resolves to:

$XDG_CONFIG_HOME/lem/history

This means mutable application state is stored alongside user
configuration.

Persistent history such as recent files, command history, project
history, and REPL history seems to fit better under XDG_STATE_HOME,
for example:

$XDG_STATE_HOME/lem/history/

with the usual fallback:

~/.local/state/lem/history/

This also matters for declarative configuration managers such as
GNU Guix Home or Nix/Home Manager, where $XDG_CONFIG_HOME/lem
may be managed as an immutable/read-only directory.

Would it make sense for Lem to support a separate state directory,
perhaps something like lem-state-home, while keeping the existing
LEM_HOME behavior for backwards compatibility?

For example:

$XDG_CONFIG_HOME/lem/init.lisp
$XDG_STATE_HOME/lem/history/files
$XDG_STATE_HOME/lem/history/projects
$XDG_STATE_HOME/lem/history/commands
$XDG_STATE_HOME/lem/history/lisp-repl

I also noticed that some other mutable data, such as logs, is currently
stored relative to lem-home, but I'm keeping this issue specifically
about persistent history.

Dominant language
Common Lisp
Stars
3.1k
Forks
261
Avg merge
1d 6h
Merged PRs (30d)
133

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lem-project/lem

All issues in lem-project/lem

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.