20seven

Devigner blog about development and design

Emacs Buffer to OmniFocus

In messing around with emacs early this morning and a little google search I turned up a nice elisp snippet that works well for sending the current buffer you’re working in to OmniFocus with a note attached.


(defun sendOmni () 
  (interactive)
  (let ((fname (buffer-file-name (current-buffer))))
  (do-applescript (concat "tell front document of application \"OmniFocus\" 
  set aTask to (make new inbox task with properties {name:\"From Emacs " 
  (buffer-name (current-buffer)) "\", note:\"file:///" fname "  \" })
      tell note of aTask
        make new file attachment with properties {file name:\"" fname "\"}
      end tell
   end tell"))
	))
(global-set-key [f3] 'sendOmni)

I will be reworking it to my own liking to make it more readable in the OmniFocus inbox and I’m trying to get a recursive script working to send commented TODO’s into inbox items.