zomg, Evernote and Emacs
Posted: - Modified: | emacsUpdate 2013-10-19: Check out https://github.com/pymander/evernote-mode for a possibly better way to do things. =)
This is totally raw and needs a lot of hacking, but look, I can dump subtrees from my Org notes into Evernote using Emacs Evernote Mode. The desktop app handles these perfectly, although the Android app does funny things to the whitespace if you edit the note. Still, great as a reference!
Mwahahahaha!
(defun sacha/org-get-subtree-region () "Return the start and end of the current subtree." (save-excursion (let (beg end folded (beg0 (point))) (if (org-called-interactively-p 'any) (org-back-to-heading nil) ; take what looks like a subtree (org-back-to-heading t)) ; take what is really there (org-back-over-empty-lines) (setq beg (point)) (skip-chars-forward " \t\r\n") (save-match-data (save-excursion (outline-end-of-heading) (setq folded (outline-invisible-p))) (condition-case nil (org-forward-same-level (1- n) t) (error nil)) (org-end-of-subtree t t)) (org-back-over-empty-lines) (setq end (point)) (list beg end)))) (defun sacha/org-post-subtree-to-evernote (&optional notebook) "Post the current subtree to Evernote." (interactive) (let ((title (nth 4 (org-heading-components))) (body (apply 'buffer-substring-no-properties (sacha/org-get-subtree-region)))) (with-temp-buffer (insert body) (enh-command-with-auth (let (note-attr) (setq note-attr (enh-command-create-note (current-buffer) title notebook nil "TEXT")) (enh-update-note-and-new-tag-attrs note-attr))))))
In other news, I now have book notes from 156 books in my Evernote notebook. Mwahahaha! Time to add more.
29 comments
Jay Dugger
2012-08-02T10:45:19ZAwesome! I thought I was the only person using evernote-mode. I have it working well under Linux, but not under Cygwin. Any suggestions?
Sacha Chua
2012-08-04T03:38:21ZI got mine to work under Cygwin after following the notes in the config. I also edited the .rb script to make it go to the http address instead of https, as my Ruby doesn't seem to have SSL support and I haven't gotten around to fixing it yet. Hope that helps!
Matthew Darling
2012-08-02T17:06:54ZDo you suppose the generated HTML files would be compatible with OneNote's import? A combined mode that works with both services (through SkyDrive for OneNote) would be awesome!
Dave Abrahams
2012-08-17T19:26:51ZSacha, I've been wondering what made you pick up Evernote, and how do you use it? Doesn't having some stuff in Org and other things in Evernote just lead to information fragmentation?
Thanks
Sacha Chua
2012-08-19T01:21:19ZDave: I mostly use Evernote for the ability to search within hand-written images, which I use for my sketchnotes. I'm also curious about the ability to easily take image and sound notes. So far, no problems with information fragmentation, even between Org and my blog and Evernote. =) I'll probably run into that someday, but in the meantime, not stressing out about it - just keeping redundant copies of things that are particularly important to me. <laugh></laugh>
Jason John Wells
2012-10-03T08:39:06ZHi Sacha and/or Fellow Commentator,
I would LOVE to link up Emacs and Evernote but I also ran into a
'SSL_connect SYSCALL returned=5 errno= sate=unknown state'
Is that the same error you fixed in enclient.rb?
I tried deleting the the 's' off 'https' but still get that error. This is my first time trying to edit a Ruby file so any advice is much appreciated.
Org mode is my text tool of choice and Evernote is the killer Android app for me as I live in a small Japanese town with limited Japanese ability.
Thanks for an awesome blog.
Sacha Chua
2012-10-03T16:00:53ZCould you try installing Cygwin and then installing ruby inside Cygwin? Maybe that makes a difference.
Clair
2012-10-24T10:22:23ZBeen thinking about using Emacs and Evernote together, Sacha! XD This is something I realized I could do.
Sacha Chua
2012-10-24T16:02:41ZHappy to help you get going with it! =D
vicente
2012-11-19T17:58:32Zsacha. tried evernote-mode but got stuck. I tried to open a note, but after entering my pw a message reads 'can't convert nil into string' any hints?
Tim
2013-07-19T20:48:08ZI have the same issue -- was this ever fixed for you?
sachac
2013-07-19T21:18:03ZEvernote currently doesn't support out-of-band authentication for OAUTH, so I think that means Evernote integration for Emacs is broken.
vicente
2012-11-19T18:00:37Zps. I'm using GNU Emacs 24.1.1 (i686-redhat-linux-gnu, GTK+ Version 2.24.13)
of 2012-10-22 on buildvm-17.phx2.fedoraproje...
Sacha Chua
2012-11-21T06:21:07ZCould you M-x toggle-debug-on-error and e-mail me (or better yet, the evernote-mode maintainer) your backtrace?
vicente
2012-11-22T02:04:42ZDebug on Error enabled globally
Waiting for the result... [2 times]
can't convert nil into String
#now using debugger (GBD)
Waiting for the result...
Blocking call to accept-process-output with quit inhibited!!
can't convert nil into String
# this is the backltrace buffer (but I think it's not evernote-mode related)
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
gdb-show-stop-p()
(or (not (memq gud-minor-mode (quote (gdbmi pdb)))) (gdb-show-stop-p))
this is all I can get. sorry but don't know how to get more backtrace
Sacha Chua
2012-11-22T02:11:24ZThat sounds more like the Evernote command-line tool bundled with evernote-mode isn't working for you. Could you ask Yusuke Kawakami, who wrote evernote-mode? https://github.com/rubbish/... might be another variant to try. Note that you'll need to have Ruby set up on your system.
Geoffrey Roman
2013-01-29T09:53:18ZHi Sacha! I'm new to Emacs and I was excited by this evernote-mode. But evernote switched to Oauth authentification and the mode. Have you got some news about this?
Also I like Evernote for its search capabilities, like PDF or images OCR searches. I'm in school so I have a lot of documents and switch just to Org-mode isn't possible. Maybe you've got some tips to get organized with all these documents easily!
Sorry about my english, I'm French...
sachac
2013-01-30T04:45:41ZI'm looking forward to digging into this in February. :) Hope we can figure things out!
Geoffrey Roman
2013-02-01T09:40:08ZThanks a lot! :)
el3ctron
2014-09-24T20:13:11Z:)
sachac
2013-02-27T23:54:51ZIt turns out that Evernote doesn't support out-of-band authentication yet (http://discussion.evernote...., so we're out of luck for now. =|
netawater
2013-04-16T07:46:54ZDoes that mean the evernote-mode can not be used at all if Evernote always doesn't support out-of band authentication?
SeanG
2013-04-17T15:47:29ZI just spent some time trying to get evernote-mode working in my Emacs install. I believe some semi-substantial work will need to be done to it to work with the new authentication system. Right now it seems to be set up to log in as an API consumer, and that process is onerous (you have to get an API key, and then request that Evernote make it live on the production site. Even then, who knows if it will actually work).
sachac
2013-04-18T17:06:06ZC'est la vie. =( Even as an API consumer, it still won't work because Evernote doesn't currently support out-of-band authentication.
vicco
2013-05-20T18:52:16Zis it the same problem for nixnote? I wonder if this would work as an indirect access to evernote.
jre
2013-03-18T19:15:11ZSacha -
I have found more immediately useful stuff related to emacs org mode at your site than anywhere else<sup>[1]</sup>, so thanks! Now that it looks as if Evernote will be a preferred format by my co-workers, I want to get evernote-mode working on Windows and Linux boxen. May I complain here about my bafflement when I get stuck?
<sup>[1]</sup> Bernt Hansen's place is close.
sachac
2013-03-18T19:18:57ZAww, thanks! Yes, you may, although it won't be any use until Evernote supports out-of-band authentication. =( Or someone makes a web-based service that takes an Org file and Does Stuff To It...
Erik L. Arneson
2014-11-25T21:52:32ZHi Sacha,
Thanks for the link to my Github project page! A few of us are still working on evernote-mode and it's kind of getting better. It uses OAuth now, and I've been fiddling with the org-mode integration.
-Erik
sachac
2014-12-13T18:31:58ZAwesome, thanks for working on it! =D