Hacker News new | past | comments | ask | show | jobs | submit login
Deft -- easy note taking for Emacs (jblevins.org)
142 points by superbobry on Sept 10, 2011 | hide | past | web | favorite | 37 comments



It's when I see gems like these that I feel like spending time to learn emacs. I've tried a couple of times.. but it is so damn hard. I feel like vim keybindings are burnt in my memory/fingers.. and it makes it so unproductive to relearn something totally different. Any vim power user successfully switched to Emacs? If so, did you switch back missing Vim or you're still using emacs and couldn't be happier? (I'm still interested in the reverse side.. where Emacs power users switched back to vim).


I'm a vim user who started to really get into Lisp (and now ML for school). Emacs (especially with SLIME) is really the Right Thing for Lisp, so I started using it. I've definitely gotten to the point where `C-a C-k` is as well burned into my fingers as `dd` is...it's just that

a) `dd` seems like a more natural keybinding--both because I'd rather double-tap a home row button than involve three fingers and two hands, and because, if you do stop to think about it, `dd` makes sense--`d` means delete, and a double-tap usually makes something apply to a whole line. (Of course, `dd` / `C-a C-k` is just an example--this applies in general.)

b) There's more of a zen to vim. It's been discussed before, but it's worth repeating--vim commands form a language with nouns and verbs. `w` means word and `(` means sentence. Now you know two commands. `d` means delete, `y` means yank, and `c` means change. Now you know 8 commands--`w`, `dw`, `yw`, `cw`, `(`, `d(`, etc. And adding a few more "nouns" brings you up to several dozen with minimal effort. Emacs has no direct equivalent * .

So I like emacs for the ecosystem, I like it for the freakish integration it can achieve between a REPL and a source file...as they say, it's a great operating system--it just needs a good editor.

* - This is not quite true--emacs does try to do sane things with the use of `C` and `M`. `C-f` means "forward one character", and `M-f` means "forward one word"--a "bigger" form of the same thing. In the same way, `C-d` deletes a character and `M-d` deletes a word. But now you want to delete a line? Time to learn something completely new.

Edited to make a lame effort to fix my formatting problems...thus the asterisks surrounded by a sea of whitespace.


I had the exact same experience, and agree with everything you said.

I'll note that I tried vimpulse for a while. Then I stopped. I wish I could be more helpful, but that's all I remember. I don't even know if stopping was an actual decision that I made, or if I just didn't start again after reinstalling everything.

(vimpulse-mode is an attempt to bring vim keybindings to emacs.)


I tried using viper, and eventually just got confused and realized that I should just learn emacs...and the best way of learning emacs was to go cold turkey. Some things emulated vi, not vim (delete key would not remove a newline, pressing undo twice resulted in undo->redo (and no net change)). Some things were intercepted by emacs (C-v to try to enter visual block mode). It was just a confusing and unhappy time.


seconded! I made the same beginner's error, too, and then decided that it was just the wrong thing to do. Emacs does not have a modal concept and cursor movement is not done with "hjkl" (and "ew") in Emacs. As Steve Yegge said, you should use incremental search forwards and backwards instead. I guess that eliminates many of vim's keystrokes (stats would be interesting), so staying with its keybindings might be prohibitive to learning Emacs...


I'm a hardcore Emacs user and yet my keybindings are Vim keybindings. I sleep well at night.

There's a package called "Evil" that provides good Vim keybindings to Emacs. You might hear references to "Vimpulse"; this is the successor to that.

My config file is at https://github.com/pavpanchekha/dotfiles/blob/master/.emacs.... --- you probably care about the section on Vim keybindings.


Thank you! It's nice to see how you structured and commented all sections.. really helpful.


Hi,

I have been using vim extensively for about 8 years and used a boring phase during my previous work-life to start learning Emacs. My motivation was not because I liked anything particularly well in Emacs or disliked vim, but more that I wanted to see first-hand what the difference is really all about. (So that I know what the flame wars are all about, without ever needing [and also never wanting] to participate in one...)

