Skip to content

Commit

Permalink
published import org agenda into osx calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
caoyuanqi committed Jan 9, 2015
1 parent 4f64b97 commit 0c6a73d
Show file tree
Hide file tree
Showing 11 changed files with 374 additions and 8 deletions.
6 changes: 6 additions & 0 deletions Yuanqi Cao
Expand Up @@ -87,6 +87,12 @@
<header>
<h1 id="recent-posts">Recent Posts <a id="allposts" href="http://caoyuanqi.github.io/archives.html">all posts</a></h1>
</header>
<ul class="list-all-articles">
<li>
<a href="http://caoyuanqi.github.io/orgtoosxcalendar">Import org agenda into osx&nbsp;calendar </a>
<time pubdate="pubdate" datetime="2015-01-09T00:00:00+11:00">Jan 09, 2015</time>
</li>
</ul>
<ul class="list-all-articles">
<li>
<a href="http://caoyuanqi.github.io/hello world">Hello&nbsp;world <small> from pelican </small> </a>
Expand Down
3 changes: 3 additions & 0 deletions archives.html
Expand Up @@ -58,6 +58,9 @@ <h1><a href="/archives.html">All Posts</a></h1>
<div class="row-fluid">
<div class="span8 offset2">
<ul class="list-all-articles">
<li><a href="http://caoyuanqi.github.io/orgtoosxcalendar">Import org agenda into osx&nbsp;calendar </a>
<time pubdate="pubdate" datetime="2015-01-09T00:00:00+11:00">Jan 09, 2015</time>
</li>
<li><a href="http://caoyuanqi.github.io/hello world">Hello&nbsp;world <small> from pelican </small> </a>
<time pubdate="pubdate" datetime="2015-01-01T00:00:00+11:00">Jan 01, 2015</time>
</li>
Expand Down
15 changes: 15 additions & 0 deletions categories.html
Expand Up @@ -74,6 +74,21 @@ <h1><a href="/categories.html">All Categories</a></h1>
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle list-of-categories" data-toggle="collapse" data-parent="#accordion2" href="#Programming-ref">
Programming<span>1</span>
</a>
</div>
<div id="Programming-ref" class="accordion-body collapse">
<div class="accordion-inner">
<ul class="list-articles-category">

