emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Skip Collins <skip.collins@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Cc: "Xebar Saram" <zeltakc@gmail.com>,
	"Martin Yrjölä" <martin.yrjola@gmail.com>,
	"Giacomo M" <jackjackk@gmail.com>,
	"Mike McLean" <mike.mclean@pobox.com>
Subject: Re: streamlined capture on iphone
Date: Mon, 29 Feb 2016 11:51:57 -0500	[thread overview]
Message-ID: <CABUh-76BxOQkJsbiJCz_U1gKUikpreYmbikfDrSL0NDAG_Tfkw@mail.gmail.com> (raw)
In-Reply-To: <CABUh-75Bf5QKQeA+W2t-mBDWdOrxXxPfa2BKh+H9aZsjNhJ_rw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 5948 bytes --]

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
<https://drafts4-actions.agiletortoise.com/a/1hp> 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 my.address+capture@gmail.com 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
<https://drafts4-actions.agiletortoise.com/k/1hq> 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='my.address+capture@gmail.com'/>
  <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
<https://script.google.com/d/12jCYKYzJRKFrOqTVGXAv16MdU3--fAOrYQpjB7LXA8yC-ave7Ffmo4RK/edit?usp=sharing>
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.

[-- Attachment #2: Type: text/html, Size: 13545 bytes --]

      parent reply	other threads:[~2016-02-29 16:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24 22:59 streamlined capture on iphone Skip Collins
2016-02-25 13:16 ` Giacomo M
2016-02-25 13:24   ` Xebar Saram
2016-02-25 16:32 ` John Rakestraw
2016-02-25 18:14 ` Eric S Fraga
2016-02-26 11:22 ` Martin Yrjölä
2016-02-26 12:20 ` Ken Mankoff
2016-02-29 17:08   ` Skip Collins
2016-02-29 16:51 ` Skip Collins [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABUh-76BxOQkJsbiJCz_U1gKUikpreYmbikfDrSL0NDAG_Tfkw@mail.gmail.com \
    --to=skip.collins@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jackjackk@gmail.com \
    --cc=martin.yrjola@gmail.com \
    --cc=mike.mclean@pobox.com \
    --cc=zeltakc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).