* Re: Cleaning up and structuring user-emacs-directory
2020-08-19 5:03 ` Amin Bandali
@ 2020-08-19 8:28 ` tomas
2020-08-19 13:59 ` Amin Bandali
2020-08-19 14:42 ` David De La Harpe Golden
2020-08-19 13:33 ` Stefan Monnier
` (2 subsequent siblings)
3 siblings, 2 replies; 34+ messages in thread
From: tomas @ 2020-08-19 8:28 UTC (permalink / raw)
To: emacs-devel; +Cc: Gunnar Horrigmo, Richard Stallman
[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]
On Wed, Aug 19, 2020 at 01:03:51AM -0400, Amin Bandali wrote:
> Richard Stallman writes:
>
> > [[[ To any NSA and FBI agents reading my email: please consider ]]]
> > [[[ whether defending the US Constitution against all enemies, ]]]
> > [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> >
> > > Would it not be better to follow the freedesktop spec?
> > > https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.6.html
> >
> > Concretely, what change would that mean in Emacs?
>
> In short, the approach that I proposed divides up `user-emacs-directory'
> into multiple subdirectories and keeps `user-emacs-directory' as the
> all-in-one source of a user's Emacs files, while the XDG Base Directory
> approach as suggested by Gunnar would imply keeping only configuration
> files in `user-emacs-directory', and moving data and cache files to
> "$XDG_DATA_HOME/emacs/" and "$XDG_CACHE_HOME/emacs/" respectively, where
> 'XDG_DATA_HOME' defaults to "~/.local/share" and 'XDG_CACHE_HOME' to
> "~/.cache".
I've now read the freedesktop thing. If you ask me: please make that
optional. I have none of those $XDG_* env vars set, and I have nothing
of relevance in .local.
Cheers
- t
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-19 8:28 ` tomas
@ 2020-08-19 13:59 ` Amin Bandali
2020-08-19 14:18 ` tomas
2020-08-19 14:42 ` David De La Harpe Golden
1 sibling, 1 reply; 34+ messages in thread
From: Amin Bandali @ 2020-08-19 13:59 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 2157 bytes --]
tomas@tuxteam.de writes:
> On Wed, Aug 19, 2020 at 01:03:51AM -0400, Amin Bandali wrote:
>> Richard Stallman writes:
>>
>> > [[[ To any NSA and FBI agents reading my email: please consider ]]]
>> > [[[ whether defending the US Constitution against all enemies, ]]]
>> > [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>> >
>> > > Would it not be better to follow the freedesktop spec?
>> > > https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.6.html
>> >
>> > Concretely, what change would that mean in Emacs?
>>
>> In short, the approach that I proposed divides up `user-emacs-directory'
>> into multiple subdirectories and keeps `user-emacs-directory' as the
>> all-in-one source of a user's Emacs files, while the XDG Base Directory
>> approach as suggested by Gunnar would imply keeping only configuration
>> files in `user-emacs-directory', and moving data and cache files to
>> "$XDG_DATA_HOME/emacs/" and "$XDG_CACHE_HOME/emacs/" respectively, where
>> 'XDG_DATA_HOME' defaults to "~/.local/share" and 'XDG_CACHE_HOME' to
>> "~/.cache".
>
> I've now read the freedesktop thing. If you ask me: please make that
> optional. I have none of those $XDG_* env vars set, and I have nothing
> of relevance in .local.
>
> Cheers
> - t
Reading this, another con of the XDG Base Directory approach just
occurred to me:
As of now, the XDG support added in Emacs 27 for the location of
`user-emacs-directory' is completely optional: if "~/.emacs.d/" exists,
"$XDG_CONFIG_HOME/emacs/" won't be used at all. And some people seem to
quite dislike the XDG approach. So, basing this change upon that, users
who choose not to use "$XDG_CONFIG_HOME/emacs/" will inevitably be opted
out of this cleaning up of their Emacs directory. I'd personally like
to have my `user-emacs-directory' be clean, even if I choose to use
"~/.emacs.d/" and not "$XDG_CONFIG_HOME/emacs/". So, another reason for
me to prefer my original proposal of diving `user-emacs-directory' up
into subdirectories, regardless of whether or not the user uses
"$XDG_CONFIG_HOME/emacs/".
Thoughts?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-19 13:59 ` Amin Bandali
@ 2020-08-19 14:18 ` tomas
2020-08-19 14:47 ` noah swainland
0 siblings, 1 reply; 34+ messages in thread
From: tomas @ 2020-08-19 14:18 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]
On Wed, Aug 19, 2020 at 09:59:41AM -0400, Amin Bandali wrote:
[...]
> Reading this, another con of the XDG Base Directory approach just
> occurred to me:
>
> As of now, the XDG support added in Emacs 27 for the location of
> `user-emacs-directory' is completely optional: if "~/.emacs.d/" exists,
> "$XDG_CONFIG_HOME/emacs/" won't be used at all. And some people seem to
> quite dislike the XDG approach. So, basing this change upon that, users
> who choose not to use "$XDG_CONFIG_HOME/emacs/" will inevitably be opted
> out of this cleaning up of their Emacs directory. I'd personally like
> to have my `user-emacs-directory' be clean, even if I choose to use
> "~/.emacs.d/" and not "$XDG_CONFIG_HOME/emacs/". So, another reason for
> me to prefer my original proposal of diving `user-emacs-directory' up
> into subdirectories, regardless of whether or not the user uses
> "$XDG_CONFIG_HOME/emacs/".
>
> Thoughts?
That would work for me. I actually structure my ~/.emacs.d anyway, and
could live well with another structuring.
Cheers
- t
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-19 14:18 ` tomas
@ 2020-08-19 14:47 ` noah swainland
0 siblings, 0 replies; 34+ messages in thread
From: noah swainland @ 2020-08-19 14:47 UTC (permalink / raw)
To: tomas; +Cc: emacs-devel
Seeing as there are already behavioural checks depending on whether
"~/.emacs.d"" exists or not, could not these proposed
`user-emacs-directory' subdirectory definitions change depending on
whether or not "~/.emacs.d" exists? I'm not sure what exactly you're
proposing each one to be, but they'd probably match up at least partly
to the XDG directories.
I personally like "$XDG_CONFIG_HOME/emacs", it makes it easier for me to
copy a single folder of configurations between computers.
--
noah ~ distinctly.pink
never stop stopping to smile at the flowers
-- Email domain proudly hosted at https://migadu.com
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-19 8:28 ` tomas
2020-08-19 13:59 ` Amin Bandali
@ 2020-08-19 14:42 ` David De La Harpe Golden
2020-08-19 16:14 ` tomas
1 sibling, 1 reply; 34+ messages in thread
From: David De La Harpe Golden @ 2020-08-19 14:42 UTC (permalink / raw)
To: Emacs developers
On 19/08/2020 09:28, tomas@tuxteam.de wrote:
> I've now read the freedesktop thing. If you ask me: please make that
> optional.
indeed, existing emacs fd.o support in various contexts is generally
optional.
> I have none of those $XDG_* env vars set, and I have nothing
> of relevance in .local.
>
They're overrides not mandatory, the normal circumstance for an app that
follows the spec is falling back to the standard paths. When emacs uses
them, which it may already do in various circumstances, you can see it
does that:
https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/xdg.el#n52
At startup, emacs apparently already uses ~/.config/emacs/ if present
and .emacs and ~/.emacs.d aren't:
https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/startup.el#n494
However, at time of writing a user using the existing emacs xdg
~/.config/emacs/ dir support will AFAICS actually find various arguably
"data" and "cache" files also plonked into the "config" directory
~/.config/emacs/ dir by emacs, as it's basically treated as an
alternatively spelled ~/.emacs.d/
That may be consided at least vaguely suspect under the xdg spec
conventions, user config, cache and data files are supposed to have
those split locations. To concretize, testing with emacs 27.1
(personally I actually still use ~/.emacs and ~/.emacs.d/ normally!):
# keep for restoration!
$ mkdir -p .config/emacs/
$ cp .emacs .config/emacs/init.el
$ mv .emacs .emacs.off
$ mv .emacs.d .emacs.d.off
Run emacs
$ emacs
# intra-emacs do something arguably "cache" and "data" like getting the
# latest elpa package list and installing a package
M-x list-packages
<install something, trie for argument's sake>
C-x C-c
# let's look inside:
ls ~/.config/emacs/
$ ls -1 ~/.config/emacs/
auto-save-list
elpa
init.el
$ ls -1 ~/.config/emacs/elpa/
archives
gnupg
heap-0.5
heap-0.5.signed
queue-0.2
queue-0.2.signed
tNFA-0.1.1
tNFA-0.1.1.signed
trie-0.4
trie-0.4.signed
# -> user ends up with emacs init.el in config (fine), but also
# elpa package lists stored in xdg config subdir not cache
# elpa packages installed in xdg config subdir not data
This contrasts to e.g. python's "pip install --user", as that will
install python packages ~/.local/lib/python3 etc. as "data", and keep
its various transient metadata things in ~/.cache/pip/ as "cache"
> Cheers
> - t
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-19 14:42 ` David De La Harpe Golden
@ 2020-08-19 16:14 ` tomas
2020-08-19 16:47 ` Yuan Fu
0 siblings, 1 reply; 34+ messages in thread
From: tomas @ 2020-08-19 16:14 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 899 bytes --]
On Wed, Aug 19, 2020 at 03:42:25PM +0100, David De La Harpe Golden wrote:
> On 19/08/2020 09:28, tomas@tuxteam.de wrote:
>
> >I've now read the freedesktop thing. If you ask me: please make that
> >optional.
>
> indeed, existing emacs fd.o support in various contexts is generally
> optional.
Thanks
> However, at time of writing a user using the existing emacs xdg
> ~/.config/emacs/ dir support will AFAICS actually find various
> arguably "data" and "cache" files also plonked into the "config"
> directory ~/.config/emacs/ dir by emacs, as it's basically treated
> as an alternatively spelled ~/.emacs.d/
>
> That may be consided at least vaguely suspect [...]
Absolutely agreed. From my POV, I think even Emacs oldtimers
wouldn't object to see data and cache in separate locations
(possibly all under ~/.emacs.d). But let other oldtimers chime
in.
Cheers
- t
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-19 16:14 ` tomas
@ 2020-08-19 16:47 ` Yuan Fu
2020-08-19 17:33 ` Stefan Monnier
0 siblings, 1 reply; 34+ messages in thread
From: Yuan Fu @ 2020-08-19 16:47 UTC (permalink / raw)
To: tomas; +Cc: emacs-devel
I think one concern could be that if we change the cache directory, users would need to manually move their cache files, or lost their data. That doesn’t has to be the case, we can make this new feature opt-in:
(defvar user-cache-directory nil)
(defun expand-cache-name (name)
(if user-cache-directory
(expand-file-name name user-cache-directory)
(expand-file-name user-emacs-directory)))
Then,
(defvar xxx-file (expand-file-name "xxx-file" user-emacs-directory))
Would become
(defvar xxx-file (expand-cache-name "xxx-file”))
This way, existing cache files in .Emacs.d are still valid, and people who want a clean .Emacs.d can define user-cache-directory to what ever they want.
Yuan
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-19 16:47 ` Yuan Fu
@ 2020-08-19 17:33 ` Stefan Monnier
2020-08-19 18:39 ` Eli Zaretskii
0 siblings, 1 reply; 34+ messages in thread
From: Stefan Monnier @ 2020-08-19 17:33 UTC (permalink / raw)
To: Yuan Fu; +Cc: tomas, emacs-devel
> (if user-cache-directory
> (expand-file-name name user-cache-directory)
> (expand-file-name user-emacs-directory)))
AKA (expand-file-name name (or user-cache-directory user-emacs-directory))
Stefan
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-19 17:33 ` Stefan Monnier
@ 2020-08-19 18:39 ` Eli Zaretskii
2020-08-20 3:55 ` Stefan Monnier
0 siblings, 1 reply; 34+ messages in thread
From: Eli Zaretskii @ 2020-08-19 18:39 UTC (permalink / raw)
To: Stefan Monnier; +Cc: casouri, tomas, emacs-devel
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Wed, 19 Aug 2020 13:33:18 -0400
> Cc: tomas@tuxteam.de, emacs-devel@gnu.org
>
> > (if user-cache-directory
> > (expand-file-name name user-cache-directory)
> > (expand-file-name user-emacs-directory)))
>
> AKA (expand-file-name name (or user-cache-directory user-emacs-directory))
Are you sure?
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-19 18:39 ` Eli Zaretskii
@ 2020-08-20 3:55 ` Stefan Monnier
2020-08-20 7:08 ` Andreas Schwab
0 siblings, 1 reply; 34+ messages in thread
From: Stefan Monnier @ 2020-08-20 3:55 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: casouri, tomas, emacs-devel
>> > (if user-cache-directory
>> > (expand-file-name name user-cache-directory)
>> > (expand-file-name user-emacs-directory)))
>>
>> AKA (expand-file-name name (or user-cache-directory user-emacs-directory))
>
> Are you sure?
Yup
(if user-cache-directory
(expand-file-name name user-cache-directory)
(expand-file-name user-emacs-directory)))
=>
(expand-file-name name
(if user-cache-directory
user-cache-directory
user-emacs-directory))
=>
(expand-file-name name (or user-cache-directory user-emacs-directory))
-- Stefan
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-20 3:55 ` Stefan Monnier
@ 2020-08-20 7:08 ` Andreas Schwab
2020-08-20 11:51 ` Stefan Monnier
0 siblings, 1 reply; 34+ messages in thread
From: Andreas Schwab @ 2020-08-20 7:08 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Eli Zaretskii, tomas, casouri, emacs-devel
On Aug 19 2020, Stefan Monnier wrote:
> Yup
>
> (if user-cache-directory
> (expand-file-name name user-cache-directory)
> (expand-file-name user-emacs-directory)))
> =>
> (expand-file-name name
> (if user-cache-directory
> user-cache-directory
> user-emacs-directory))
That conversion isn't bug-compatible. :-)
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-19 5:03 ` Amin Bandali
2020-08-19 8:28 ` tomas
@ 2020-08-19 13:33 ` Stefan Monnier
2020-08-19 14:15 ` tomas
2020-08-20 3:09 ` Richard Stallman
2020-08-21 9:49 ` Gunnar Horrigmo
3 siblings, 1 reply; 34+ messages in thread
From: Stefan Monnier @ 2020-08-19 13:33 UTC (permalink / raw)
To: Richard Stallman; +Cc: Gunnar Horrigmo, emacs-devel
> The pros of the XDG Base Directory approach suggested by Gunnar include
> the proposed behaviour by Emacs conforming to the XDG Base Directory
> spec, which has been seeing adoption among GNU/Linux applications. Its
> cons would include `user-emacs-directory' no longer being the one-stop
> shop for the user's Emacs files, a more significant departure from
> Emacs's traditional behaviour.
Another important downside of the XDG thingy is that AFAIK it's not used
under w32 (where some other system is used instead).
I think it'd makes sense to make it *possible* to follow either the
"system-specific" approach (e.g. XDG under GNU/Linux) or the
"Emacs-specific" approach (i.e. all under ~/.emacs.d).
Note also the the OP didn't suggest using XDG but only suggested to add
some structure underneath ~/.emacs.d, which seems quite reasonable and
useful regardless of the use of XDG.
Stefan
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-19 5:03 ` Amin Bandali
2020-08-19 8:28 ` tomas
2020-08-19 13:33 ` Stefan Monnier
@ 2020-08-20 3:09 ` Richard Stallman
2020-08-20 14:56 ` Yuan Fu
2020-08-21 9:49 ` Gunnar Horrigmo
3 siblings, 1 reply; 34+ messages in thread
From: Richard Stallman @ 2020-08-20 3:09 UTC (permalink / raw)
To: Amin Bandali; +Cc: horrigmo, emacs-devel
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> In short, the approach that I proposed divides up `user-emacs-directory'
> into multiple subdirectories and keeps `user-emacs-directory' as the
> all-in-one source of a user's Emacs files, while the XDG Base Directory
> approach as suggested by Gunnar would imply keeping only configuration
> files in `user-emacs-directory', and moving data and cache files to
> "$XDG_DATA_HOME/emacs/" and "$XDG_CACHE_HOME/emacs/" respectively, where
> 'XDG_DATA_HOME' defaults to "~/.local/share" and 'XDG_CACHE_HOME' to
> "~/.cache".
There is a benefit to putting all cache files in ~/.cache. For
instance, you know where to find all the files you can safely delete,
regardless of which program made them.
What concretely are "data" files, for Emacs? I don't know where in
the sources to look for that info. Can you mention a few examples and
what data they contain? With specifics, we can see the concrete
advantage of one choice or the other. With only the abstraction "data
files", we can see only at the level of abstractions, and that is a sort
of blindness that can lead to bad decisions.
--
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-20 3:09 ` Richard Stallman
@ 2020-08-20 14:56 ` Yuan Fu
2020-08-20 15:24 ` Stefan Monnier
0 siblings, 1 reply; 34+ messages in thread
From: Yuan Fu @ 2020-08-20 14:56 UTC (permalink / raw)
To: Richard Stallman; +Cc: horrigmo, Amin Bandali, emacs-devel
> On Aug 19, 2020, at 11:09 PM, Richard Stallman <rms@gnu.org> wrote:
>
> [[[ To any NSA and FBI agents reading my email: please consider ]]]
> [[[ whether defending the US Constitution against all enemies, ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>> In short, the approach that I proposed divides up `user-emacs-directory'
>> into multiple subdirectories and keeps `user-emacs-directory' as the
>> all-in-one source of a user's Emacs files, while the XDG Base Directory
>> approach as suggested by Gunnar would imply keeping only configuration
>> files in `user-emacs-directory', and moving data and cache files to
>> "$XDG_DATA_HOME/emacs/" and "$XDG_CACHE_HOME/emacs/" respectively, where
>> 'XDG_DATA_HOME' defaults to "~/.local/share" and 'XDG_CACHE_HOME' to
>> "~/.cache".
>
> There is a benefit to putting all cache files in ~/.cache. For
> instance, you know where to find all the files you can safely delete,
> regardless of which program made them.
>
> What concretely are "data" files, for Emacs? I don't know where in
> the sources to look for that info. Can you mention a few examples and
> what data they contain? With specifics, we can see the concrete
> advantage of one choice or the other. With only the abstraction "data
> files", we can see only at the level of abstractions, and that is a sort
> of blindness that can lead to bad decisions.
>
I don’t know about the concrete definition, but some built-in examples includes:
recentf-save-file
bookmark-default-file
savehist-file
project-list-file
The main benefit for me is to clean up my .emacs.d, similar to XDG’s goal to clean up the home directory.
Yuan
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-20 14:56 ` Yuan Fu
@ 2020-08-20 15:24 ` Stefan Monnier
2020-08-20 17:14 ` T.V Raman
2020-08-21 3:33 ` Richard Stallman
0 siblings, 2 replies; 34+ messages in thread
From: Stefan Monnier @ 2020-08-20 15:24 UTC (permalink / raw)
To: Yuan Fu; +Cc: horrigmo, Amin Bandali, Richard Stallman, emacs-devel
Yuan Fu [2020-08-20 10:56:28] wrote:
>> On Aug 19, 2020, at 11:09 PM, Richard Stallman <rms@gnu.org> wrote:
>>
>> [[[ To any NSA and FBI agents reading my email: please consider ]]]
>> [[[ whether defending the US Constitution against all enemies, ]]]
>> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>>
>>> In short, the approach that I proposed divides up `user-emacs-directory'
>>> into multiple subdirectories and keeps `user-emacs-directory' as the
>>> all-in-one source of a user's Emacs files, while the XDG Base Directory
>>> approach as suggested by Gunnar would imply keeping only configuration
>>> files in `user-emacs-directory', and moving data and cache files to
>>> "$XDG_DATA_HOME/emacs/" and "$XDG_CACHE_HOME/emacs/" respectively, where
>>> 'XDG_DATA_HOME' defaults to "~/.local/share" and 'XDG_CACHE_HOME' to
>>> "~/.cache".
>>
>> There is a benefit to putting all cache files in ~/.cache. For
>> instance, you know where to find all the files you can safely delete,
>> regardless of which program made them.
>>
>> What concretely are "data" files, for Emacs? I don't know where in
>> the sources to look for that info. Can you mention a few examples and
>> what data they contain? With specifics, we can see the concrete
>> advantage of one choice or the other. With only the abstraction "data
>> files", we can see only at the level of abstractions, and that is a sort
>> of blindness that can lead to bad decisions.
>>
>
> I don’t know about the concrete definition, but some built-in examples includes:
>
> recentf-save-file
> bookmark-default-file
> savehist-file
> project-list-file
ecomplete-database-file
Stefan
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-20 15:24 ` Stefan Monnier
@ 2020-08-20 17:14 ` T.V Raman
2020-08-21 3:33 ` Richard Stallman
1 sibling, 0 replies; 34+ messages in thread
From: T.V Raman @ 2020-08-20 17:14 UTC (permalink / raw)
To: Stefan Monnier
Cc: Yuan Fu, horrigmo, Amin Bandali, Richard Stallman, emacs-devel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 1956 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> writes:
also auto-insert-directory could profit fromusing
locate-user-emacs-file
> Yuan Fu [2020-08-20 10:56:28] wrote:
>
>>> On Aug 19, 2020, at 11:09 PM, Richard Stallman <rms@gnu.org> wrote:
>>>
>>> [[[ To any NSA and FBI agents reading my email: please consider ]]]
>>> [[[ whether defending the US Constitution against all enemies, ]]]
>>> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>>>
>>>> In short, the approach that I proposed divides up `user-emacs-directory'
>>>> into multiple subdirectories and keeps `user-emacs-directory' as the
>>>> all-in-one source of a user's Emacs files, while the XDG Base Directory
>>>> approach as suggested by Gunnar would imply keeping only configuration
>>>> files in `user-emacs-directory', and moving data and cache files to
>>>> "$XDG_DATA_HOME/emacs/" and "$XDG_CACHE_HOME/emacs/" respectively, where
>>>> 'XDG_DATA_HOME' defaults to "~/.local/share" and 'XDG_CACHE_HOME' to
>>>> "~/.cache".
>>>
>>> There is a benefit to putting all cache files in ~/.cache. For
>>> instance, you know where to find all the files you can safely delete,
>>> regardless of which program made them.
>>>
>>> What concretely are "data" files, for Emacs? I don't know where in
>>> the sources to look for that info. Can you mention a few examples and
>>> what data they contain? With specifics, we can see the concrete
>>> advantage of one choice or the other. With only the abstraction "data
>>> files", we can see only at the level of abstractions, and that is a sort
>>> of blindness that can lead to bad decisions.
>>>
>>
>> I don¡¯t know about the concrete definition, but some built-in examples includes:
>>
>> recentf-save-file
>> bookmark-default-file
>> savehist-file
>> project-list-file
>
> ecomplete-database-file
>
>
> Stefan
>
>
--
7©4Id: kg:/m/0285kf1 0Ü87©4
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-20 15:24 ` Stefan Monnier
2020-08-20 17:14 ` T.V Raman
@ 2020-08-21 3:33 ` Richard Stallman
2020-08-23 15:15 ` Stefan Monnier
1 sibling, 1 reply; 34+ messages in thread
From: Richard Stallman @ 2020-08-21 3:33 UTC (permalink / raw)
To: Stefan Monnier; +Cc: horrigmo, casouri, bandali, emacs-devel
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
The doc string of ecomplete-database-file suggests that the file is
really a kind of cache. Is that so? Would deleting the file be
harmless?
I have a feeling that recentf-save-file is also a cache file. Is that so?
On the other hand, it looks like bookmark-default-file is a file of
user data, and deleting the file would lose the user's data. Is that
so?
It is not unreasonable to store the data files in a separate directory
from configuration files. However, if there are few of them it is not
worth the trouble to separate them.
We should take care to distinguish which files are cache files
and put them into ~/.cache.
It makes sense to put data files like that one into a separate place
--
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-21 3:33 ` Richard Stallman
@ 2020-08-23 15:15 ` Stefan Monnier
2020-08-23 16:11 ` Stefan Kangas
` (2 more replies)
0 siblings, 3 replies; 34+ messages in thread
From: Stefan Monnier @ 2020-08-23 15:15 UTC (permalink / raw)
To: Richard Stallman; +Cc: horrigmo, casouri, bandali, emacs-devel
> The doc string of ecomplete-database-file suggests that the file is
> really a kind of cache. Is that so?
Not exactly, it's more like a history (of email addresses we've bumped into).
> Would deleting the file be harmless?
It doesn't contain data the user painstakingly created, but deleting it
would cause the suggested completions to be much less useful for a while.
So it's somewhat like a cache, except that a cache is expected to affect
only the performance but not the actual behavior.
> I have a feeling that recentf-save-file is also a cache file. Is that so?
Same: it's a history (of files we visited).
> We should take care to distinguish which files are cache files
> and put them into ~/.cache.
Agreed. I think package.el's `archive-contents` file do qualify as
caches, as do the <pkg>-readme.txt files.
Stefan
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-23 15:15 ` Stefan Monnier
@ 2020-08-23 16:11 ` Stefan Kangas
2020-08-23 19:02 ` John Yates
2020-08-24 3:22 ` Richard Stallman
2 siblings, 0 replies; 34+ messages in thread
From: Stefan Kangas @ 2020-08-23 16:11 UTC (permalink / raw)
To: Stefan Monnier, Richard Stallman; +Cc: horrigmo, casouri, bandali, emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> We should take care to distinguish which files are cache files
>> and put them into ~/.cache.
>
> Agreed. I think package.el's `archive-contents` file do qualify as
> caches, as do the <pkg>-readme.txt files.
How about something like:
(locate-user-cache-file "foo")
=> ~/.cache/emacs/foo
(locate-user-cache-file "archive-contents" 'package)
=> ~/.cache/emacs/package/archive-contents
(We already have `xdg-cache-home', BTW.)
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-23 15:15 ` Stefan Monnier
2020-08-23 16:11 ` Stefan Kangas
@ 2020-08-23 19:02 ` John Yates
2020-08-24 3:22 ` Richard Stallman
2 siblings, 0 replies; 34+ messages in thread
From: John Yates @ 2020-08-23 19:02 UTC (permalink / raw)
To: Stefan Monnier
Cc: horrigmo, Yuan Fu, bandali, Richard Stallman, Emacs developers
On Sun, Aug 23, 2020 at 11:16 AM Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
. . .
> So it's somewhat like a cache, except that a cache is expected to affect
> only the performance but not the actual behavior.
. . .
> Same: it's a history (of files we visited).
Most web browsers explicitly call out the notion of history.
Perhaps emacs should do the same.
/john
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-23 15:15 ` Stefan Monnier
2020-08-23 16:11 ` Stefan Kangas
2020-08-23 19:02 ` John Yates
@ 2020-08-24 3:22 ` Richard Stallman
2 siblings, 0 replies; 34+ messages in thread
From: Richard Stallman @ 2020-08-24 3:22 UTC (permalink / raw)
To: Stefan Monnier; +Cc: horrigmo, casouri, bandali, emacs-devel
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> So it's somewhat like a cache, except that a cache is expected to affect
> only the performance but not the actual behavior.
That means it is not really a cache. So it is a data file.
Thanks.
--
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Cleaning up and structuring user-emacs-directory
2020-08-19 5:03 ` Amin Bandali
` (2 preceding siblings ...)
2020-08-20 3:09 ` Richard Stallman
@ 2020-08-21 9:49 ` Gunnar Horrigmo
3 siblings, 0 replies; 34+ messages in thread
From: Gunnar Horrigmo @ 2020-08-21 9:49 UTC (permalink / raw)
To: Richard Stallman; +Cc: Gunnar Horrigmo, emacs-devel
Amin Bandali <bandali@gnu.org> writes:
> The pros of the XDG Base Directory approach suggested by Gunnar include
> the proposed behaviour by Emacs conforming to the XDG Base Directory
> spec, which has been seeing adoption among GNU/Linux applications. Its
> cons would include `user-emacs-directory' no longer being the one-stop
> shop for the user's Emacs files, a more significant departure from
> Emacs's traditional behaviour.
I don't see that as a con, since I want all my configuration files under
version control. Having my configurations seperate from all of emacs'
own configurations is less hassle (even if it's easily dealt with).
> I'm personally leaning towards the former, somewhat more conservative
> approach, but could see the arguments for the latter as well. I'm
> interested in hearing other folks' thoughts and opinions, and other
> pros/cons they can think of.
I prefer the XDG way, as that makes it neater and easier to simply put
~/.config under version control, and pretty much be done with it.
Would it be out of the question supporting both (via a
--old-school-config or somesuch (or new-school for that matter :)))?
--
Gunnar
^ permalink raw reply [flat|nested] 34+ messages in thread