<li><span><time pubdate="pubdate" datetime="2015-01-09T00:00:00+11:00">Jan 09, 2015</time></span> <a href="http://caoyuanqi.github.io/orgtoosxcalendar">Import org agenda into osx&nbsp;calendar </a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down
42 changes: 41 additions & 1 deletion feeds/yuanqi-cao.atom.xml
@@ -1,5 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Cao -&gt;Log</title><link href="http://caoyuanqi.github.io/" rel="alternate"></link><link href="http://caoyuanqi.github.io/feeds/yuanqi-cao.atom.xml" rel="self"></link><id>http://caoyuanqi.github.io/</id><updated>2015-01-01T00:00:00+11:00</updated><entry><title>Hello world</title><link href="http://caoyuanqi.github.io/hello%20world" rel="alternate"></link><updated>2015-01-01T00:00:00+11:00</updated><author><name>Yuanqi Cao</name></author><id>tag:caoyuanqi.github.io,2015-01-01:hello world</id><summary type="html">&lt;p&gt;Hi, 2015 and the&amp;nbsp;world&lt;/p&gt;
<feed xmlns="http://www.w3.org/2005/Atom"><title>Cao -&gt;Log</title><link href="http://caoyuanqi.github.io/" rel="alternate"></link><link href="http://caoyuanqi.github.io/feeds/yuanqi-cao.atom.xml" rel="self"></link><id>http://caoyuanqi.github.io/</id><updated>2015-01-09T00:00:00+11:00</updated><entry><title>Import org agenda into osx calendar</title><link href="http://caoyuanqi.github.io/orgtoosxcalendar" rel="alternate"></link><updated>2015-01-09T00:00:00+11:00</updated><author><name>Yuanqi Cao</name></author><id>tag:caoyuanqi.github.io,2015-01-09:orgtoosxcalendar</id><summary type="html">&lt;p&gt;In the daily life, I prefer to use emacs org mode to manage my time and I also use iphone and macbook. The org mode is a perfect way to manage your time but iphone and calendar is a good way to track your time. So is there a good way to let them work better for&amp;nbsp;me?&lt;/p&gt;
&lt;p&gt;so I tried org &lt;a class="reference external" href="https://itunes.apple.com/us/app/mobileorg/id634225528?ls=1&amp;amp;mt=8"&gt;mobile&lt;/a&gt; before, but it is really hard to use in iphone , and it will create some mark line in the pushed event. There is no good solution on the Internet. So I made a perl script to parse the org file and get out every event and time then import into osx Calendar by calling relative apple-script&amp;nbsp;command.&lt;/p&gt;
&lt;p&gt;It will automaticly import an event into osx calendar when you assigned a time to it. If your i phone is connected into cloud, it will of course alert your automaticly. And you can check your schedule on both org agenda and your iphone and clendar on the &lt;span class="caps"&gt;OSX&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;The logic is&amp;nbsp;simple:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
1. When emacs store the org file in org mode or org agenda, call the script
2. The script will scan the org file and try to import the files into calendar one by one
3. When it finish scan it will store the added event time into time.txt
4. When any time is added, the event started with the same time will not be added
&lt;/pre&gt;
&lt;p&gt;To use the script, you should added this &lt;a class="reference external" href="https://github.com/caoyuanqi/scripts/blob/master/_org_file_handler"&gt;script&lt;/a&gt; into your &lt;span class="caps"&gt;PATH&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Added this line into your emacs setting files, there will add a hook and call the script every time you store any org&amp;nbsp;file&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;add-hook&lt;/span&gt; &lt;span class="ss"&gt;&amp;#39;after-save-hook&lt;/span&gt;
&lt;span class="o"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;or&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;eq&lt;/span&gt; &lt;span class="nv"&gt;major-mode&lt;/span&gt; &lt;span class="ss"&gt;&amp;#39;org-mode&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;eq&lt;/span&gt; &lt;span class="nv"&gt;major-mode&lt;/span&gt; &lt;span class="ss"&gt;&amp;#39;org-agenda-mode&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;progn&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;setq&lt;/span&gt; &lt;span class="nv"&gt;org-add-event-command&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;concat&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;&amp;lt; &amp;quot;&lt;/span&gt; &lt;span class="nv"&gt;buffer-file-name&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;call-process-shell-command&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;_org_file_handler&amp;quot;&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="nv"&gt;org-add-event-command&lt;/span&gt;&lt;span class="p"&gt;))))))&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You should decide a way for the time.txt this will store all time stamp you already imported in the&amp;nbsp;script&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="nv"&gt;$time_file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;where/your/want/to/put/the/time.txt&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Most importantly, you should arrange your org file into this style, because this script will scan the * header as the calendar it want to insert the&amp;nbsp;event:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
* calendar name in osx calendar
** Other thing
&lt;/pre&gt;
&lt;p&gt;For example, if I want to insert an event named: exercise into a calendar named life in osx calendar, I will make this even like&amp;nbsp;below:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
* life
** exercise
SCHEDULED: &amp;lt;2015-01-09 Fri 13:00-14:00&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Because it is a script I made almost 1 year ago and it works very well for me, there are some thing need to do better, but if there is no big problem, I won&amp;#8217;t fix it, because maybe I will rewrite the script in Python in object oritential style. So if there are any interesting ideas to let me&amp;nbsp;know?&lt;/p&gt;
&lt;pre class="literal-block"&gt;
A. The calendar have to restart to make the events be refreshed. (I think it is apple's problem)
B. time.txt maybe should be clean up, but it is not a big issue for us
C. I tell the application every time I want to add an event, I should be tell once and add many, but I am really lazy to change that. ^-^
&lt;/pre&gt;
&lt;p&gt;I think it will work fine for you.&amp;nbsp;enjoy!&lt;/p&gt;
</summary><category term="perl"></category><category term="emacs"></category><category term="org mode"></category></entry><entry><title>Hello world</title><link href="http://caoyuanqi.github.io/hello%20world" rel="alternate"></link><updated>2015-01-01T00:00:00+11:00</updated><author><name>Yuanqi Cao</name></author><id>tag:caoyuanqi.github.io,2015-01-01:hello world</id><summary type="html">&lt;p&gt;Hi, 2015 and the&amp;nbsp;world&lt;/p&gt;
&lt;p&gt;This is my personal website, and I treat it like a personal hacking note and some organization of some technical thinking. So I will keep the words simple and&amp;nbsp;focus.&lt;/p&gt;
&lt;p&gt;I think I should get some wish in the new&amp;nbsp;year:&lt;/p&gt;
&lt;blockquote&gt;
Expand Down
42 changes: 41 additions & 1 deletion feeds/yuanqi-cao.rss.xml
@@ -1,5 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Cao -&gt;Log</title><link>http://caoyuanqi.github.io/</link><description></description><atom:link href="http://caoyuanqi.github.io/feeds/yuanqi-cao.rss.xml" rel="self"></atom:link><lastBuildDate>Thu, 01 Jan 2015 00:00:00 +1100</lastBuildDate><item><title>Hello world</title><link>http://caoyuanqi.github.io/hello%20world</link><description>&lt;p&gt;Hi, 2015 and the&amp;nbsp;world&lt;/p&gt;
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Cao -&gt;Log</title><link>http://caoyuanqi.github.io/</link><description></description><atom:link href="http://caoyuanqi.github.io/feeds/yuanqi-cao.rss.xml" rel="self"></atom:link><lastBuildDate>Fri, 09 Jan 2015 00:00:00 +1100</lastBuildDate><item><title>Import org agenda into osx calendar</title><link>http://caoyuanqi.github.io/orgtoosxcalendar</link><description>&lt;p&gt;In the daily life, I prefer to use emacs org mode to manage my time and I also use iphone and macbook. The org mode is a perfect way to manage your time but iphone and calendar is a good way to track your time. So is there a good way to let them work better for&amp;nbsp;me?&lt;/p&gt;
&lt;p&gt;so I tried org &lt;a class="reference external" href="https://itunes.apple.com/us/app/mobileorg/id634225528?ls=1&amp;amp;mt=8"&gt;mobile&lt;/a&gt; before, but it is really hard to use in iphone , and it will create some mark line in the pushed event. There is no good solution on the Internet. So I made a perl script to parse the org file and get out every event and time then import into osx Calendar by calling relative apple-script&amp;nbsp;command.&lt;/p&gt;
&lt;p&gt;It will automaticly import an event into osx calendar when you assigned a time to it. If your i phone is connected into cloud, it will of course alert your automaticly. And you can check your schedule on both org agenda and your iphone and clendar on the &lt;span class="caps"&gt;OSX&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;The logic is&amp;nbsp;simple:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
1. When emacs store the org file in org mode or org agenda, call the script
2. The script will scan the org file and try to import the files into calendar one by one
3. When it finish scan it will store the added event time into time.txt
4. When any time is added, the event started with the same time will not be added
&lt;/pre&gt;
&lt;p&gt;To use the script, you should added this &lt;a class="reference external" href="https://github.com/caoyuanqi/scripts/blob/master/_org_file_handler"&gt;script&lt;/a&gt; into your &lt;span class="caps"&gt;PATH&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Added this line into your emacs setting files, there will add a hook and call the script every time you store any org&amp;nbsp;file&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;add-hook&lt;/span&gt; &lt;span class="ss"&gt;&amp;#39;after-save-hook&lt;/span&gt;
&lt;span class="o"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;or&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;eq&lt;/span&gt; &lt;span class="nv"&gt;major-mode&lt;/span&gt; &lt;span class="ss"&gt;&amp;#39;org-mode&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;eq&lt;/span&gt; &lt;span class="nv"&gt;major-mode&lt;/span&gt; &lt;span class="ss"&gt;&amp;#39;org-agenda-mode&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;progn&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;setq&lt;/span&gt; &lt;span class="nv"&gt;org-add-event-command&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;concat&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;&amp;lt; &amp;quot;&lt;/span&gt; &lt;span class="nv"&gt;buffer-file-name&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;call-process-shell-command&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;_org_file_handler&amp;quot;&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="nv"&gt;org-add-event-command&lt;/span&gt;&lt;span class="p"&gt;))))))&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You should decide a way for the time.txt this will store all time stamp you already imported in the&amp;nbsp;script&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="nv"&gt;$time_file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;where/your/want/to/put/the/time.txt&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Most importantly, you should arrange your org file into this style, because this script will scan the * header as the calendar it want to insert the&amp;nbsp;event:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
* calendar name in osx calendar
** Other thing
&lt;/pre&gt;
&lt;p&gt;For example, if I want to insert an event named: exercise into a calendar named life in osx calendar, I will make this even like&amp;nbsp;below:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
* life
** exercise
SCHEDULED: &amp;lt;2015-01-09 Fri 13:00-14:00&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Because it is a script I made almost 1 year ago and it works very well for me, there are some thing need to do better, but if there is no big problem, I won&amp;#8217;t fix it, because maybe I will rewrite the script in Python in object oritential style. So if there are any interesting ideas to let me&amp;nbsp;know?&lt;/p&gt;
&lt;pre class="literal-block"&gt;
A. The calendar have to restart to make the events be refreshed. (I think it is apple's problem)
B. time.txt maybe should be clean up, but it is not a big issue for us
C. I tell the application every time I want to add an event, I should be tell once and add many, but I am really lazy to change that. ^-^
&lt;/pre&gt;
&lt;p&gt;I think it will work fine for you.&amp;nbsp;enjoy!&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Yuanqi Cao</dc:creator><pubDate>Fri, 09 Jan 2015 00:00:00 +1100</pubDate><guid>tag:caoyuanqi.github.io,2015-01-09:orgtoosxcalendar</guid><category>perl</category><category>emacs</category><category>org mode</category></item><item><title>Hello world</title><link>http://caoyuanqi.github.io/hello%20world</link><description>&lt;p&gt;Hi, 2015 and the&amp;nbsp;world&lt;/p&gt;
&lt;p&gt;This is my personal website, and I treat it like a personal hacking note and some organization of some technical thinking. So I will keep the words simple and&amp;nbsp;focus.&lt;/p&gt;
&lt;p&gt;I think I should get some wish in the new&amp;nbsp;year:&lt;/p&gt;
&lt;blockquote&gt;
Expand Down
2 changes: 2 additions & 0 deletions hello world.html
Expand Up @@ -111,6 +111,8 @@ <h1><a href="http://caoyuanqi.github.io/hello world"> Hello&nbsp;world <small>
<hr/>
<nav>
<ul class="articles_timeline">

<li class="next_article"><a href="http://caoyuanqi.github.io/orgtoosxcalendar" title="Next: Import org agenda into osx&nbsp;calendar">Import org agenda into osx&nbsp;calendar</a> »</li>
</ul>
</nav>
</aside>
Expand Down
6 changes: 6 additions & 0 deletions index.html
Expand Up @@ -88,6 +88,12 @@ <h1 id="about-me">About me</h1>
<header>
<h1 id="recent-posts">Recent Posts <a id="allposts" href="http://caoyuanqi.github.io/archives.html">all posts</a></h1>
</header>
<ul class="list-all-articles">
<li>
<a href="http://caoyuanqi.github.io/orgtoosxcalendar">Import org agenda into osx&nbsp;calendar </a>
<time pubdate="pubdate" datetime="2015-01-09T00:00:00+11:00">Jan 09, 2015</time>
</li>
</ul>
<ul class="list-all-articles">
<li>
<a href="http://caoyuanqi.github.io/hello world">Hello&nbsp;world <small> from pelican </small> </a>
Expand Down

0 comments on commit 0c6a73d

Please sign in to comment.