diff options
author | Raúl Benencia <id@rbenencia.name> | 2024-12-12 07:30:32 -0800 |
---|---|---|
committer | Raúl Benencia <id@rbenencia.name> | 2024-12-12 07:31:14 -0800 |
commit | 3b7b57a0900e7e49e3fbc2520b0e6b01f4526be1 (patch) | |
tree | 1aa96038e821ffcd4006e601ef32d0d51eee5150 | |
parent | c67ea65e46adb6b3c8c54dcee48b9966c062b63f (diff) |
emacs: create backup dir if it doesn't exist (babel)
-rw-r--r-- | .emacs.d/rul-emacs.org | 7 |
1 files 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 |