2011-09-15

quick note-taking with deft and org-mode

Emacs must be gathering a lot of enthusiasts lately; there's hardly a week where I don't discover some new gem. Recently, I discovered deft. And apparently, I wasn't the only one.

So what is it deft good for? Well, often I want to jot down some quick thing during a meeting or a telephone-call. Of course, I don't want to think about file names or anything else distracting me from my task, just get me that note already! In addition, at some later time, I want to be able to quickly search through the notes I made.

For MacOS, there's a program called Notational Velocity which does this. But really - it sounds like a typical task for emacs - wouldn't it be nice to have an emacs package that does roughly the same?

And that is what deft does - enable you to quickly write notes, and retrieving them later. The author has an excellent introduction on his website, so my job is very easy :) deft is not part of org-mode, but they can work together seamlessly. Here's my set-up:

;; http://jblevins.org/projects/deft/
(when (require 'deft nil 'noerror) 
   (setq
      deft-extension "org"
      deft-directory "~/Org/deft/"
      deft-text-mode 'org-mode)
   (global-set-key (kbd "<f9>") 'deft))

This blob goes in my .emacs. Note, the first line ensures that emacs starts without errors, even when I run on a system without deft. Apart from that, I make deft use org files for note taking, which makes it all very familiar.

All notes are saved ~/Org/deft - you can set it to something else of course. A Dropbox-folder seems to be a popular choice for synchronizing between machines.

Finally, the last line binds F9 to deft-mode. So, when I need a quick note, I can type F9 C-c C-n and start writing.

14 comments:

Anonymous said...

How does it compare to org capture?

Anonymous said...

seems to add friction to my workflow. why should I use deft when there's org-capture + refiling?! how do you organize your notes? what goes in deft and what goes through org-capture and why?

djcb said...

@Anonymous 1,2: well, I like org-capture for little pre-formatted things, like appointments, todo-items, urls-to-read.

However, deft seems more targeted towards writing a bit longer docs (meeting notes, sudden inspiration), and the searching is pretty nice.

Anyhow, clearly, there is overlap, and who knows if these things will converge. For now, just give it a try (as I do), and see if it sticks...

Anonymous said...

thanks for this post, deft looks interesting. did an extra single-quote sneak in to your init code at the end of the deft-extension line? i had to remove it to get it to work.

djcb said...

@Anonymous 3: thanks, fixed.

Richard Lewis said...

Seems pretty similar to remember.el.

Anonymous said...

I don't see the point. Org-capture does precisely what is described here (and much more). if you like, you can make a capture template for your longer free-form notes, handling them differentlly from your todo and and appointments. that's what i do, anyway.

(of course, this is not meant as criticism of deft.)

Paul Rodriguez said...

As its author, I might mention another Notational Velocity–inspired notetaking package for Emacs, based on Org: Org-Velocity. It's included in the contrib directory of the Org distribution. Instead of separate files, it uses entries in an Org file, and for creating notes, it integrates Org-Capture with its own customizable set of templates.

Mark said...

Hello,

Thanks for this awesome blog; I'm somewhat of an emacs newbie and I find this source second to only the EmacsWiki on the entire net.

Are you, by any chance, able to get deft mode to recognize two file types instead of just .org files? For example, I use balance.el to manage my checkbook and I'd like to get deft to see .bal files too.

Thanks in advance for your help and again for emacs-fu.

—Mark

Anonymous said...

You can get dynamic searching in org as well:

http://www.emacswiki.org/emacs-de/org-occur-goto.el

Anonymous said...

The dynamic searching for org, as mentioned by anon @ Oct 9 is excellent. I've tried deft, and although it works well I can't see me using it regularly. I'll stick to org.

e201 said...

Hey djcb and thanks! I was searching few days ago a way to share notes easily between OSX (without Emacs) and GNU/Linux/Emacs.

Just *perfect*. Notational Velocity and deft works very well together.

Cheers.

drj said...

I like to use deft with org, though I'm not a guru with org by any means.

I point deft at my org directory, bind a key to run it, and viola - I have a nice, clean, searchable menu of all my org files. I can easily create new org files from the deft menu, which works well for me, because my system is pretty ad hoc.

I havent tried velocity though... it doesnt seem to be included with the version of org that I have.

Dave said...

One thing I found is that deft's searching is slightly more rigid than Notational Velocity's - it treats the search string as a single fixed string, rather than splitting it on whitespace.

This is on emacswiki on the Deft page: http://www.emacswiki.org/emacs/DeftMode

I've written a replacement search function, which makes the search work like NVs.

I also use the deft-text-mode variable to attach a custom minor-mode to deft buffers, and wrote a "kill-all-deft-buffers" function. Basically, I set up my "launch deft" button to become a "close deft and (after saving if necessary) all related buffers." if a deft-related buffer is focused. This means that hitting [f6] gets me into and out of deft quickly.