Deft is an Emacs mode for quickly browsing, filtering, and editing directories of plain text notes. The Deft buffer is simply a file browser which lists the titles of all text files in the Deft directory followed by short summaries and last modified times. The title is taken to be the first line of the file and the summary is extracted from the text that follows. Files are, by default, sorted in terms of the last modified date, from newest to oldest. Deft’s primary operation is searching and filtering. The list of files can be limited or filtered using a search string, which will match both the title and the body text. To initiate a filter, simply start typing. Filtering happens on the fly. As you type, the file browser is updated to include only files that match the current string.
To open the first matching file, simply press RET. If no files match your search string, pressing RET will create a new file using the string as the title. This is a very fast way to start writing new notes. The filename will be generated automatically. If you prefer to provide a specific filename, use C-RET instead.
Press C-c C-c to clear the filter string and display all files and C-c C-g to refresh the file browser using the current filter string.
Pressing C-c C-t will toggle between incremental and regexp search modes. Regexp search mode is indicated by an “R” in the mode line.
Common file operations can also be carried out from within Deft. Files can be renamed using C-c C-r or deleted using C-c C-d.
New files can also be created using C-c C-n for quick creation or C-c C-m for a filename prompt. You can leave Deft at any time with C-c C-q.
Unused files can be archived by pressing C-c C-a. Files will be moved to deft-archive-directory, which is a directory named archive within your deft-directory by default.
You can also press C-o to open a file in another window, without switching to the other window. Issue the same command with a prefix argument, C-u C-o, to open the file in another window and switch to that window.
For more advanced editing operations, you can also edit the filter string in the minibuffer by pressing C-c C-l. While in the minibuffer, the history of previous edits can be cycled through by pressing M-p and M-n.
The first element of deft-extensions (or in Lisp parlance, the car) is the default extension used to create new files.
By default, Deft only searches for files in deft-directory but not in any subdirectories. All files in deft-directory with one of the specified extensions will be included except for those matching deft-ignore-file-regexp. Set deft-recursive to a non-nil value to enable searching for files in subdirectories (those not matching deft-recursive-ignore-dir-regexp):
For compatibility with other applications which use the filename as the title of a note (rather than the first line of the file), set the deft-use-filename-as-title flag to a non-nil value. Deft will then use note filenames to generate the displayed titles in the Deft file browser. To enable this, add the following to your .emacs file: