From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: ~/.emacs vs ~/.emacs.d/init.el. Date: Sun, 13 Dec 2020 23:12:39 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29293"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 13 16:13:23 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1koT3p-0007X0-6J for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 13 Dec 2020 16:13:21 +0100 Original-Received: from localhost ([::1]:53094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koT3o-000695-7T for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 13 Dec 2020 10:13:20 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1koT3P-00068V-AT for help-gnu-emacs@gnu.org; Sun, 13 Dec 2020 10:12:55 -0500 Original-Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]:45288) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1koT3N-0007Z0-En for help-gnu-emacs@gnu.org; Sun, 13 Dec 2020 10:12:55 -0500 Original-Received: by mail-lf1-x129.google.com with SMTP id x20so4236226lfe.12 for ; Sun, 13 Dec 2020 07:12:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=cr7Dm6QvVh2qPL+yxeuxxJx2Kt7yWVcy7gGqtHFScgs=; b=XAC+VqPoAyRZ29Cq1BPAvI5imF1TZbLbGtWjnwdv74u4n8p+ppB/flsziCxlP5V6b/ StfCGWaauBao5+rmBPflyV6gv9VaLkjL2zXSv5y8J4Un/DN8hGx5LTe/QPrLRa7qnNtm qtbyHOUZOn+3soj75CNlbwy1qhpEsQWq/qxAeyIHw5Z3ElaWTgJO6RMsJ+UsOvrESpQr ouMRK+6ZuIFzaqYGSNhK8bKudC5rfDMIMekWBrgwMmO1KfR0MEcL6WgU1afmXyt87Wd1 PflxrIB7WSevAyWq+vcA2qwqNZXaqdvB+8k7D6Pm1JQiHt96/zROwQAfdehuWBisKHTJ 42EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=cr7Dm6QvVh2qPL+yxeuxxJx2Kt7yWVcy7gGqtHFScgs=; b=jTp9t+IdbRFU9LgOJPtxkDk2rmNEV2P7rhTTmZbvY1+DGwy0iRqBj1Z3bMcxzFGS4u sPgvrjuxcFOtwvjTFPRBS0fGiepCfZpv+to4IP/RHH0jwwwXBXneX/JxyQ6cJ1PKn0/P 0FkRaqDfskkNU4HjZsxCSCkEixt21UAONA5ZV6UpEGBrwwjLOAcelOOPG1T91EZfPRqc ySzk9UADfY1yU4ofaULezcHE+VLSMV3tjuLAWWdGqUxh1NRt1AN6H3mnZqYjouChFxjz GgXeNxaOWNRhG87tXgY+pCkBU1jup+tndtUhImnMRLjvzdLR8CN6NU/BEJh+EvH+mPqN wZuw== X-Gm-Message-State: AOAM532SGBxUfH7VnUO409dMmeuNEZWexlgglVNZpv/MAVah/Q54GQj+ XMp+8AAFAl5kFumnixzkdl+QevOzKTTpKr9k24ifWTwzLvxjFlsL X-Google-Smtp-Source: ABdhPJyIDCe54Rki3ZXuSzWTiUqZ5WsHJ6WR9MDah5RolNWpkX4IR+6CvwKvIYEzAacnKmTmeGH2zOpzjWc69LtMCI8= X-Received: by 2002:ac2:59ce:: with SMTP id x14mr7993579lfn.545.1607872371074; Sun, 13 Dec 2020 07:12:51 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=hongyi.zhao@gmail.com; helo=mail-lf1-x129.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:126313 Archived-At: On Sun, Dec 13, 2020 at 10:53 PM <2QdxY4RzWzUUiLuE@potatochowder.com> wrote: > > On 2020-12-13 at 22:38:08 +0800, > Hongyi Zhao 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 wrote: > > > > > > > On Sun, Dec 13, 2020 at 6:09 PM Yuri Khan wrote: > > > > > > > > > > On Sun, 13 Dec 2020 at 16:00, Hongyi Zhao 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 . 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 Theory and Simulation of Materials Hebei Polytechnic Vocational and Technical University NO. 552 North Gangtie Road, Xingtai, China