all repos — nixfiles @ 3937dbd373054643862bed55e11280d2f34b6eeb

System and user configuration, managed by nix and home-manager

BC! Emacs: move config to XDG config dir
Alan Pearce alan@alanpearce.eu
Wed, 26 Aug 2020 14:02:23 +0200
commit

3937dbd373054643862bed55e11280d2f34b6eeb

parent

0f6a0e57504c07aa9f93f6d23a56555341ee5124

3 files changed, 6 insertions(+), 5 deletions(-)

jump to
M user/emacs/init.eluser/emacs/init.el
@@ -49,7 +49,7 @@ ap/path-configured t)) 
 ;;; Customize
 
-(setq custom-file "~/.emacs.d/custom.el")
+(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
 (load custom-file :noerror :nomessage)
 
 (use-package crux
@@ -576,7 +576,8 @@ ;; I like to keep my backups out of regular folders.  I tell emacs to use
 ;; a subfolder of its configuration directory for that.  Also, use the
 ;; trash for deleting on OS X.
-(let ((backup-dir (expand-file-name "~/.emacs.d/backups/")))
+(let ((backup-dir (expand-file-name "emacs" (or (getenv "XDG_DATA_HOME")
+                                                "~/.local/share"))))
   (unless (file-directory-p backup-dir)
     (make-directory backup-dir))
   (setq backup-directory-alist `((".*" . ,backup-dir))
M user/modules/eshell.nixuser/modules/eshell.nix
@@ -20,7 +20,7 @@ };   };
 
   config = mkIf cfg.enable {
-    home.file.".emacs.d/eshell/alias" = {
+    xdg.configFile."emacs/eshell/alias" = {
       recursive = true;
       text = concatStringsSep "\n" (mapAttrsToList (k: v: "alias ${k} ${v}") cfg.eshell.aliases);
     };
M user/settings/emacs.nixuser/settings/emacs.nix
@@ -189,10 +189,10 @@ ];   home.sessionVariables = {
     EDITOR = "${editorScript}/bin/edit";
   };
-  home.file.".emacs.d/init.el" = {
+  xdg.configFile."emacs/init.el" = {
     source = ../emacs/init.el;
     onChange = ''
-      ${config.programs.emacs.finalPackage}/bin/emacs -Q -batch -f batch-byte-compile .emacs.d/init.el
+      ${config.programs.emacs.finalPackage}/bin/emacs -Q -batch -f batch-byte-compile .config/emacs/init.el
     '';
   };