How can I enable auto-save based on filename? I use a naming convention (a prefix to the filename) for my notes and I'd like to enable auto-save for those files.
1 Answer
I don't know if there is a "correct" way to make this happen.
What comes to my mind is:
(defvar my-auto-save-regexp "/jdigit")
(defun my-auto-save-mode-fn ()
(when (string-match my-auto-save-regexp buffer-file-name)
(auto-save-mode 1)))
(add-hook 'find-file-hook 'my-auto-save-mode-fn)