emacs-eldev / eldev

Elisp development tool
https://emacs-eldev.github.io/eldev/
GNU General Public License v3.0
226 stars 17 forks source link

Is it possiable to support XDG Based Directory? #62

Closed declantsien closed 2 years ago

declantsien commented 2 years ago

Emacs itself has xdg support (~/.config/emacs/).

doublep commented 2 years ago

What do you mean by support here?

declantsien commented 2 years ago

Then, you would be surprised if do this search q=+XDG+support&type=Issues on github. For The Record, I don't want to push this change though. Feel free to close this issue if you are not into this idea.

In summary, instead of putting a .eldev in user Home directory, move eldev related config/data/cache to obey platform-specific directory standards? Cargo (Rust build tool) has a rfc for this.

Also, see a list of tools are supporting from Archlinux wiki

doublep commented 2 years ago

Currently, Eldev stores configuration mixed up with caches in ~/.eldev. I.e. there are file config, directories MAJOR.MINOR per used Emacs version (containing own bootstrapped Eldev package) and, finally, directory global-cache, containing packages downloaded from internet archives. What would be the correct setup according to XDG rules?

declantsien commented 2 years ago

config: .config/eldev/config <-- ~/.eldev/config

For the cache/data cache: .cache/eldev/ data: .local/share/eldev/

Maybe borrow some structure from straight.el. Isn't the archives/package source version independent? Seems to me, only the build output(elc,eln) depends on Emacs version

tree -L 3 .eldev/
.eldev/
└── 28.0
    └── bootstrap
        ├── archives
        ├── eldev-0.10.3
        └── gnupg
tree -L 1 straight
straight
├── build-27.2
├── build-27.2-cache.el
├── build-28.0.50
├── build-28.0.50-cache.el
├── build-28.0.60
├── build-28.0.60-cache.el
├── build-29.0.50
├── build-29.0.50-cache.el
├── build-wr
├── build-wr-cache.el
├── links
├── modified
└── repos
doublep commented 2 years ago

Isn't the archives/package source version independent?

It is, but ~/.eldev/MAJOR.MINOR contains byte-compiled installed Eldev package. Those are not version-independent. Just run with ELDEV_LOCAL set to an empty value and check directory contents afterwards.

Maybe borrow some structure from straight.el.

I don't plan to change the structure dramatically. I'm willing to follow XDG guidelines and get rid of (move) ~/.eldev (with backward compatibility: keep using it if already exists) to e.g. ~/.config/eldev or whatever. I'm rather asking if XDG mandates splitting it into several directories, or if I can preserve current layout, just move the containing directory to another place.

declantsien commented 2 years ago

I'm willing to follow XDG guidelines and get rid of (move) ~/.eldev (with backward compatibility

:+1:

preserve current layout, just move the containing directory to another place.

Yeah, this should be enough

sirikid commented 2 years ago

I'm rather asking if XDG mandates splitting it into several directories

It's highly encouraged.

doublep commented 2 years ago

@ikappaki, @juergenhoetzel: do you have any comments on this regarding Windows? Does ~/.config normally exist because of other programs? Are variables such as $XDG_CONFIG_HOME set?

ikappaki commented 2 years ago

@ikappaki, @juergenhoetzel: do you have any comments on this regarding Windows? Does ~/.config normally exist because of other programs? Are variables such as $XDG_CONFIG_HOME set?

Hi @doubleb, I haven't seen it used by any native MS-Windows programs. The directory is likely to exist if one installs tools that were primarily developed for nix, ported to Windows and are XDG compatible. Though I'd find it unlikely for a Windows user to be aware of the XDG concept in general and thus have any `XDG_variable set. On my Windows computer, i have a couple of apps that have created entries in~/.config`, thus it works fine, even without the user having knowledge this is happening in the background.

I can't see any issues on Windows if Eldev is to support the XDG spec. It should just work. Sounds like a good idea. Hope this helps.

doublep commented 2 years ago

@ikappaki, @juergenhoetzel: Can you please have a look at weird error on Windows after the commit? Apparently, bin/eldev.bat is now erroneous, but I haven't modified it directly, only bootstrap.el.part, and then regenerated the .bat file with the standard mechanism. Without Windows all tests run fine...

ikappaki commented 2 years ago

@ikappaki, @juergenhoetzel: Can you please have a look at weird error on Windows after the commit? Apparently, bin/eldev.bat is now erroneous, but I haven't modified it directly, only bootstrap.el.part, and then regenerated the .bat file with the standard mechanism. Without Windows all tests run fine...

HI @doublep, I've added > to the list of chars to escape in eldev-bat-quote with #66. It fixes the issue. Thanks

doublep commented 2 years ago

Fixed now, thank you.

XDG changes will be released as part of 0.11, likely soon.

ikappaki commented 2 years ago

Hi @doublep,

I've noticed that the default Eldev installation directory has changed from ~/.eldev/bin to ~/.local/bin but the documentation still refers to the old location. Not sure if there is more to update (e.g. config location)?

Thanks

doublep commented 2 years ago

Released 0.11.

@ikappaki: This must be fixed now that future-doc branch got merged. Or is it still the case somewhere?

ikappaki commented 2 years ago

Released 0.11.

@ikappaki: This must be fixed now that future-doc branch got merged. Or is it still the case somewhere?

@doublep, docs look good, thanks