Enjoying Open Source Software

Open files with Deft in read only mode

Deft for Emacs

Deft for Emacs is an Emacs mode for quickly browsing, filtering, and editing directories of plain text notes.

It was designed for increased productivity when writing and taking notes by making it fast and simple to find the right file at the right time and by automating many of the usual tasks such as creating new files and saving files.


Read-only-mode is a great mode in Emacs for reading text, like text files, documents, web-pages, man-pages, and info-pages.

The read-only-mode turns a buffer into a read-only buffer.

Using the read-only-mode is very intuitive.

  • Space-bar: scroll down one page
  • Backspace: scroll up one page
  • q: Quit and close buffer

Toggle read-only-mode

The standard key binding to toggle the read-only-mode is C-x C-q.

Open files with Deft in read-only-mode

Deft is designed to quickly create and edit notes. However, most of the time I open a note, I want just to browse the contents, not edit it.

It seems much more efficient to open these notes in read-only-mode. That way I can go through the note with the space-bar and backspace keys, not having to worry about accidentally altering the note. Closing the buffer with the note with 'q' add to the efficiency.

Fortunately, Deft comes with some handy hooks, one of those is the deft-open-file-hook, which runs after opening a file.

All it takes to let Deft open notes in read-only-mode is:

(add-hook 'deft-open-file-hook 'read-only-mode)

Of course, to edit a note, one first have to toggle the read-only-mode, with C-x C-q.

This is also the case when starting a new note from within Deft, so first consider your workflow before putting this in your Emacs configuration.


⇽ Build SBCL on FreeBSD NetBSD 9.3 on FreeBSD bhyve ⇾