144 lines
5.1 KiB
Markdown
144 lines
5.1 KiB
Markdown
+++
|
|
title = "Calendar Organization with Org"
|
|
author = ["Elia el Lazkani"]
|
|
date = 2021-05-30
|
|
lastmod = 2021-05-31
|
|
tags = ["emacs", "org-mode", "calendar", "organization"]
|
|
categories = ["text-editors"]
|
|
draft = false
|
|
+++
|
|
|
|
I have been having _some_ issues with my calendar. Recurring stuff have been going out of wack for some reason. In general, the setup I've had for the past few years have now become a problem I need to fix.
|
|
|
|
I decided to turn to my trusted _emacs_, like I usually do. _Doom_ comes bundled with something. Let's figure out what it is and how to configure it together.
|
|
|
|
<!--more-->
|
|
|
|
|
|
## Calendar in Emacs {#calendar-in-emacs}
|
|
|
|
I dug deeper into _Doom_'s _Calendar_ module and I found out that it is using [calfw](https://github.com/kiwanami/emacs-calfw).
|
|
|
|
I went to _GitHub_ and checked the project out. It's another emacs package, I'm going to assume you know how to install it.
|
|
|
|
Let's look at the configuration example.
|
|
|
|
```emacs-lisp
|
|
(require 'calfw-cal)
|
|
(require 'calfw-ical)
|
|
(require 'calfw-howm)
|
|
(require 'calfw-org)
|
|
|
|
(defun my-open-calendar ()
|
|
(interactive)
|
|
(cfw:open-calendar-buffer
|
|
:contents-sources
|
|
(list
|
|
(cfw:org-create-source "Green") ; orgmode source
|
|
(cfw:howm-create-source "Blue") ; howm source
|
|
(cfw:cal-create-source "Orange") ; diary source
|
|
(cfw:ical-create-source "Moon" "~/moon.ics" "Gray") ; ICS source1
|
|
(cfw:ical-create-source "gcal" "https://..../basic.ics" "IndianRed") ; google calendar ICS
|
|
)))
|
|
```
|
|
|
|
That looks like an extensive example. We don't need all of it, I only need the part pertaining to _org_.
|
|
|
|
|
|
## Configuration {#configuration}
|
|
|
|
The example looks straight forward. I'm going to keep _only_ the pieces I'm interested in. The configuration looks like the following.
|
|
|
|
```emacs-lisp
|
|
(require 'calfw-cal)
|
|
(require 'calfw-org)
|
|
|
|
(defun my-blog-calendar ()
|
|
(interactive)
|
|
(cfw:open-calendar-buffer
|
|
:contents-sources
|
|
(list
|
|
(cfw:org-create-file-source "Blog" "~/blog.org" "Orange") ; our blog organizational calendar
|
|
)))
|
|
```
|
|
|
|
That was easy. but before we jump to the next step, let's talk a bit about what we just did.
|
|
We, _basically_, created a new function which we can call later with `M-x` to open our calendar.
|
|
We configured the function to include the _org_ files we want it to keep track of.
|
|
In this case, we only have one. We named it **Blog** and we gave it the color **Orange**.
|
|
|
|
|
|
## Creating our org file {#creating-our-org-file}
|
|
|
|
After we have configured `calfw`, we can create the `blog.org` file.
|
|
|
|
```org
|
|
#+TITLE: Blog
|
|
#+AUTHOR: Who
|
|
#+DESCRIPTION: Travels of Doctor Who
|
|
#+TAGS: organizer organization calendar todo tasks
|
|
|
|
* Introduction
|
|
|
|
This is the /calendar/ of *Dr Who* for the next week.
|
|
|
|
* Travels
|
|
|
|
** DONE Travel to Earth 1504
|
|
CLOSED: <2021-07-03 za 09:18> SCHEDULED: <2021-07-02 vr>
|
|
|
|
- CLOSING NOTE <2021-07-03 za 09:18> \\
|
|
The doctor already traveled to earth /1504/ for his visit to the /Mayans/.
|
|
|
|
A quick visit to the /Mayan/ culture to save them from a deep lake monster stealing all their gold.
|
|
|
|
** TODO Travel back to Earth 2021
|
|
SCHEDULED: <2021-07-04 zo>
|
|
|
|
Traveling back to earth 2021 to drop the companion before running again.
|
|
|
|
** TODO Travel to the Library
|
|
SCHEDULED: <2021-07-04 zo>
|
|
|
|
The doctor visits the /Library/ to save it again from paper eating bacteria.
|
|
|
|
** TODO Travel to Midnight
|
|
SCHEDULED: <2021-07-08 do>
|
|
|
|
The doctor visits *Midnight* in the /Xion System/.
|
|
|
|
** TODO Travel to Earth 2021
|
|
SCHEDULED: <2021-07-09 vr>
|
|
|
|
Snatching back the companion for another travel advanture.
|
|
```
|
|
|
|
|
|
## Let's get the party started {#let-s-get-the-party-started}
|
|
|
|
Now that we have everything set into place. We can either _reload_ _emacs_ or simply run the code snippet that declares _our_ function.
|
|
|
|
Next step is checking out if it works. Let's run `M-x` then call our function `my-blog-calendar`.
|
|
|
|
{{< figure src="/ox-hugo/01-calendar-overview.png" caption="Figure 1: Calendar organization with Org" target="_blank" link="/ox-hugo/01-calendar-overview.png" >}}
|
|
|
|
If we go to a date with `hjkl` and hit `return` or `enter`, we get to see what we have to work with.
|
|
|
|
{{< figure src="/ox-hugo/02-calendar-day-overview.png" caption="Figure 2: Calendar day overview" target="_blank" link="/ox-hugo/02-calendar-day-overview.png" >}}
|
|
|
|
We can take a look at closed items with _time_ too.
|
|
|
|
{{< figure src="/ox-hugo/03-calendar-day-closed-item-overview.png" caption="Figure 3: Calendar day with closed item" target="_blank" link="/ox-hugo/03-calendar-day-closed-item-overview.png" >}}
|
|
|
|
That looks pretty nice.
|
|
|
|
|
|
## Conclusion {#conclusion}
|
|
|
|
I thought it was going to be more extensive to configure the calendaring feature in _emacs_.
|
|
I couldn't be further away from the truth.
|
|
Not only was it a breeze to configure, it was even easier to create the calendar and maintain it.
|
|
If you are already familiar with _org_, then you're already there.
|
|
Point the calendar to your _org_ file, _iCal_ file or even _Google Calendar_ link and you're all set.
|
|
The bottom line of working with _org_ is the ease of use, to me.
|
|
If you already use it to organize some aspects of your life, you can just as easily create calendars for all these events.
|