I am still using vim from time to time, but cannot imagine going back to vim full-time and leaving Emacs. The learning curve is steep and getting a nice setup takes considerable time (thankfully, there are very enlightening articles, for example the one from Steve Yegge, as well as the excellent emacswiki; plus, many people post their ".emacs" file on the web.) IIRC, it took me about 6 months until I felt proficient, and now, after almost 5 years or so, I couldn't actually be happier. There are many reasons to my happiness with Emacs (TRAMP, ido, yasnippet, auctex+reftex, vcs-interface, dired+, org-mode, macros, breadcrumbs, etc.) but I don't want to get into that, let's just finish this by saying: if you're generally interested and have some time at your hands (it's far less cumbersome as you might think, and mechanically codifying is usually [for me at least] not really the time consuming task in programming), just do it and stick with it for a couple of weeks!


I used Vim for a quite a few years before switching to Emacs and I was fairly proficient at it. Although similar to Unix and Emacs it would take a lifetime or more to know everything about it. I still use Vi(m) today when logged in to a remote server or for small editing tasks, but the more advanced usage has slipped from my memory... I don't even know how to use keyboard macros anymore.

There's one big 'if' to my Vim usage which made me want to try out new editors: I never really like the modal editing paradigm.

Upon getting interested in Common Lisp I switched to Emacs because I also wanted to be able to use ILISP (Slime nowadays). Once I made some customizations and implemented some ideas which I thought would be cool for an editor to have I never looked back[1]. Modern day IDEs haven't really been able to impress me either and Emacs' customization language being a Lisp was a pro as well.

However, I have customized a lot of my keybindings. While the basic editing commands are okayish the more complex "chords" are hideous and all the additional modes add more and more complex chords. By custom there's one prefix ("C-c" IIRC) behind which the user can put his own keybindings but I just ignore that and override everything to fit my keybindings.

(Even more fun: I recently decided to change my keybindings to fit in more with the more custom keybindings found in other applications found on Unix, Windows and Mac: Ctrl-o for opening a file, Ctrl-f for search, Ctrl-r for replace, Ctrl-w for closing a window/tab/buffer, etc. etc. It's not been too bad actually and seems like a keeper.)

I've never found it hard to switch between them (apart from the occasional 'ZZ' in Emacs) just like it's never been hard to switch between QWERTY and Dvorak for me.

[1] Being able to customize and try out new things without have to recompile or even restart is very nice. (ie. the Lisp way)


I've had the same feeling. When I learned about org mode, I actually spent a week using emacs exclusively trying to get used to it and failed.

But whenever I feel this way I wonder why these sorts of applications don't exist for vim. I don't know many people who would argue that vimscript is as good a language as lisp is, but isn't it complete enough to do stuff like this? Or you could use python to do it.

Is it a cultural thing? Is there some infrastructure support in emacs that makes applications much easier to write?


Armchair psychology: I think vi users have a more "Unix mindset" as in a program should do one thing and do it well. While Emacs users want to do everything in Emacs (browse the net, walk directories, use shells, edit movies, etc. etc.)

The generalisations I just made are so broad as to be useless though :-)


Available via Marmalade as well: http://marmalade-repo.org/packages/deft

Just spent a few minutes playing around with it. I like the simplicity, nice work. One thought I had is that you could enter Deft mode whenever you cd into a directory with a .deft configuration file. This file could have a title for the top of the Deft view and perhaps the ability to specify what columns you want displayed. In this way you can have different directories for notes about different topics.


If you are a vim user, I recommend vimwiki: http://www.vim.org/scripts/script.php?script_id=2226


My notes have gotten pretty extensive and sprawling, so I have a cron job which every hour indexes all org-mode and python files with swish[1]. It's pretty hacky, but I've integrated this with emacs's dired-mode, so that I get a clickable list[2]. It's an absolute life saver, at times.

  [1] http://swish-e.org/docs/swish-search.html
  [2] http://pastebin.com/xeDbjKhA



Thanks, I did that for the formatting, without really thinking about the impact on the links.


Hmm. Deft, org-mode, Dropbox, and MobileOrg might just made the perfect desktop/mobile note system. Definitely setting this one up!


I use https://github.com/cefstat/simplenote.el to synchronize with simplenote service and on mobile device and Notational Velocity.

Deft seems little more refined, and simplenote.el has not been updated for a while, but would be nice if it synced with simplenote.


I'm the author of simplenote.el. Deft looks very interesting and I am happy that simplenote.el was of some use to Jason for writing Deft. As a sidenote, I am always pleasantly surprised when I hear that people are using simplenote.el; this was just a small personal project that I put on github on a whim.

You should not expect much more to happen with simplenote.el since I don't feel very motivated to work on it anymore. When I first wrote simplenote.el the Simplenote app and platform were perfect. Since then Simplenote has changed to a direction that I don't like (tags, different pay model) [1]. Furthermore, I have been lately traveling a lot to China and Appspot is blocked there. This limits the usefulness of Simplenote.

I do plan to rewrite simplenote.el for Simplenote's API2 and clean up the code but at the moment I don't plan to add any new features. In particular, I don't plan to add any support for tags. Of course everybody is welcome to fork simplenote.el and continue its development.

[1]: I understand that most Simplenote users are happy with these changes and actually Simperium has done a great job in adding features in an unobtrusive way.


I appreciate you creating simplenote.el. I understand disagreeing with direction platform taken, particularly if you are personally unable to take advantage of it.

As far as forking, would you consider merging in tag support into your version, if someone were to send you a patch?


I was using simplenote.el for a bit as well, your efforts are greatly appreciated.

:-)


