Sending the Emacs Region to OmniFocus ( defun send-region-to-omnifocus ( beg end ) "Send the selected region to OmniFocus. Instead, this version generates the AppleScript in a string and callsĭo-applescript directly (which perhaps did not exist when the Temporary file, and then ran the script in a shell using osascript. Original function created the AppleScript as a string, wrote it to a Indicating that the task was added from Emacs and a timestamp.įinally, the new function is also a little more efficient. It uses the first line of the region as the task name andĪny subsequent lines as the task note. The new function is also different in how it handles the contents of Tend to first “capture” tasks quickly and process them later, when IĬlean them up and assign projects and contexts. This is a personal preference of mine, since I OmniFocus Inbox rather than sitting around in the quick entry window Important difference for me is that the task is sent straight to the Then I defined a new send-region-to-omnifocus function. ( let (( result "" ) ( start 0 ) end ) ( save-match-data ( if ( or ( null ( string-match "" argument )) ( < ( match-end 0 ) ( length argument ))) ( while ( string-match "" argument start ) ( setq end ( match-beginning 0 ) result ( concat result ( substring argument start end ) " \\ " ( substring argument end ( 1 end ))) start ( 1 end )))) ( concat " \" " result ( substring argument start ) " \" " ))))) Of very minor modifications): ( defun applescript-quote-string ( argument ) "Quote a string for passing as a string to AppleScript." ( if ( or ( not argument ) ( string-equal argument "" )) " \"\" " Quote using double quotes, but escape any existing quotes or backslashes in the argument with backslashes. The communication between Emacs and OmniFocus needs to happen usingĪppleScript, so I first borrowed Ken’s applescript-quote-stringįunction for properly escaping strings in AppleScript (with a couple My taste, so I decided to write a different function based on Ken’s To trigger the quick entry keyboard shortcut to save the task to the The region to OmniFocus’s quick entry window, but then you still have Omnifocus-capture.el by Ken Case defines a function which sends Solutions to work or wished they worked differently. However, I either had some trouble getting the previous Out this problem has been solved at least three timesīefore. Use it to create a new task in OmniFocus? I thought so, and it turns In these cases, I would recommend the railwaycat brew formula or, respectively.Wouldn’t it be great if you could take the current region in Emacs and You can also install pre-built binaries via homebrew or downloaded from the web. For the first question, if you wanted to build your own, just got clone the repo from savannah, or Mitsuharu’s mac port from bitbucket, and follow the instructions therein. If you’re interested, this is a fine way to live (I lived this way myself for almost a decade until my battleship 2011 mbp finally died during the era of the terrible butterfly keyboards). That means that you can try out new features much faster than the slow release schedule, if you want.įor the mac, it’s not hard to go from “macOS with Xcode” to “using a self-built emacs”. On the other hand, the development head is also very usable - at least a couple decades of my own usage has been self-built from the most recent sources, and problems have been very, very rare. The releases are relatively rare, every year or two on the new “fast” schedule, and are supported for a long while. The other question is: build your own latest and greatest, or use a stable package built by someone else? Emacs is a remarkably stable piece of software (seriously I’ve been using it for more than 30 years, and there are lots of people who’ve been using it longer). For pure functionality on current macOS, I think the mac port has a few niceties that are missing from the ns port, and the cost of being a bit behind the bleeding edge - which brings us to the other question. Both work well, and there are reasons to prefer both. There is also another version, more recent, that uses different low-level macOS toolkits/frameworks/primitives called the “mac port”. One question is: which version of “make emacs work well under macOS” should I use? There’s a default version that comes with emacs for many years, that also works with GNUStep, thanks called the “ns port”. This is kind of two questions, depending on your circumstances.
0 Comments
Leave a Reply. |