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

Update ~/.slime to use $XDG_DATA_HOME #787

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ron-at-swgy
Copy link

This commit updates the ~/.slime references in Makefile and swank-loader.lisp to check for XDG_DATA_HOME. If the environment variable is set, it uses $XDG_DATA_HOME/slime as the default fasl directory.

This change is necessary as there is no way to avoid creation of "~/.slime" when loading a system that requires Swank. My personal example is trying to port a Clack application to OpenBSD. The OpenBSD build system does not allow writing to home directories as part of the build process.

Prior to these changes, I tried using asdf:defsystem-depends-on, asdf:around-compile, and use of a secondary system to only load swank.

This commit updates the `~/.slime` references in `Makefile` and
`swank-loader.lisp` to check for XDG_DATA_HOME. If the environment
variable is set, it uses $XDG_DATA_HOME/slime as the default fasl
directory.

This change is necessary as there is no way to avoid creation of
"~/.slime" when loading a system that requires Swank. My personal
example is trying to port a Clack application to OpenBSD. The OpenBSD
build system does not allow writing to home directories as part
of the build process.

Prior to these changes, I tried using asdf:defsystem-depends-on,
asdf:around-compile, and use of a secondary system to only load
swank.
@ron-at-swgy
Copy link
Author

ron-at-swgy commented Aug 4, 2023

Relates to #610

Ron Dahlgren added 2 commits August 5, 2023 22:58
If the XDG_DATA_HOME environment variable is unset, it is still
returned as truthy from `uiop:getenv`. This commit explicitly checks
that the entry returned has more than zero characters. Function now
operates as intended.
@stassats
Copy link
Member

stassats commented Aug 6, 2023

Can it be made optional?

@ron-at-swgy
Copy link
Author

Using the environment variable alone seems to be the least intrusive means to change the behavior.

How would you like it to be made optional? There is no way to pass command-line arguments or any other switches during (for instance) a quickload installation of swank. A separate environment variable could be used, or a sentinel file, but these methods all seem to add more cludge that necessary.

Please advise

@ron-at-swgy
Copy link
Author

The use of XDG_DATA_HOME comes from the Free Desktop specification.

@stassats
Copy link
Member

stassats commented Aug 6, 2023

I don't have XDG_DATA_HOME or Free Desktop on macOS, so having different locations on the two systems I use at the same time is going to be inconvenient.

@ron-at-swgy
Copy link
Author

I don't have XDG_DATA_HOME on OpenBSD either (it would depend on the window manager choice). My motivation for the change is to have control over the location of the slime directory during installation. Would using a "SLIME_DATA_DIRECTORY" environment variable do the trick? That would mean the current behavior only changes if someone chooses to change it. One could then set SLIME_DATA_DIRECTORY=XDG_DATA_HOME if that's the behavior they want.

Different environment variable?

This commit changes the environment variable that is read from
XDG_DATA_HOME to SLIME_HOME_DIR. If this variable is set, and
non-empty, then it will be used rather than `~/.slime`.
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.

None yet

2 participants