Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add other optional paths to the default configuration #396

Closed
nechtarg opened this issue Dec 20, 2022 · 6 comments
Closed

Add other optional paths to the default configuration #396

nechtarg opened this issue Dec 20, 2022 · 6 comments
Labels
contribution Thank you to the contributor! implemented implemented tag means that either an enhancement or feature request has been implemented, or bugfix

Comments

@nechtarg
Copy link
Contributor

nechtarg commented Dec 20, 2022

Linux

Reference to the XDG-specification: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

  • Add the directory $XDG_CONFIG_DIR/latexindent to the optional locations where the configuration files (i.e. indentconfig.yamland .indentconfig.yaml) can be stored (e.g. use $XDG_CONFIG_DIR/latexindent/indentconfig.yaml instead of $HOME/indentconfig.yaml)
  • Or give users a way to change the default config location (e.g. through an environment variable)

Windows

Disclaimer: I don't use this platform so my information might be off, but as far as I know you should change the $XDG_CONFIG_HOME with %LOCALAPPDATA%.

@cmhughes
Copy link
Owner

Thanks, this looks interesting.

Or give users a way to change the default config location (e.g. through an environment variable)

Do you have anything specific in mind as to how this would work?

@cmhughes
Copy link
Owner

How does Perl know about the directory $XDG_CONFIG_DIR/? Please be encouraged to look at GetYamlSettings.pm which is the file that controls all of this: https://github.com/cmhughes/latexindent.pl/blob/main/LatexIndent/GetYamlSettings.pm, in particular

my $indentconfig = "$homeDir/indentconfig.yaml";

@nechtarg
Copy link
Contributor Author

Do you have anything specific in mind as to how this would work?

Considering other projects, I imagined something like an environment variable, named LATEXINDENT_CONFIG or so, which contains the path to the indentconfig.yaml file. This value would than be favored above the defaults. This makes it painless to change the config location to some arbitrary place, whilst also making implementation painless because one would just have to look at the LATEXINDENT_CONFIG environment variable.

How does Perl know about the directory $XDG_CONFIG_DIR/?

As far as I know environment variable are accessible under the %ENV register, so to get the value stored in XDG_CONFIG_HOME one would use $ENV{XDG_CONFIG_HOME}.

After looking into this, I could properly come up with a pull request.

@cmhughes
Copy link
Owner

cmhughes commented Dec 20, 2022 via email

@cmhughes cmhughes added the contribution Thank you to the contributor! label Dec 20, 2022
@cmhughes
Copy link
Owner

Implemented as of #397

(Please leave this open until released).

Thanks again!

@cmhughes cmhughes added the implemented implemented tag means that either an enhancement or feature request has been implemented, or bugfix label Dec 23, 2022
@cmhughes
Copy link
Owner

cmhughes commented Jan 1, 2023

This is part of V3.20 at https://github.com/cmhughes/latexindent.pl/releases/tag/V3.20. I've uploaded it to ctan.

Many thanks for your contribution! :)

@cmhughes cmhughes closed this as completed Jan 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution Thank you to the contributor! implemented implemented tag means that either an enhancement or feature request has been implemented, or bugfix
Projects
None yet
Development

No branches or pull requests

2 participants