From b25cc68585731c6e8295cfcd927518a4e0fa9682 Mon Sep 17 00:00:00 2001 From: Raul Benencia Date: Tue, 12 Nov 2024 15:34:37 -0800 Subject: emacs: create backup dir if it doesn't exists --- .emacs.d/init.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to '.emacs.d') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index c0fd0fa..acad923 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -6,9 +6,10 @@ (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) -(if (file-directory-p "~/.backup") - (setq backup-directory-alist '(("." . "~/.backup"))) - (message "Directory does not exist: ~/.backup")) +(let ((backup-dir "~/.backup")) + (unless (file-directory-p backup-dir) + (make-directory backup-dir t)) + (setq backup-directory-alist `(("." . ,backup-dir)))) (setq backup-by-copying t ; Don't delink hardlinks -- cgit v1.2.3