emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Default emacs init file location confusion


From: Robert Pluim
Subject: Re: Default emacs init file location confusion
Date: Mon, 13 Jan 2020 08:53:47 +0100

>>>>> On Fri, 10 Jan 2020 17:46:34 -0800, Paul Eggert <address@hidden> said:

    Paul> On 1/10/20 8:57 AM, Eli Zaretskii wrote:
    >>> Iʼll see if I can test it soon, unless someone beats me to it.
    >> Any news with this?  I'd like to have this in the repository ASAP, so
    >> that the pretest (which is expected soonish) will have it.

    Paul> Which version is "this"? It's kind of a long thread....

I think "this" is something like the following.

;; Return the name of the init file directory for Emacs, assuming
;; XDG-DIR is the XDG location and USER-NAME is the user name.  If
;; USER-NAME is nil or "", use the current user.  Prefer the XDG
;; location only if the .emacs.d location does not exist.
(defun startup--xdg-or-homedot (xdg-dir user-name)
  (let ((emacs-d-dir (concat "~" user-name
                             (if (eq system-type 'ms-dos)
                                 "/_emacs.d/"
                               "/.emacs.d/"))))
    (cond
     ((or (file-exists-p emacs-d-dir)
          (if (eq system-type 'windows-nt)
              (if (file-directory-p (concat "~" user-name))
                  (directory-files (concat "~" user-name) nil
                                   "\\`[._]emacs\\(\\.elc?\\)?\\'"))
            (file-exists-p (concat "~" init-file-user
                                   (if (eq system-type 'ms-dos)
                                       "/_emacs"
                                     "/.emacs")))))
      emacs-d-dir)
     ((file-exists-p xdg-dir)
      xdg-dir)
     (t emacs-d-dir))))

This requires an etc/NEWS update as well.

    Paul> If the idea is to go back to defaulting to .emacs.d, that's a step in
    Paul> the wrong direction. Instead, I suggest that when Emacs starts up in 
a 
    Paul> fresh home directory that lacks both .config/emacs and .emacs.d, Emacs
    Paul> creates .config/emacs and sets up a symlink .emacs.d ->
    Paul> .config/emacs. This would avoid the specific problem that Elias ran
    Paul> into, and is less likely to cause problems in environments where user
    Paul> configurations live in '.config'.

    Paul> Partly I suggest this because it's what I've already been doing by
    Paul> hand: the symlink makes things more convenient for users who run a
    Paul> mixture of Emacs versions, as I do.

I have no objection to symlinking, but Eli really wants to only use
XDG if .emacs.d is non-existent.

Robert



reply via email to

[Prev in Thread] Current Thread [Next in Thread]