If you need a bit more, that is, todo lists, planning, etc. while keeping a way to easily edit text documents, you also have Org-Mode http://orgmode.org/

Do not try to setup Org-Mode if you are new to Emacs, you will feel a bit overwhelmed (at least I was), but once you get used to Emacs and Org-Mode, it is a pleasure to use it. I use it for GTD, day planner and notes taking like here: http://notes.ceondo.com


I think the key thing about Org-mode is to not read the documentation. All you need to start is stars and the tab key. The docs have a way of dumping keybindings onto you. Org mode has a lot of features --- don't try to read the manual through. Just start using it and every time you think of a feature you would like, look it up in the manual.


It is worth looking through the documentation to learn what it _can_ do. I've met people who say "I wish it could do x" and I reply "It can do x!"


This is probably good advice, and I think I'll give org-mode another try without trying to build it around someone else's setup.

I've been using emacs for years, but could never quite make an habit out of org mode. I think deft handling simple org files might be a good way to get started.


I kept trying to start with a todo list in Org-mode, and it was never worth it. Instead, I ended up getting into Org-mode through using it as a markup (it supports inline LaTeX!) and only later learned some of the shortcuts. I've just started using C-RET and similar to add outline nodes, for example; similarly C-. and C-d and such. Now I use Org-mode heavily for literate programming as well.

One of the reasons I love Emacs and Org-mode so much is that it never forces you to use its features. For the right approach and for the power user, this is beautiful.


Yeah, don't follow other people's guides to get started. Just realize that org-mode has so many features (including Literate Programming) it's easy to get lost.

Just start by using it as an outliner, when your files get too big or you need to start keeping TODO lists, look into agenda views, then capture, then ... well you know.

Start as simple as possible, and when things break, or don't do what you need, spend 15 minutes and make them work.


wow, that's pretty impressive. how did you automate that?


Why are the rows hard-set to 80 columns? Is there a way to change this value, or better yet, have it auto-fill to the width of the window?


I don't use Deft, so YMMV, but it sounds like you're looking for visual-line-mode.

Interactively:

  M-x visual-line-mode
Or in your .emacs:

  (add-hook 'deft-mode-hook 'enable-visual-line-mode)
You'll probably need to set deft-line-width to some number that's larger than the most columns you ever have in a frame, because from a quick glance it looks like Deft has some magic of its own.


Thank you so much for this. This immediately replaced my usage of org-velocity. I used this function to convert my (10,000 line) velocity.org file into separate files for Deft:

  (defun generate-files-from-velocity (buffername)
    (save-excursion
      (switch-to-buffer buffername)
      (org-map-entries (lambda ()
                         (progn
                           (org-mark-subtree)
                           (if (and (= 1 (org-outline-level)) (org-export-get-title-from-subtree))
                               (let* ((title (downcase (org-export-get-title-from-subtree)))
                                      (filename (replace-regexp-in-string " " "-" (concat title ".org"))))
                                 (append-to-file (region-beginning) (region-end) (concat "~/Documents/Org/Notes/" filename)))))))))
  
  (generate-files-from-velocity "velocity.org")


I haven't used either of these, but they seem to fill a useful niche. What do you find are the pros and cons of deft vs. org-velocity?


The advantage for me is entirely in terms of separating notes into separate files; something that Deft does and org-velocity isn't really built for. I was planning on implementing something like that for org-velocity, but with the arrival of Deft I no longer have to.


[deleted]


As rauchg mentioned look at vimwiki. http://code.google.com/p/vimwiki/


But that does not run in Emacs


no org-mode support?


Sure there is.

"You can also customize the major mode that Deft uses to edit files, either through M-x customize-group or by adding something like the following to your .emacs file:

(setq deft-text-mode 'markdown-mode)"

All you need to do is:

(setq deft-text-mode 'org-mode)

Or any other major mode for that matter.




Registration is open for Startup School 2019. Classes start July 22nd.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: