[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ~/.emacs vs ~/.emacs.d/init.el.
From: |
Hongyi Zhao |
Subject: |
Re: ~/.emacs vs ~/.emacs.d/init.el. |
Date: |
Sun, 13 Dec 2020 23:12:39 +0800 |
On Sun, Dec 13, 2020 at 10:53 PM <2QdxY4RzWzUUiLuE@potatochowder.com> wrote:
>
> On 2020-12-13 at 22:38:08 +0800,
> Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> > On Sun, Dec 13, 2020 at 9:59 PM <2QdxY4RzWzUUiLuE@potatochowder.com> wrote:
> > >
> > > On 2020-12-13 at 21:50:37 +0800,
> > > Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
> > >
> > > > On Sun, Dec 13, 2020 at 6:09 PM Yuri Khan <yuri.v.khan@gmail.com> wrote:
> > > > >
> > > > > On Sun, 13 Dec 2020 at 16:00, Hongyi Zhao <hongyi.zhao@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > As far as the initialization file is concerned, which is more
> > > > > > preferable,~/.emacs or ~/.emacs.d/init.el?
> > > > >
> > > > > If you are choosing between these two, ~/.emacs.d/init.el is
> > > > > preferable. Because then you can put the whole .emacs.d into version
> > > > > control separately from your home directory.
> > > > >
> > > > > However keep in mind that Emacs 27 adds support for XDG-style
> > > > > configuration directory, ~/.config/emacs/, which gives you the same
> > > > > abilities as ~/.emacs.d with an added benefit of less clutter in your
> > > > > home directory.
> > > >
> > > > I've tried the following based on your above notes, but it seems that
> > > > emacs doesn't pick up the initialization file located under
> > > > ~/.config/emacs/ automatically.
> > > >
> > > > $ mv .emacs.d/init.el ~/.config/emacs/
> > > >
> > > > Any hints for this problem?
> > >
> > > Try removing or renaming ~/.emacs.d, the existence of which might be
> > > fooling emacs into *not* searching for ~/.config/emacs. For reference,
> > > see:
> > >
> > >
> > > https://www.gnu.org/software/emacs/manual/html_node/emacs/Find-Init.html
> > >
> >
> > Currently, the ~/.emacs.d directory is used by emacs to store many of
> > the user data as shown below:
> >
> > $ ls ~/.emacs.d/
> > auto-save-list cnfonts eaf elpa init.el network-security.data rime
> > url
> >
> > So, if I removed/deleted this folder, then where should I put the
> > emacs' user data?
>
> Presumably, ~/.config/emacs is an alternative to ~/.emacs.d, so you
> would move all of that user data from ~/.emacs.d to ~/.config/emacs.
> The net result would have been the same if you had renamed ~/.emacs.d to
> ~/.config/emacs instead of separating the init file from the other user
> data.
>
The above operation described by you doesn't conform to the XDG base
directory specification given on its official website
<https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html>.
To be more specific, see the following exceptions from there for more
info:
Environment variables
$XDG_DATA_HOME defines the base directory relative to which user
specific data files should be stored. If $XDG_DATA_HOME is either not
set or empty, a default equal to $HOME/.local/share should be used.
$XDG_CONFIG_HOME defines the base directory relative to which user
specific configuration files should be stored. If $XDG_CONFIG_HOME is
either not set or empty, a default equal to $HOME/.config should be
used.
So, if we want to let emacs fully comply with this specification, then
the data should be put under $XDG_DATA_HOME while the config files
should be put under $XDG_CONFIG_HOME. So, the conclusion should be
drawn as follows:
Emacs data, say, user installed packages ------> $HOME/.local/share/emacs
Emacs config files, say, init.el ------> $HOME/.config/emacs
Regards
--
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic Vocational and Technical University
NO. 552 North Gangtie Road, Xingtai, China
- ~/.emacs vs ~/.emacs.d/init.el., Hongyi Zhao, 2020/12/13
- Re: ~/.emacs vs ~/.emacs.d/init.el., Christopher Dimech, 2020/12/13
- Re: ~/.emacs vs ~/.emacs.d/init.el., Yuri Khan, 2020/12/13
- Re: ~/.emacs vs ~/.emacs.d/init.el., Hongyi Zhao, 2020/12/13
- Re: ~/.emacs vs ~/.emacs.d/init.el., Tim Visher, 2020/12/13
- Re: ~/.emacs vs ~/.emacs.d/init.el., 2QdxY4RzWzUUiLuE, 2020/12/13
- Re: ~/.emacs vs ~/.emacs.d/init.el., Hongyi Zhao, 2020/12/13
- Re: ~/.emacs vs ~/.emacs.d/init.el., Tim Visher, 2020/12/13
- Re: ~/.emacs vs ~/.emacs.d/init.el., 2QdxY4RzWzUUiLuE, 2020/12/13
- Re: ~/.emacs vs ~/.emacs.d/init.el., Tim Visher, 2020/12/13
- Re: ~/.emacs vs ~/.emacs.d/init.el.,
Hongyi Zhao <=
- Re: ~/.emacs vs ~/.emacs.d/init.el., 2QdxY4RzWzUUiLuE, 2020/12/13
- Re: ~/.emacs vs ~/.emacs.d/init.el., Eli Zaretskii, 2020/12/13
- Re: ~/.emacs vs ~/.emacs.d/init.el., Perry Smith, 2020/12/13
- Re: ~/.emacs vs ~/.emacs.d/init.el., Hongyi Zhao, 2020/12/13
Re: ~/.emacs vs ~/.emacs.d/init.el., Emanuel Berg, 2020/12/13