1
0
Fork 0

Ensure the auto-save directory exists

The auto-save functions don't automatically create it.
This commit is contained in:
Tom Willemse 2019-03-30 12:06:56 -07:00
parent ab1ca612da
commit 87d03bef94

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 20190304234446
;; Version: 20190330120416
;; Package-Requires: (oni-data-dir expand-region multiple-cursors embrace)
;; This program is free software; you can redistribute it and/or modify
@ -29,6 +29,9 @@
(require 'oni-data-dir)
(defconst oni-core--auto-save-directory (oni-data-dir-locate "auto-save-files/")
"Directory where auto-saves go.")
(defalias 'yes-or-no-p 'y-or-n-p)
(defun oni-core--destroy-trailing-whitespace ()
@ -44,8 +47,13 @@
(local-set-key (kbd "RET") 'electric-newline-and-maybe-indent))
(local-unset-key (kbd "C-j"))
(local-unset-key (kbd "RET"))))
(defun oni-core--ensure-autosave-directory-exists ()
"Create the autosave directory if doesn't exist."
(mkdir oni-core--auto-save-directory t))
(add-to-list 'auto-save-file-name-transforms
`(".*" ,(oni-data-dir-locate "auto-save-files/") t)
`(".*" ,oni-core--auto-save-directory t)
:append)
(setq backup-directory-alist
@ -79,6 +87,7 @@
(add-hook 'electric-indent-local-mode-hook #'oni-core--switch-newline-keys)
(add-hook 'minibuffer-setup-hook 'electric-pair-local-mode)
(add-hook 'prog-mode-hook 'goto-address-prog-mode)
(add-hook 'auto-save-hook #'oni-core--ensure-autosave-directory-exists)
(global-set-key (kbd "C-M-SPC") 'er/expand-region)
(global-set-key (kbd "M-+") 'mc/mark-next-like-this)