In deft mode I can change the default text extension using
(setq deft-extension "txt")
Is there any way to support multiple file types? (e.g. I have a mix of .txt .md and .org files in my directory)
Building on the workaround in @ws6079's answer, you can use advice to specify a default extension for new files.
Here's an example that defaults to
txt (using Emacs 24.4-style advice):
(setq deft-extension "") (defvar deft-default-extension "txt") (defun my/deft-default-extension (orig-func &rest args) (let ((deft-extension deft-default-extension)) (apply orig-func args))) (when (not (version< emacs-version "24.4")) (advice-add 'deft-new-file :around #'my/deft-default-extension))
As pointed out by @glucas this does not seem to be possible right now. A somewhat acceptable workaround for multiple file types is (for me) to set
(setq deft-extension "")
which matches all files in the directory. Unfortunately new files then have an dot extension
Pretty big bump, but it really can be just a simple regexp as you (@ws6079) suggested in a comment. The following works for
(setq deft-extension "\\(\\.org\\'\\|\\.txt\\'\\)")
I don't know if support for this had been added since you first asked.
From the file deft.el, this works
(setq deft-extensions '("txt" "tex" "org")