zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.42k stars 1.16k forks source link

Micro puts stuff into $XDG_CONFIG_HOME that doesn't belong there #3176

Open bartekpacia opened 3 months ago

bartekpacia commented 3 months ago

From what I understand, XDG_CONFIG_HOME is for configuration files, like settings.json and bindings.json.

However in my case micro misuses that directory to place some other autogenerated files in there:

$ tree -a ~/.config/micro
micro
├── backups
│   └── %Users%bartek%projects%cg-t01-g12%blah
├── bindings.json
├── buffers
└── settings.json

3 directories, 3 files

I think stuff like backups and buffers doesn't belong to XDG_DATA_HOME. Instead they should be in $XDG_STATE_HOME (or maybe $XDG_DATA_HOME?).

Specifications

Micro version

$ micro --version
Version: 2.0.13
Commit hash: 68d88b57
Compiled on October 21, 2023

OS

$ sw_vers
ProductName:        macOS
ProductVersion:     14.4
BuildVersion:       23E214

Terminal

iTerm2 (build 3.5.0beta19)

JoeKar commented 3 months ago

Currently there is no logic to take a different default as XDG_CONFIG_HOME, but this is at least manually configurable via backupdir (see: options.md)

bartekpacia commented 3 months ago

I'll be happy to contribute this if only I get a buy in from a maintainer:)

JoeKar commented 3 months ago

Please give it a shot. We're happy about every helping hand.

Somewhere here it's good to start: https://github.com/zyedidia/micro/blob/master/internal/buffer/backup.go#L72-L75

clipcarl commented 2 weeks ago

I've submitted a patch (and a link to a Linux test binary) in #3185.