Codebase list no-littering-el / 8887be0
Update upstream source from tag 'upstream/1.4.0' Update to upstream version '1.4.0' with Debian dir f3acb9efe246a39c6becfacd1f96b199bf48e4bf Lev Lamberov 10 months ago
5 changed file(s) with 583 addition(s) and 328 deletion(s). Raw diff Collapse all Expand all
44 ELS = $(PKG).el
55 ELCS = $(ELS:.el=.elc)
66
7 DEPS =
7 DEPS = compat
88
99 EMACS ?= emacs
1010 EMACS_ARGS ?=
2020 $(info make clean - remove generated files)
2121 @printf "\n"
2222
23 lisp: $(ELCS) loaddefs
23 lisp: $(ELCS) loaddefs check-declare
2424
2525 loaddefs: $(PKG)-autoloads.el
2626
2828 @printf "Compiling $<\n"
2929 @$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) -f batch-byte-compile $<
3030
31 check-declare:
32 @printf " Checking function declarations\n"
33 @$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) \
34 --eval "(check-declare-directory default-directory)"
35
3136 CLEAN = $(ELCS) $(PKG)-autoloads.el
3237
3338 clean:
34 @printf "Cleaning...\n"
39 @printf " Cleaning...\n"
3540 @rm -rf $(CLEAN)
3641
37 define LOADDEFS_TMPL
38 ;;; $(PKG)-autoloads.el --- automatically extracted autoloads
39 ;;
40 ;;; Code:
41 (add-to-list 'load-path (directory-file-name \
42 (or (file-name-directory #$$) (car load-path))))
43
44 ;; Local Variables:
45 ;; version-control: never
46 ;; no-byte-compile: t
47 ;; no-update-autoloads: t
48 ;; End:
49 ;;; $(PKG)-autoloads.el ends here
50 endef
51 export LOADDEFS_TMPL
52 #'
53
5442 $(PKG)-autoloads.el: $(ELS)
55 @printf "Generating $@\n"
56 @printf "%s" "$$LOADDEFS_TMPL" > $@
57 @$(EMACS) -Q --batch --eval "(progn\
58 (setq make-backup-files nil)\
59 (setq vc-handled-backends nil)\
60 (setq default-directory (file-truename default-directory))\
61 (setq generated-autoload-file (expand-file-name \"$@\"))\
62 (setq find-file-visit-truename t)\
63 (update-directory-autoloads default-directory))"
43 @printf " Creating $@\n"
44 @$(EMACS) -Q --batch -l autoload -l cl-lib --eval "\
45 (let ((file (expand-file-name \"$@\"))\
46 (autoload-timestamps nil) \
47 (backup-inhibited t)\
48 (version-control 'never)\
49 (coding-system-for-write 'utf-8-emacs-unix))\
50 (write-region (autoload-rubric file \"package\" nil) nil file nil 'silent)\
51 (cl-letf (((symbol-function 'progress-reporter-do-update) (lambda (&rest _)))\
52 ((symbol-function 'progress-reporter-done) (lambda (_))))\
53 (let ((generated-autoload-file file))\
54 (update-directory-autoloads default-directory))))" \
55 2>&1 | sed "/^Package autoload is deprecated$$/d"
+0
-202
README.md less more
0 Help keeping `~/.emacs.d` clean
1 ===============================
2
3 The default paths used to store configuration files and persistent
4 data are not consistent across Emacs packages. This isn't just a
5 problem with third-party packages but even with built-in packages.
6
7 Some packages put these files directly in `user-emacs-directory`
8 or `$HOME` or in a subdirectory of either of the two or elsewhere.
9 Furthermore sometimes file names are used that don't provide any
10 insight into what package might have created them.
11
12 This package sets out to fix this by changing the values of path
13 variables to put configuration files in `no-littering-etc-directory`
14 (defaulting to "etc/" under `user-emacs-directory`, thus usually
15 `"~/.emacs.d/etc/"`) and persistent data files in
16 `no-littering-var-directory` (defaulting to `"var/"` under
17 `user-emacs-directory`, thus usually `"~/.emacs.d/var/"`), and
18 by using descriptive file names and subdirectories when appropriate.
19 This is similar to a color-theme; a "path-theme" if you will.
20
21 We still have a long way to go until most built-in and many
22 third-party path variables are properly "themed". Like a color-theme,
23 this package depends on user contributions to accomplish decent
24 coverage. Pull requests are highly welcome (but please follow the
25 conventions described below and in the pull request template).
26
27 `no-littering` cannot help with moving existing files to the new
28 location. You will have to move the files manually. See issue
29 [#79](https://github.com/emacscollective/no-littering/issues/79)
30 for more information.
31
32 Usage
33 -----
34
35 Load the feature `no-littering` as early as possible in your init
36 file. Make sure you load it at least before you change any path
37 variables using some other method.
38
39 (require 'no-littering)
40
41 If you would like to use base directories different from what
42 `no-littering` uses by default, then you have to set the respective
43 variables before loading the feature.
44
45 (setq no-littering-etc-directory
46 (expand-file-name "config/" user-emacs-directory))
47 (setq no-littering-var-directory
48 (expand-file-name "data/" user-emacs-directory))
49 (require 'no-littering)
50
51 ### Suggested Settings
52
53 If you use `recentf` then you might find it convenient to exclude all
54 of the files in the `no-littering` directories using something like
55 the following.
56
57 (require 'recentf)
58 (add-to-list 'recentf-exclude no-littering-var-directory)
59 (add-to-list 'recentf-exclude no-littering-etc-directory)
60
61 #### Auto-save settings
62
63 One of the most common types of files that Emacs creates automatically
64 is auto-save files. By default, these appear in the current directory
65 of a visited file. No-littering does not change this, but you can add
66 the following code to your `init.el` file to store these files in the
67 `var` directory:
68
69 (setq auto-save-file-name-transforms
70 `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
71
72 #### Saved customizations
73
74 Emacs will save [customizations] into your `init.el` file by default.
75 If you don't want that, you might want to store them in a sibling file
76 or even in the `etc/` directory:
77
78 (setq custom-file (expand-file-name "custom.el" user-emacs-directory))
79 ;; or
80 (setq custom-file (no-littering-expand-etc-file-name "custom.el"))
81
82 #### Native compilation cache
83
84 The location of the native compilation cache has to be changed using a
85 function, preferably in `early-init.el`:
86
87 (when (fboundp 'startup-redirect-eln-cache)
88 (startup-redirect-eln-cache
89 (convert-standard-filename
90 (expand-file-name "var/eln-cache/" user-emacs-directory))))
91
92 Conventions
93 -----------
94
95 ### (A) File names
96
97 1. File names are based on the name of the respective Emacs lisp
98 variables and the name of the respective Emacs package.
99
100 2. The name of the respective Emacs package should serve as the
101 prefix of the file name, unless the file is in a subdirectory in
102 which case the name of the subdirectory serves as the prefix.
103
104 3. If the name of the package and the prefix of the variable do not
105 match, then we prefer the name of the package.
106
107 4. If the name of a path variable ends with `-file`, `-default-file`,
108 `-directory`, `-default-directory`, or something similar, then that
109 suffix is usually dropped from the file name.
110
111 5. If applicable, the appropriate extension is added to the file name
112 so that files are visited using the appropriate major-modes and
113 also to provide a hint about the kind of data stored in the file.
114 E.g. if a file contains an S-expression, then the suffix should be
115 `*.el`.
116
117 ### (B) File location and subdirectories
118
119 1. If a package has only one data file, then that is usually placed in
120 `no-littering-var-directory` itself. Likewise if a package has
121 only one config file, then that is placed in
122 `no-littering-etc-directory` itself.
123
124 2. If a package has multiple data (or config files), then those files
125 are placed in a subdirectory of `no-littering-var-directory` (or
126 `no-littering-etc-directory`).
127
128 3. If a subdirectory is used for a package's data (or config) file
129 variables, then the name of the directory should match the name of
130 the package in most cases. The subdirectory name may serve as the
131 package prefix of the file name.
132
133 4. If a package provides a "framework" for other packages to use,
134 then we may reuse its directories for other packages that make use
135 of that framework or otherwise "extend" the "main package".
136 E.g. we place all `helm` related files in `helm/`.
137
138 5. If a package only defines a single variable that specifies a data
139 (or config) directory, then the directory name should
140 nevertheless be just the package name. E.g. the path used for
141 `sx-cache-directory` from the `sx` package is `sx/cache/`, not
142 `sx-cache/`.
143
144 6. However if the name of the directory variable implies that the
145 package won't ever define any data (or config) files that won't be
146 placed in that directory, then we use a top-level directory. E.g.
147 when the name of the variable is `<package>-directory`, in which
148 case we would use just `<package>/` as the path.
149
150 ### (C) Ordering and alignment
151
152 1. The code that sets the values of themed variables is split into two
153 groups. The first group sets the value of variables that belong to
154 packages that are part of Emacs, and the second group is used for
155 variables that are defined by packages that are not part of Emacs.
156
157 2. Each of these lists is sorted alphabetically (usually by variable
158 name). Please keep it that way.
159
160 3. We attempt to align the value forms inside different `setq` forms.
161 If the symbol part for a particular variable is too long to allow
162 doing so, then don't worry about it and just break the alignment.
163 If it turns out that this happens very often, then we will adjust
164 the alignment eventually.
165
166 ### (D) Commit messages
167
168 1. Please theme each package using a separate commit and use commit
169 messages of the form `PACKAGE: theme VARIABLE`.
170
171 2. If a package has several path variables, then you should theme them
172 all in one commit.
173
174 3. If the variable names do not fit nicely on the summary line, then
175 use a message such as:
176
177 ```
178 foo: theme variables
179
180 Theme `foo-config-file', `foo-cache-directory',
181 and `foo-persistent-file'.
182 ```
183
184 4. When appropriate add statements like the following to the commit
185 message:
186
187 - This file is used to store an s-expression.
188 - This file is used to store raw text.
189 - This is the only configuration/data file of the package.
190 - This package does/doesn't take care of creating the containing
191 directory if necessary. (If the package does not do it, then you
192 should also fix that and submit an upstream pull request.)
193
194 5. If you are uncertain, then be explicit about it by adding a comment
195 to the pull-request.
196
197 [customizations]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Saving-Customizations.html
198
199 <!-- Local Variables: -->
200 <!-- fill-column: 70 -->
201 <!-- End: -->
0 * Help keeping ~/.config/emacs clean
1
2 The default paths used to store configuration files and persistent
3 data are not consistent across Emacs packages. This isn't just a
4 problem with third-party packages but even with built-in packages.
5
6 Some packages put these files directly in ~user-emacs-directory~
7 or ~$HOME~ or in a subdirectory of either of the two or elsewhere.
8 Furthermore sometimes file names are used that don't provide any
9 insight into what package might have created them.
10
11 This package sets out to fix this by changing the values of path
12 variables to put configuration files in ~no-littering-etc-directory~
13 (defaulting to "etc/" under ~user-emacs-directory~, thus usually
14 "$HOME/.config/emacs/etc/") and persistent data files in
15 ~no-littering-var-directory~ (defaulting to "var/" under
16 ~user-emacs-directory~, thus usually "$HOME/.config/emacs/var/"), and
17 by using descriptive file names and subdirectories when appropriate.
18 This is similar to a color-theme; a "path-theme" if you will.
19
20 We still have a long way to go until most built-in and many
21 third-party path variables are properly "themed". Like a color-theme,
22 this package depends on user contributions to accomplish decent
23 coverage. Pull requests are highly welcome (but please follow the
24 conventions described below and in the pull request template).
25
26 ~no-littering~ cannot help with moving existing files to the new
27 location. You will have to move the files manually. See issue
28 [[https://github.com/emacscollective/no-littering/issues/79][#79]] for more information.
29
30 ** Usage
31
32 Load the feature ~no-littering~ as early as possible in your init
33 file. Make sure you load it at least before you change any path
34 variables using some other method.
35
36 #+begin_src emacs-lisp
37 (require 'no-littering)
38 #+end_src
39
40 If you would like to use base directories different from what
41 ~no-littering~ uses by default, then you have to set the respective
42 variables before loading the feature.
43
44 #+begin_src emacs-lisp
45 (setq no-littering-etc-directory
46 (expand-file-name "config/" user-emacs-directory))
47 (setq no-littering-var-directory
48 (expand-file-name "data/" user-emacs-directory))
49 (require 'no-littering)
50 #+end_src
51
52 *** Suggested Settings
53 **** Auto-save, backup and undo-tree files
54
55 Creating backups increases the odds that secret information, which
56 would otherwise never be stored in clear text, is written to disk.
57 Likewise backups increase the odds that leaked secrets persist longer.
58
59 This topic is beyond the scope of this documentation, but as the
60 author of this package, I want to at least ensure that its use does
61 not make matters worse.
62
63 For that reason, simply loading ~no-littering~, does not theme the
64 built-in backup and auto-save functionality, and the third-party
65 ~undo-tree~ package.
66
67 A function ~no-littering-theme-backups~ is provided, which does theme
68 these features. Before calling that function from your init files,
69 you should read its docstring and implementation.
70
71 **** Recent files
72
73 If you use ~recentf~ then you might find it convenient to exclude all
74 of the files in the ~no-littering~ directories using something like
75 the following.
76
77 #+begin_src emacs-lisp
78 (require 'recentf)
79 (add-to-list 'recentf-exclude
80 (recentf-expand-file-name no-littering-var-directory))
81 (add-to-list 'recentf-exclude
82 (recentf-expand-file-name no-littering-etc-directory))
83 #+end_src
84
85 **** Saved customizations
86
87 Emacs will save [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Saving-Customizations.html][customizations]] into your ~init.el~ file by default.
88 If you don't want that, you might want to store them in a sibling file
89 or even in the ~etc/~ directory:
90
91 #+begin_src emacs-lisp
92 (setq custom-file (expand-file-name "custom.el" user-emacs-directory))
93 ;; or
94 (setq custom-file (no-littering-expand-etc-file-name "custom.el"))
95 #+end_src
96
97 **** Native compilation cache
98
99 When using Emacs 29, the location of the native compilation cache can
100 be changed using a function, preferably in ~early-init.el~:
101
102 #+begin_src emacs-lisp
103 (when (fboundp 'startup-redirect-eln-cache)
104 (startup-redirect-eln-cache
105 (convert-standard-filename
106 (expand-file-name "var/eln-cache/" user-emacs-directory))))
107 #+end_src
108
109 ** Conventions
110
111 *** (A) File names
112
113 1. File names are based on the name of the respective Emacs lisp
114 variables and the name of the respective Emacs package.
115
116 2. The name of the respective Emacs package should serve as the
117 prefix of the file name, unless the file is in a subdirectory in
118 which case the name of the subdirectory serves as the prefix.
119
120 3. If the name of the package and the prefix of the variable do not
121 match, then we prefer the name of the package.
122
123 4. If the name of a path variable ends with ~-file~, ~-default-file~,
124 ~-directory~, ~-default-directory~, or something similar, then that
125 suffix is usually dropped from the file name.
126
127 5. If applicable, the appropriate extension is added to the file name
128 so that files are visited using the appropriate major-modes and
129 also to provide a hint about the kind of data stored in the file.
130 E.g. if a file contains an S-expression, then the suffix should be
131 ~*.el~.
132
133 *** (B) File location and subdirectories
134
135 1. If a package has only one data file, then that is usually placed in
136 ~no-littering-var-directory~ itself. Likewise if a package has
137 only one config file, then that is placed in
138 ~no-littering-etc-directory~ itself.
139
140 2. If a package has multiple data (or config files), then those files
141 are placed in a subdirectory of ~no-littering-var-directory~ (or
142 ~no-littering-etc-directory~).
143
144 3. If a subdirectory is used for a package's data (or config) file
145 variables, then the name of the directory should match the name of
146 the package in most cases. The subdirectory name may serve as the
147 package prefix of the file name.
148
149 4. If a package provides a "framework" for other packages to use,
150 then we may reuse its directories for other packages that make use
151 of that framework or otherwise "extend" the "main package".
152 E.g. we place all ~helm~ related files in ~helm/~.
153
154 5. If a package only defines a single variable that specifies a data
155 (or config) directory, then the directory name should
156 nevertheless be just the package name. E.g. the path used for
157 ~sx-cache-directory~ from the ~sx~ package is ~sx/cache/~, not
158 ~sx-cache/~.
159
160 6. However if the name of the directory variable implies that the
161 package won't ever define any data (or config) files that won't be
162 placed in that directory, then we use a top-level directory. E.g.
163 when the name of the variable is ~<package>-directory~, in which
164 case we would use just ~<package>/~ as the path.
165
166 *** (C) Ordering and alignment
167
168 1. The code that sets the values of themed variables is split into two
169 groups. The first group sets the value of variables that belong to
170 packages that are part of Emacs, and the second group is used for
171 variables that are defined by packages that are not part of Emacs.
172
173 2. Each of these lists is sorted alphabetically (usually by variable
174 name). Please keep it that way.
175
176 3. We attempt to align the value forms inside different ~setq~ forms.
177 If the symbol part for a particular variable is too long to allow
178 doing so, then don't worry about it and just break the alignment.
179 If it turns out that this happens very often, then we will adjust
180 the alignment eventually.
181
182 *** (D) Commit messages
183
184 1. Please theme each package using a separate commit and use commit
185 messages of the form ~PACKAGE: theme VARIABLE~.
186
187 2. If a package has several path variables, then you should theme them
188 all in one commit.
189
190 3. If the variable names do not fit nicely on the summary line, then
191 use a message such as:
192
193 #+begin_src text
194 foo: theme variables
195
196 Theme `foo-config-file', `foo-cache-directory',
197 and `foo-persistent-file'.
198 #+end_src
199
200 4. When appropriate add statements like the following to the commit
201 message:
202
203 - This file is used to store an s-expression.
204 - This file is used to store raw text.
205 - This is the only configuration/data file of the package.
206 - This package does/doesn't take care of creating the containing
207 directory if necessary. (If the package does not do it, then you
208 should also fix that and submit an upstream pull request.)
209
210 5. If you are uncertain, then be explicit about it by adding a comment
211 to the pull-request.
212
213 # Local Variables:
214 # fill-column: 70
215 # End:
216
217 #+html: <br><br>
218 #+html: <a href="https://github.com/emacscollective/no-littering/actions/workflows/compile.yml"><img alt="Compile" src="https://github.com/emacscollective/no-littering/actions/workflows/compile.yml/badge.svg"/></a>
219 #+html: <a href="https://stable.melpa.org/#/no-littering"><img alt="MELPA Stable" src="https://stable.melpa.org/packages/no-littering-badge.svg"/></a>
220 #+html: <a href="https://melpa.org/#/no-littering"><img alt="MELPA" src="https://melpa.org/packages/no-littering-badge.svg"/></a>
0 #+TITLE: Migrating to use no-littering
1
2 * Introduction
3
4 This document describes migration towards using no-littering for path
5 theming.
6
7 * Steps
8 ** Prepare code
9
10 You must not install no-littering with a package manager because it
11 might automatically get loaded. Make sure installing it won't load
12 it. If you are not sure, clone the repository somewhere but do not
13 load or require the package. We need this to preserve the existing
14 values set to themed variables.
15
16 Before you start, tangle this file by running ~M-x org-babel-tangle~ and
17 load =no-littering-migration.el=, for example by opening dired and
18 hitting ~L~ on the file.
19
20 ** Save current values of your settings
21
22 First, we need to save the current values of the themed variables to
23 be able to move the files from their existing locations. Execute the
24 code below:
25
26 #+begin_src elisp
27 (setq no-littering-current-values
28 (no-littering-get-current-variables))
29 #+end_src
30
31 ** Load =no-littering= package
32
33 Now you can install the package with your package manager of choice.
34 After installation, run:
35
36 #+begin_src
37 (require 'no-littering)
38 #+end_src
39
40 ** Save new values
41
42 Now we save the new themed values set by no-littering.
43
44 #+begin_src elisp
45 (setq no-littering-new-values (no-littering-get-current-variables))
46 #+end_src
47
48 ** Generate migrations
49
50 We now have the old list and a new list and we can compare the
51 existing values to new values. The script below generates a migration
52 script which you have to review and execute manually.
53
54 #+begin_src elisp :wrap src elisp :results value
55 (no-littering-generate-migration no-littering-current-values
56 no-littering-new-values)
57 #+end_src
58
59 The result is a list of =progn= forms which can be evaluated by placing
60 the point at the end of the =progn= form and calling =M-x eval-last-sexp=
61 (sometimes bound to ~C-x C-e~).
62
63 The form looks like this:
64
65 #+begin_src elisp
66 (progn
67 "abbrev-file-name" ; name of the variable
68 (make-directory
69 ;; create a parent dir for target
70 "/home/matus/.config/emacs/etc/" t)
71 (rename-file
72 ;; old (current) file
73 "/home/matus/.config/emacs/abbrev_defs"
74 ;; new file
75 "/home/matus/.config/emacs/etc/abbrev.el"
76 1))
77 #+end_src
78
79 If you are satisfied, execute it and move to the next one.
80
81 Some of the forms might error out when the source file does not exist.
82 In that case there's nothing to do and you can move to the next one.
83
84 Occasionally, the code generate is not valid and you need to do the
85 migration manually. For now, the only value which wasn't readily
86 supported is =backup-directory-alist= which is not a string but an
87 alist.
88
89 ** Remove customized values
90
91 If you were using =customize-variable= before, you need to remove
92 customized settings or they will keep overwriting the values managed
93 by =no-littering=. Simply run the following to remove all
94 customizations.
95
96 *Make sure to backup your custom file before running this so you can
97 compare he results.*
98
99 #+begin_src elisp
100 (no-littering-custom-reset)
101 (custom-save-all)
102 #+end_src
103
104 Likewise, remove any other customization of the paths managed by
105 =no-littering=.
106
107 * Code
108 :PROPERTIES:
109 :ID: 5097feb0-d1e3-49b7-8129-276a40f8ec8a
110 :END:
111
112 #+begin_src elisp :tangle no-littering-migration.el
113 (defun no-littering-get-themed-variables ()
114 "Return all variables recognized by no-littering."
115 (with-temp-buffer
116 (insert-file-contents "no-littering.el")
117 (goto-char (point-min))
118 (re-search-forward "^(cl-letf")
119 (beginning-of-line)
120 (down-list)
121 (forward-sexp 4)
122 (let* ((data (cdr (read (current-buffer))))
123 (vars (cl-remove-if-not
124 (lambda (form) (eq (car form) 'setq)) data))
125 (current-values
126 (mapcar
127 (lambda (form)
128 (let* ((var (cadr form))
129 (value (and (boundp var)
130 (symbol-value var))))
131 (when (stringp value)
132 (setq value (file-truename value)))
133 (cons var value)))
134 vars)))
135 current-values)))
136
137 (defun no-littering-get-current-variables ()
138 "Return all variables recognized by no-littering currently used."
139 (cl-remove-if
140 (lambda (var) (not (cdr var)))
141 (no-littering-get-themed-variables)))
142
143 (defun no-littering-generate-migration (old-values new-values)
144 (let* ((migrations
145 (mapcar (lambda (var)
146 (list (car var)
147 (cdr var)
148 (cdr (assq (car var) new-values))))
149 old-values))
150 (commands
151 (mapcar (lambda (var)
152 (if (stringp (nth 2 var))
153 (when (not (equal (nth 1 var) (nth 2 var)))
154 `(progn
155 ,(format "%s" (car var))
156 (make-directory
157 ,(file-name-directory (nth 2 var))
158 t)
159 (rename-file ,(nth 1 var) ,(nth 2 var) 1)))
160 `(progn ,(car var) "Value is not a directory")))
161 migrations)))
162 commands))
163
164 (defun no-littering--custom-reset-symbol (symbol)
165 (put symbol 'variable-comment nil)
166 (put symbol 'standard-value nil)
167 (put symbol 'customized-value nil)
168 (put symbol 'customized-variable-comment nil)
169 (when (or (get symbol 'saved-value)
170 (get symbol 'saved-variable-comment))
171 (put symbol 'saved-value nil)
172 (put symbol 'saved-variable-comment nil)))
173
174 (defun no-littering-custom-reset ()
175 (dolist (var (no-littering-get-themed-variables))
176 (no-littering--custom-reset-symbol (car var))))
177 #+end_src
0 ;;; no-littering.el --- help keeping ~/.emacs.d clean -*- lexical-binding: t; -*-
1
2 ;; Copyright (C) 2016-2022 Jonas Bernoulli
0 ;;; no-littering.el --- Help keeping ~/.config/emacs clean -*- lexical-binding:t -*-
1
2 ;; Copyright (C) 2016-2023 Jonas Bernoulli
33
44 ;; Author: Jonas Bernoulli <jonas@bernoul.li>
55 ;; Homepage: https://github.com/emacscollective/no-littering
6 ;; Package-Requires: ((cl-lib "0.5"))
7
8 ;; This file is not part of GNU Emacs.
9
10 ;; This file is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 3, or (at your option)
13 ;; any later version.
14
6 ;; Keywords: convenience
7
8 ;; Package-Requires: ((emacs "25.1") (compat "29.1.4.1"))
9
10 ;; SPDX-License-Identifier: GPL-3.0-or-later
11
12 ;; This file is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published
14 ;; by the Free Software Foundation, either version 3 of the License,
15 ;; or (at your option) any later version.
16 ;;
1517 ;; This file is distributed in the hope that it will be useful,
1618 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
1719 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1820 ;; GNU General Public License for more details.
19
20 ;; For a full copy of the GNU General Public License
21 ;; see https://www.gnu.org/licenses.
21 ;;
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with this file. If not, see <https://www.gnu.org/licenses/>.
2224
2325 ;;; Commentary:
2426
25 ;; Help keeping ~/.emacs.d clean.
27 ;; Help keeping ~/.config/emacs clean.
2628
2729 ;; The default paths used to store configuration files and persistent
2830 ;; data are not consistent across Emacs packages. This isn't just a
3638 ;; This package sets out to fix this by changing the values of path
3739 ;; variables to put configuration files in `no-littering-etc-directory'
3840 ;; (defaulting to "etc/" under `user-emacs-directory', thus usually
39 ;; "~/.emacs.d/etc/") and persistent data files in
41 ;; "~/.config/emacs/etc/") and persistent data files in
4042 ;; `no-littering-var-directory' (defaulting to "var/" under
4143 ;; `user-emacs-directory', thus usually "~/.emacs.d/var/"), and
4244 ;; by using descriptive file names and subdirectories when appropriate.
175177 ;;; Code:
176178
177179 (require 'cl-lib)
180 (require 'compat)
178181
179182 (defvar no-littering-etc-directory
180183 (expand-file-name (convert-standard-filename "etc/") user-emacs-directory)
211214 (setq abbrev-file-name (etc "abbrev.el"))
212215 (setq auto-insert-directory (etc "auto-insert/"))
213216 (setq auto-save-list-file-prefix (var "auto-save/sessions/"))
214 (setq backup-directory-alist (list (cons "." (var "backup/"))))
215217 (setq bookmark-default-file (var "bookmark-default.el"))
216218 (setq calc-settings-file (etc "calc-settings.el"))
217 (eval-after-load 'desktop
218 `(make-directory ,(var "desktop/") t))
219219 (setq desktop-dirname (var "desktop/"))
220220 (setq desktop-path (list desktop-dirname))
221221 (setq diary-file (var "diary"))
222222 (setq ecomplete-database-file (var "ecomplete-database.el"))
223223 (setq ede-project-placeholder-cache-file (var "ede-projects.el"))
224 (eval-after-load 'erc
225 `(make-directory ,(var "erc/dcc/") t))
226224 (setq erc-dcc-get-default-directory (var "erc/dcc/"))
227225 (setq erc-log-channels-directory (var "erc/log-channels/"))
228 (eval-after-load 'eshell
229 `(make-directory ,(etc "eshell/") t))
230226 (setq eshell-aliases-file (etc "eshell/aliases"))
231227 (setq eshell-directory-name (var "eshell/"))
228 (setq eshell-login-script (etc "eshell/login"))
229 (setq eshell-rc-script (etc "eshell/rc"))
232230 (setq eudc-options-file (etc "eudc-options.el"))
233 (eval-after-load 'eww
234 `(make-directory ,(var "eww/") t))
235231 (setq eww-bookmarks-directory (var "eww/"))
236232 (setq filesets-menu-cache-file (var "filesets-menu-cache.el"))
237233 (setq gamegrid-user-score-file-directory (var "gamegrid-user-score/"))
238 (eval-after-load 'gnus
239 `(make-directory ,(var "gnus/dribble/") t))
240234 (setq gnus-dribble-directory (var "gnus/dribble/"))
241235 (setq gnus-init-file (etc "gnus/init.el"))
236 ;; Gnus hardcodes newsrc.eld to be based on gnus-startup-file.
237 (setq gnus-startup-file (etc "gnus/newsrc"))
242238 (setq ido-save-directory-list-file (var "ido-save-directory-list.el"))
243239 (setq image-dired-db-file (var "image-dired/db.el"))
244240 (setq image-dired-dir (var "image-dired/"))
247243 (setq image-dired-temp-rotate-image-file (var "image-dired/temp-rotate-image"))
248244 (setq kkc-init-file-name (var "kkc-init.el"))
249245 (setq multisession-directory (var "multisession/"))
250 (eval-after-load 'newsticker
251 `(make-directory ,(var "newsticker/") t))
252246 (setq newsticker-cache-filename (var "newsticker/cache.el"))
253247 (setq newsticker-dir (var "newsticker/data/"))
254248 (setq nsm-settings-file (var "nsm-settings.el"))
255 (eval-after-load 'org
256 `(make-directory ,(var "org/") t))
257249 (setq org-clock-persist-file (var "org/clock-persist.el"))
258250 (setq org-id-locations-file (var "org/id-locations.el"))
259251 (setq org-persist-directory (var "org/persist/"))
262254 (setq quickurl-url-file (var "quickurl-url.el"))
263255 (setq rcirc-log-directory (var "rcirc-log/"))
264256 (setq recentf-save-file (var "recentf-save.el"))
257 (setq remember-data-directory (var "remember/data.d/"))
265258 (setq remember-data-file (var "remember/data"))
266 (setq remember-data-directory (var "remember/data.d/"))
267259 (setq save-place-file (var "save-place.el"))
268260 (setq savehist-file (var "savehist.el"))
269 (setq srecode-map-save-file (var "srecode-map.el"))
270261 (setq semanticdb-default-save-directory (var "semantic/"))
271 (eval-after-load 'shadowfile
272 `(make-directory ,(var "shadow/") t))
273262 (setq shadow-info-file (var "shadow/info.el"))
274263 (setq shadow-todo-file (var "shadow/todo.el"))
275264 (setq shared-game-score-directory (var "shared-game-score/"))
265 (setq srecode-map-save-file (var "srecode-map.el"))
276266 (setq timeclock-file (var "timeclock"))
277267 (setq tramp-auto-save-directory (var "tramp/auto-save/"))
278268 (setq tramp-persistency-file-name (var "tramp/persistency.el"))
282272 (setq url-cookie-file (var "url/cookies.el"))
283273 (setq url-history-file (var "url/history.el"))
284274
275 (eval-after-load 'desktop '(make-directory desktop-dirname t))
276 (eval-after-load 'erc '(make-directory erc-dcc-get-default-directory t))
277 (eval-after-load 'eshell '(make-directory eshell-directory-name t))
278 (eval-after-load 'eww '(make-directory eww-bookmarks-directory t))
279 (eval-after-load 'gnus `(make-directory ,(etc "gnus/") t))
280 (eval-after-load 'gnus '(make-directory gnus-dribble-directory t))
281 (eval-after-load 'newsticker `(make-directory ,(var "newsticker/") t))
282 (eval-after-load 'org `(make-directory ,(var "org/") t))
283 (eval-after-load 'shadowfile `(make-directory ,(var "shadow/") t))
284
285285 ;;; Third-party packages
286286
287 (setq abm-file (var "autobookmarks.el"))
287288 (setq ac-comphist-file (var "ac-comphist.el"))
288289 (setq amx-save-file (var "amx-save.el"))
289290 (setq anaconda-mode-installation-directory (var "anaconda-mode/"))
290291 (setq annotate-file (var "annotations.el"))
291292 (setq async-byte-compile-log-file (var "async-bytecomp.log"))
292293 (setq auto-package-update-last-update-day-path (var "auto-package-update-last-update-day"))
293 (eval-after-load 'bbdb
294 `(make-directory ,(var "bbdb/") t))
295294 (setq bbdb-file (var "bbdb/bbdb.el"))
296295 (setq bbdb-vcard-directory (var "bbdb/vcard/"))
297296 (setq bm-repository-file (var "bm-repository.el"))
298 (eval-after-load 'bookmark+-1
299 `(make-directory ,(var "bmkp/") t))
300297 (setq bmkp-bmenu-commands-file (var "bmkp/bmenu-commands.el"))
301298 (setq bmkp-current-bookmark-file (var "bmkp/current-bookmark.el"))
302299 (setq bmkp-last-bookmark-file (var "bmkp/last-bookmark.el"))
303300 (setq bookiez-file (var "bookiez"))
304301 (setq cider-repl-history-file (var "cider-repl-history.el"))
302 (setq clm/logging-dir (var "command-log-mode/logging/"))
305303 (setq code-review-db-database-file (var "code-review/database.sqlite"))
306304 (setq code-review-download-dir (var "code-review/downloads/"))
307305 (setq code-review-log-file (var "code-review/log"))
308 (eval-after-load 'command-log-mode
309 `(make-directory ,(var "command-log-mode-logging/") t))
310 (setq clm/logging-dir (var "command-log-mode/logging/"))
311 (eval-after-load 'company
312 `(make-directory ,(var "company/") t))
313306 (setq company-statistics-file (var "company/statistics.el"))
314307 (setq company-tabnine-binaries-folder (var "company/tabnine-binaries"))
315308 (setq conventional-changelog-tmp-dir (var "conventional-changelog/"))
317310 (setq dap-java-test-runner (var "lsp-java/eclipse.jdt.ls/test-runner/junit-platform-console-standalone.jar"))
318311 (setq dap-utils-extension-path (var "dap/extensions/"))
319312 (setq debbugs-gnu-persistency-file (var "debbugs.el"))
313 (setq detached-db-directory (var "detached/db/"))
314 (setq detached-session-directory (var "detached/sessions/"))
320315 (setq devdocs-browser-cache-directory (var "devdocs/browser-cache/"))
321316 (setq devdocs-data-dir (var "devdocs/data/"))
322317 (setq dired-recent-directories-file (var "dired-recent-directories.el"))
323318 (setq dirvish-cache-dir (var "dirvish/cache"))
324319 (setq elbank-data-file (var "elbank-data.el"))
325 (setq elmo-msgdb-directory (var "elmo/"))
326 (setq elmo-split-log-file (var "elmo/split-log"))
327 (eval-after-load 'elfeed
328 `(make-directory ,(var "elfeed/") t))
320 (setq elfeed-autotag-files (list (etc "elfeed/autotags.org")))
329321 (setq elfeed-db-directory (var "elfeed/db/"))
330322 (setq elfeed-enclosure-default-dir (var "elfeed/enclosures/"))
331323 (setq elfeed-score-score-file (etc "elfeed/score/score.el"))
324 (setq elgrep-data-file (var "elgrep-data.el"))
325 (setq elmo-msgdb-directory (var "elmo/"))
326 (setq elmo-split-log-file (var "elmo/split-log"))
332327 (setq elpher-bookmarks-file (var "elpher-bookmarks.el"))
333 (eval-after-load 'x-win
334 (let ((session-dir (var "emacs-session/")))
335 `(progn
336 (make-directory ,session-dir t)
337 (defun emacs-session-filename (session-id)
338 "Construct a filename to save the session in based on SESSION-ID.
339 This function overrides the one on `x-win' to use `no-littering'
340 directories."
341 (expand-file-name session-id ,session-dir)))))
342328 (setq emms-directory (var "emms/"))
343 (eval-after-load 'emojify
344 `(make-directory ,(var "emojify/") t))
345329 (setq emojify-emojis-dir (var "emojify/"))
346330 (setq epkg-repository (var "epkgs/"))
347331 (setq equake-persistent-display-file (var "equake-persistent-display"))
332 (setq fontaine-latest-state-file (var "fontaine-latest-state.eld"))
348333 (setq forge-database-file (var "forge/database.sqlite"))
349334 (setq forge-post-directory (var "forge/posts/"))
350335 (setq geben-temporary-file-directory (var "geben/"))
351 (eval-after-load 'geiser
352 `(make-directory ,(var "geiser/") t))
353336 (setq geiser-repl-history-filename (var "geiser/repl-history"))
337 (setq gnus-notes-file (var "gnus-notes/articles.el"))
338 (setq gnus-notes-top-dir (var "gnus-notes/"))
339 (setq grammalecte-settings-file (etc "grammalecte-settings.el"))
354340 (setq hackernews-visited-links-file (var "hackernews/visited-links.el"))
355 (eval-after-load 'helm
356 `(make-directory ,(var "helm/") t))
341 (setq harpoon-cache-file (var "harpoon/"))
357342 (setq helm-adaptive-history-file (var "helm/adaptive-history.el"))
358343 (setq helm-backup-path (var "helm/backup/"))
359344 (setq helm-github-stars-cache-file (var "helm/github-stars-cache.el"))
363348 (setq irfc-directory (var "irfc/"))
364349 (setq irony-user-dir (var "irony/"))
365350 (setq jabber-avatar-cache-directory (var "jabber/avatar-cache"))
366 (eval-after-load 'jabber
367 `(make-directory ,(var "jabber/avatar-cache/") t))
368351 (setq jabber-history-dir (var "jabber/history"))
369 (eval-after-load 'jabber
370 `(make-directory ,(var "jabber/history/") t))
371352 (setq keyfreq-file (var "keyfreq.el"))
372353 (setq keyfreq-file-lock (var "keyfreq.lock"))
373354 (setq libbcel-oauth-store-filename (var "libbcel-oauth-store.el.gpg"))
374355 (setq litable-list-file (var "litable-list.el"))
375356 (setq logview-cache-filename (var "logview-cache"))
376357 (setq logview-views-file (etc "logview-views"))
377 (eval-after-load 'lookup
378 `(make-directory ,(etc "lookup/") t))
379358 (setq lookup-init-directory (etc "lookup/"))
380359 (setq lsp-clojure-workspace-dir (var "lsp-clojure/workspace/"))
381360 (setq lsp-eslint-library-choices-file (var "lsp/eslint-library-choices.el"))
361 (setq lsp-java-server-install-dir (var "lsp-java/eclipse.jdt.ls/server/"))
362 (setq lsp-java-workspace-dir (var "lsp-java/workspace/"))
363 (setq lsp-ltex-user-rules-path (var "lsp-ltex/"))
382364 (setq lsp-python-ms-dir (var "lsp-python-ms/"))
383 (eval-after-load 'lsp-mode
384 `(make-directory ,(var "lsp/") t))
385365 (setq lsp-server-install-dir (var "lsp/server/"))
386366 (setq lsp-session-file (var "lsp/session.el"))
387 (setq lsp-java-workspace-dir (var "lsp-java/workspace/"))
388 (setq lsp-java-server-install-dir (var "lsp-java/eclipse.jdt.ls/server/"))
367 (setq magithub-cache-file (var "magithub/cache.el"))
389368 (setq magithub-dir (var "magithub/"))
390 (setq magithub-cache-file (var "magithub/cache.el"))
391369 (setq mc/list-file (var "mc-list.el"))
392370 (setq meghanada-server-install-dir (var "meghanada/"))
393371 (setq multi-compile-history-file (var "multi-compile-history.el"))
394372 (setq nix-buffer-directory-name (var "nix-buffer/"))
373 (setq nomad-tramp-script-directory (var "nomad-tramp/"))
395374 ;; The value of this variable MUST NOT end with ".el" but the
396375 ;; actual file name MUST end with ".el". Use "git blame" for
397376 ;; more information.
398377 (setq notmuch-init-file (etc "notmuch-init"))
399378 (setq nov-save-place-file (var "nov-save-place.el"))
400379 (setq omnisharp-cache-directory (var "omnisharp/cache"))
401 (setq org-gcal-dir (var "org/gcal/"))
402 (eval-after-load 'org-caldav
403 `(make-directory ,(var "org/caldav/save") t))
404380 (setq org-caldav-backup-file (var "org/caldav/backup.org"))
405381 (setq org-caldav-save-directory (var "org/caldav/save"))
382 (setq org-gcal-dir (var "org/gcal/"))
406383 (setq org-journal-cache-file (var "org/journal-cache.el"))
407384 (setq org-recent-headings-save-file (var "org/recent-headings.el"))
408385 (setq org-registry-file (var "org/registry.el"))
414391 (setq persist--directory-location (var "persist/"))
415392 (setq persistent-scratch-save-file (var "persistent-scratch.el"))
416393 (setq persp-save-dir (var "persp-mode/"))
417 (eval-after-load 'projectile
418 `(make-directory ,(var "projectile/") t))
419394 (setq prescient-save-file (var "prescient-save.el"))
420395 (setq projectile-cache-file (var "projectile/cache.el"))
421396 (setq projectile-known-projects-file (var "projectile/known-projects.el"))
424399 (setq purpose-layout-dirs (list (etc "window-purpose/layouts/")))
425400 (setq pyim-dcache-directory (var "pyim/dcache/"))
426401 (setq quack-dir (var "quack/"))
402 (setq racket-repl-history-directory (var "racket-mode/repl-history/"))
403 (setq request-storage-directory (var "request/storage/"))
427404 (setq rfc-mode-directory (var "rfc-mode/"))
428 (setq request-storage-directory (var "request/storage/"))
429405 (setq rime-user-data-dir (var "rime/"))
430 (setq rmh-elfeed-org-files (list (var "elfeed/rmh-elfeed.org")))
406 (setq rmh-elfeed-org-files (list (etc "elfeed/rmh-elfeed.org")))
431407 (setq runner-init-file (var "runner-init.el"))
432408 (setq save-kill-file-name (var "save-kill.el"))
433409 (setq save-visited-files-location (var "save-visited-files-location"))
434 (eval-after-load 'sly
435 `(make-directory ,(var "sly/") t))
410 (setq session-save-file (var "session.el"))
436411 (setq sly-mrepl-history-file-name (var "sly/mrepl-history"))
437412 (setq smex-save-file (var "smex-save.el"))
438413 (setq speed-type-gb-dir (var "speed-type/"))
439 (eval-after-load 'sx
440 `(make-directory ,(var "sx/cache/") t))
414 (setq spell-fu-directory (var "spell-fu/"))
415 (setq svg-lib-icons-dir (var "svg-lib/icons/"))
441416 (setq sx-cache-directory (var "sx/cache/"))
442417 (setq tldr-directory-path (var "tldr/"))
443418 (setq transient-history-file (var "transient/history.el"))
444419 (setq transient-levels-file (etc "transient/levels.el"))
445420 (setq transient-values-file (etc "transient/values.el"))
421 (setq treemacs-last-error-persist-file (var "treemacs/persist-last-error.org"))
446422 (setq treemacs-persist-file (var "treemacs/persist.org"))
447 (setq treemacs-last-error-persist-file (var "treemacs/persist-last-error.org"))
448423 (setq undo-fu-session-directory (var "undo-fu-session/"))
449424 (setq undohist-directory (var "undohist/"))
450 (setq undo-tree-history-directory-alist (list (cons "." (var "undo-tree-hist/"))))
425 (setq uptimes-database (var "uptimes.el"))
451426 (setq user-emacs-ensime-directory (var "ensime/"))
452427 (setq vimish-fold-dir (var "vimish-fold/"))
453 (eval-after-load 'wl
454 `(make-directory ,(etc "wanderlust") t))
455 (setq wl-init-file (etc "wanderlust/init.el"))
456 (setq wl-folders-file (etc "wanderlust/folders"))
457428 (setq wl-address-file (etc "wanderlust/address"))
458429 (setq wl-alias-file (etc "wanderlust/alias"))
430 (setq wl-folders-file (etc "wanderlust/folders"))
431 (setq wl-init-file (etc "wanderlust/init.el"))
432 (setq wl-temporary-file-directory (var "wanderlust-tmp"))
459433 (setq wl-x-face-file (etc "wanderlust/x-face"))
460 (setq wl-temporary-file-directory (var "wanderlust-tmp"))
461434 (setq x86-lookup-cache-directory (var "x86-lookup/cache/"))
462 (eval-after-load 'xkcd
463 `(make-directory ,(var "xkcd/") t))
464435 (setq xkcd-cache-dir (var "xkcd/"))
465 (eval-after-load 'yasnippet
466 `(make-directory ,(etc "yasnippet/snippets/") t))
467436 (setq yas-snippet-dirs (list (etc "yasnippet/snippets/")))
437
438 (eval-after-load 'bbdb `(make-directory ,(var "bbdb/") t))
439 (eval-after-load 'bookmark+-1 `(make-directory ,(var "bmkp/") t))
440 (eval-after-load 'command-log-mode '(make-directory clm/logging-dir t))
441 (eval-after-load 'company `(make-directory ,(var "company/") t))
442 (eval-after-load 'elfeed `(make-directory ,(var "elfeed/") t))
443 (eval-after-load 'emojify '(make-directory emojify-emojis-dir t))
444 (eval-after-load 'geiser `(make-directory ,(var "geiser/") t))
445 (eval-after-load 'helm `(make-directory ,(var "helm/") t))
446 (eval-after-load 'jabber '(make-directory jabber-avatar-cache-directory t))
447 (eval-after-load 'jabber '(make-directory jabber-history-dir t))
448 (eval-after-load 'lookup '(make-directory lookup-init-directory t))
449 (eval-after-load 'lsp-mode `(make-directory ,(var "lsp/") t))
450 (eval-after-load 'org-caldav '(make-directory org-caldav-save-directory t))
451 (eval-after-load 'projectile `(make-directory ,(var "projectile/") t))
452 (eval-after-load 'sly `(make-directory ,(var "sly/") t))
453 (eval-after-load 'sx '(make-directory sx-cache-directory t))
454 (eval-after-load 'wl `(make-directory ,(etc "wanderlust") t))
455 (eval-after-load 'xkcd '(make-directory xkcd-cache-dir t))
456 (eval-after-load 'yasnippet '(make-directory (car yas-snippet-dirs) t))
468457 ))
458
459 ;;; Advices
460
461 (defun no-littering-emacs-session-filename (session-id)
462 "Construct a filename to save the session in, based on SESSION-ID.
463 Unconditionally return a filename in `no-littering-var-directory'."
464 (let ((dir (no-littering-expand-var-file-name "emacs-session/")))
465 (make-directory dir t)
466 (expand-file-name session-id dir)))
467
468 (advice-add 'emacs-session-filename :override
469 #'no-littering-emacs-session-filename)
470
471 ;;; Backups
472
473 (defvar undo-tree-history-directory-alist)
474
475 (defun no-littering-theme-backups ()
476 "Theme locations where backups of various sorts are created.
477
478 The purpose of this package is to store data files of various
479 sorts in a handful of central locations, instead of spreading
480 them all over the place. When doing that for temporary files,
481 which contain backups of some sort, that increases the odds that
482 sensitive data is written to disk in clear text and/or that such
483 clear text files persist longer, if they would be created anyway.
484
485 Because of that, simply loading `no-littering' does not theme
486 certain, potentially unsafe variables. Instead, this function is
487 provided, so that you can decide whether to take the risk or not.
488
489 Calling this function sets these variables:
490 - `auto-save-file-name-transforms' (built-in)
491 - `backup-directory-alist' (built-in)
492 - `undo-tree-history-directory-alist' (from `undo-tree')
493
494 The default values of these variables cause additional files to
495 be created in the same directories as the files that are being
496 visited. Calling this function changes the values of these
497 variables, so that this is only done for visited files located in
498 certain directories. For all other visited files, the additional
499 files are created in files inside `no-littering-var-directory'.
500
501 Additional files are created in the same directory as the visited
502 file, for files located in:
503 - \"/tmp/\"
504 - \"/dev/shm\"
505 - `temporary-file-directory'
506
507 With these settings it is still possible that sensitive data is
508 written to additional files, but you are more likely to spot it,
509 and because these directories usually use a `tmpfs' file-system,
510 the leaked secrets should not persist after a reboot.
511
512 If you do *not* call this function, then these additional files
513 are always created in the same directory as the visited files,
514 regardless of the location of the visited files. In other words,
515 even when using the default values, there is a significant risk
516 of leaking sensitive data, and if you want to reduce that, then
517 you must turn of these features completely."
518 (setq auto-save-file-name-transforms
519 `(("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'"
520 ,(concat (file-name-as-directory temporary-file-directory) "\\2") t)
521 ("\\`/tmp\\([^/]*/\\)*\\(.*\\)\\'" "\\2")
522 ("\\`/dev/shm\\([^/]*/\\)*\\(.*\\)\\'" "\\2")
523 (".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
524 (setq backup-directory-alist
525 `((,(concat "\\`" (file-name-as-directory temporary-file-directory)))
526 ("\\`/tmp/" . nil)
527 ("\\`/dev/shm/" . nil)
528 ("." . ,(no-littering-expand-var-file-name "backup/"))))
529 (setq undo-tree-history-directory-alist
530 `((,(concat "\\`" (file-name-as-directory temporary-file-directory)))
531 ("\\`/tmp/" . nil)
532 ("\\`/dev/shm/" . nil)
533 ("." . ,(no-littering-expand-var-file-name "undo-tree-hist/"))))
534 )
469535
470536 ;;; _
471537 (provide 'no-littering)