diff options
author | Case Duckworth | 2022-06-15 10:26:10 -0500 |
---|---|---|
committer | Case Duckworth | 2022-06-15 10:26:10 -0500 |
commit | dbb6181a5d8b5aa14a46bb207ebaf6c7911c8ced (patch) | |
tree | 18b152655077e6519b491edeb76aa14f2cd10306 /lisp/+emacs.el | |
parent | Fix startup complaining (diff) | |
download | emacs-dbb6181a5d8b5aa14a46bb207ebaf6c7911c8ced.tar.gz emacs-dbb6181a5d8b5aa14a46bb207ebaf6c7911c8ced.zip |
aodifu
Diffstat (limited to 'lisp/+emacs.el')
-rw-r--r-- | lisp/+emacs.el | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/+emacs.el b/lisp/+emacs.el index 533d438..b4742da 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el | |||
@@ -206,8 +206,17 @@ Do this only if the buffer is not visiting a file." | |||
206 | 206 | ||
207 | ;;; Hooks | 207 | ;;; Hooks |
208 | 208 | ||
209 | (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) | 209 | (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) |
210 | (add-hook 'minibuffer-setup-hook 'cursor-intangible-mode) | 210 | (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) |
211 | |||
212 | (defun +auto-create-missing-dirs () | ||
213 | "Automatically create missing directories when finding a file." | ||
214 | ;; https://emacsredux.com/blog/2022/06/12/auto-create-missing-directories/ | ||
215 | (let ((target-dir (file-name-directory buffer-file-name))) | ||
216 | (unless (file-exists-p target-dir) | ||
217 | (make-directory target-dir t)))) | ||
218 | |||
219 | (add-hook 'find-file-not-found-functions #'+auto-create-missing-dirs) | ||
211 | 220 | ||
212 | 221 | ||
213 | ;;; Better-default functions ... | 222 | ;;; Better-default functions ... |