-
Notifications
You must be signed in to change notification settings - Fork 117
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
Set location of state files to rational-config-var-directory
#158
Conversation
rational-config-var-directory
rational-config-var-directory
rational-config-var-directory
rational-config-var-directory
Nice! Thanks for the PR. Some thoughts:
|
@telenieko Need any help with this? I'd love to get this merged! |
Slipped my mind 😅 will give a though about how to document this. I am thinking some explaining regarding I'd probably also split I'll draft something up during the week and push! |
Started working on this in #166, now on this PR I will:
And go into more detail on how |
Looks like your changes to |
@telenieko Anything I can help with? |
Hi !
I think manipulating spacetime so more hours fit in a day is not yet within Emacs powers! 🤣
I was separating the general explanation from the I have just pushed some new code that fixes the documentation part, also makes the behavior optional (which is probably a good thing). Last but not least, a long comment is now on Let me know what you think of the new code |
Code looks good. I wonder if it might fit better in the |
That would be the right approach but I think that would require:
I don't think either item has been discussed before? if not I'll try to give it some thought and open an issue to discuss it |
Hi @telenieko, ;; On Windows the xdg directories don't exists
(unless ON-WINDOWS
(defvar rational-use-xdg-folders nil
"Prefer XDG folders over rational-config-*-directory"))
(defvar rational-config-etc-directory (expand-file-name "etc/" rational-config-path)
"The user's configuration etc/ folder.")
(defvar rational-config-var-directory (expand-file-name "var/" rational-config-path)
"The user's configuration var/ folder.") And then we can simply resign the (when rational-use-xdg-folders
(defvar xdg-data-home-directory
(if (getenv "XDG_DATA_HOME")
(getenv "XDG_DATA_HOME")
(expand-file-name ".local/share/" (getenv "HOME"))))
(defvar xdg-cache-home-directory
(if (getenv "XDG_DATA_HOME")
(getenv "XDG_DATA_HOME")
(expand-file-name ".cache/" (getenv "HOME")))))
(unless rational-use-xdg-folders
(defvar rational-config-etc-directory (expand-file-name "etc/" rational-config-path)
"The user's configuration etc/ folder.")
(defvar rational-config-var-directory (expand-file-name "var/" rational-config-path)
"The user's configuration var/ folder."))
(when rational-use-xdg-folders
(defvar rational-config-etc-directory (expand-file-name "emacs/" xdg-cache-home-directory)
"The user's configuration etc/ folder.")
(defvar rational-config-var-directory (expand-file-name "emacs/" xdg-data-home-directory)
"The user's configuration var/ folder.")) |
Hi,
I left out XDG compliance out of this PR on purpose (more in a moment) mainly to keep it focused and with minimal disruptions. My idea here has been to do the 1st step in that direction: have a place to "collect" all the variable names that need to be altered to move runtime & config data "to the right place". In reality, that is all this PR is doing: But this is step 1. Also, here I only touched Moving forward there are several other things to do:
This is needed because several of the paths being changed should be changed very early on (see comment in the code above the
This step would be achieved mainly by setting Both steps require some good thiking. Step 2 more so it needs to care about other supported platforms. So, merging this PR enabled us to keep expanding the list of files "under control" by adding more and more entries like: (with-eval-after-load 'project
(rational-defaults--sensible-path rational-config-[var|etc]-directory
'project-list-file
"projects")) While this advances, and more and more files are controlled we can open new PR about the other two issues. Otherwise this PR risks getting to broad in scope and take longer and longer to merge. Let see if we can get this 1st step in and start thinking and working on the other two! PS: I also believe step 2 (best practices compliance) should probably be an independent emacs package so the whole ecosystem can benefit of it. But this could always be done later. |
Rational to crafted rename is complete, would like to get this merged when its ready. You mention a few things requiring deeper thinking above, are those show stoppers for you? |
This aims to setup initial infrastructure to keep state files inside `crafter-config-var-directory`. - A setting is created to enable/disable the behaviour (enabled by default) - A helper function is introduced to ease adding new state files - This is all documented Unrelated to the above is: We add `CUSTOM_ID` to a documentation entry to enable creating an internal link. This is because according to [orgmode documentation](https://orgmode.org/manual/Internal-Links.html) local links by ID work only when `CUSTOM_ID` is set. > (...) a construct like ‘[[#my-custom-id]]’ specifically targets the entry with the ‘CUSTOM_ID’ property set to ‘my-custom-id’. Attempting to export `README.org` without this results in an error.
Hi,
Just pushed again, handled the renames; rebased & squashed the PR. Ready to merge The other few things mentioned in the PR are things to consider for the future. See:
@jeffbowman I could not test the changes now after the rename as I'm currently refactoring most of my Emacs config. Please check that it loads! (Though the code looks fine) |
Rational introduces the variable
rational-config-var-directory
which, apparently, aims to have Emacs save state files there.This currently works for
recentf
andhistory
, but there are a lot more files that are currently been kept insideemacs-user-dir
.Then,
bookmarks
file which shall never be commited #137, when contributing to this project as your git tree will be dirty.emacs-user-dir
others are onrational-config-var-directory
.If the idea is to have state files in one place, there should be some way to do so.
This is a proposal:
with-eval-after-load
so the "new default" is only set if the package is loaded.customize-set-variable
as early as possible to not override any user preferences.gitignore
as they should no longer be on the tree.I am placing all in
rational-defaults
as it looks right the right place:rational-org
for theorg-id-locations
would not work if the user is not loading that module (but still expects state files to be in the right place.BACKWARDS INCOMPATIBLE CHANGE: This PR makes no effort to move existing state files. Not sure if it should be attempted at all?
Keeping Draft status as I intend to rebase into a single commit after review.