From 3b7b57a0900e7e49e3fbc2520b0e6b01f4526be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Benencia?= Date: Thu, 12 Dec 2024 07:30:32 -0800 Subject: emacs: create backup dir if it doesn't exist (babel) --- .emacs.d/rul-emacs.org | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.emacs.d/rul-emacs.org b/.emacs.d/rul-emacs.org index f2a3a45..5394b3e 100644 --- a/.emacs.d/rul-emacs.org +++ b/.emacs.d/rul-emacs.org @@ -101,9 +101,10 @@ I use package from both stable and bleeding-edge Melpa. Emacs tends to clutter the filesystem with backup files. A backup file is normally the filename with a =~= suffix. I rather have my filesystem clean, and centralize all backups in a single directory. #+begin_src emacs-lisp :tangle "init.el" -(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