emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] streamlined capture on iphone


From: Skip Collins
Subject: Re: [O] streamlined capture on iphone
Date: Mon, 29 Feb 2016 11:51:57 -0500

This describes a system to efficiently capture Org input on a smart phone, with an emphasis on iOS. The nice thing about this approach is that it only requires things that you likely already have: your smart phone, your Google account, and Org. While not required, a text editing app on your iOS/Android phone that streamlines the email process is very nice to have too. However, any email app that supports templates might be another way to make the process very quick. Note that this is a one-way path from phone to Org. It does not enable two-way syncing or editing existing Org content. The process is lightly tested and quite fragile. On the positive side, it can be customized in many ways to better fit your needs.

If using Drafts 4 on iOS, import the Org Email action by opening this link on your device. Tap the button to install the action. Open the list of actions in Drafts (top right), swipe right on the Org Email action, and tap on the Edit (pen) icon. Replace address@hidden with your actual gmail address, appending “+capture” to the username as shown in the original. The action sends the current note in the background to your gmail account using Mail.app and then deletes the note from Drafts. Mail.app must be connected to your email account for this to work.

The fastest way to trigger this action is via a keyboard shortcut which can be installed by opening the link on your iOS device. Again, tap the install button. It places a small button labeled “O” (for Org) on the far left of the row of shortcuts displayed between the keyboard and the text editing area.

>From your desktop browser, Add “capture” to the list of available labels in gmail. On the same computer, create a new file called org-capture-gmail-filter.xml with the following content, replacing the email address with your actual gmail address, with “+capture” appended as above:

<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'>
<title>Mail Filters</title>
<id>tag:mail.google.com,2008:filters:1455750924353</id>
<updated>2016-02-25T22:55:06Z</updated>
<entry>
  <category term='filter'></category>
  <title>Mail Filter</title>
  <id>tag:mail.google.com,2008:filter:1455750924353</id>
  <updated>2016-02-25T22:55:06Z</updated>
  <content></content>
  <apps:property name='to' value='address@hidden'/>
  <apps:property name='label' value='capture'/>
  <apps:property name='shouldArchive' value='true'/>
  <apps:property name='shouldNeverSpam' value='true'/>
  <apps:property name='sizeOperator' value='s_sl'/>
  <apps:property name='sizeUnit' value='s_smb'/>
</entry>
</feed>

Open the gmail filter settings page in your browser. Using the button at the bottom of the page, upload org-capture-gmail-filter.xml. Now, when gmail receives a message sent to the special address that includes “+capture”, it triggers a filter that applies the “capture” label and moves the message out of the Inbox.

Once messages are appropriately labeled, the The Google Apps script Gmail Capture for Org generates a plain text Atom feed from the subject lines and bodies of the messages. Click the link to open the script in your desktop browser. Follow these steps to set up the script for your Google account:

  1. File > Make a copy of this script.
  2. Run > setup IMPORTANT: when authenticating use the gmail account you want to create feeds for.
  3. File > Manage versions… and create an initial name and ’Save New Version’.
  4. Publish > Deploy as web app… and select ’Execute the app as: me’ and allow anyone access even anonymously.
  5. Open (and bookmark) the ’current web app url’ to create an atom feed for the capture gmail label.
  6. Select the “capture” label from the drop-down menu. Click Preview. Click Add.
  7. Copy the resulting RSS (really Atom) feed link under Feed Library in the web app page

The feed link needs to be added to org-feed to complete the setup. Add the following lines near the top of .emacs:

(require 'org-feed)
;; Uncomment the following line if you want to check your feeds 
;; every 10 minutes when Emacs is running.
;;   (run-at-time 10 600 'org-feed-update-all)
(defadvice org-feed-parse-atom-entry (after org-feed-parse-atom-entry-summary activate)
  ;; Add <summary/> as :summary.
  (let* ((entry (ad-get-arg 0))
         (xml (car (read-from-string
                    (plist-get entry :item-full-text)))))
    (setq entry (plist-put entry :summary
                           (xml-substitute-special
                            (car (xml-node-children
                                  (car (xml-get-children xml 'summary))))))) entry))

The customize interface for Org Feed can be used to add the feed information, resulting in something that looks like:

  '(org-feed-alist
     (quote
     (("Gmail Capture"
       "https://script.google.com/macros/s/Tr5GHsidf8gjslTsdY69SDFjgslierjg73swnvFslkjYhUR69KdhjI8k/exec?feedId=35f1c893-ba1d-6108-bc8d-19e09017fe8a"
       "capture.org" 
       "Gmail Capture" 
       :parse-entry org-feed-parse-atom-entry 
       :parse-feed org-feed-parse-atom-feed))))
  '(org-feed-default-template "* %h
     %U
     %summary")

Replace the long URL with the RSS link copied from the web app. Replace capture.org with whatever file you wish to receive new items. Replace the final “Gmail Capture” with whatever headline the new items should be placed under. Restart Emacs.

Now, whenever you execute org-feed-update-all (C-c C-x g), it will retrieve new content from your custom Atom feed.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]