Org-mode Summary v0.91

by Logan Won-Ki Lee

logan.wonki.lee@gmail.com

Table of Contents

1 Basic operations

  • S-tab for global open/collapse of all headings.
  • tab for local open/collapse of a heading.
  • A-<arrow> for moving an item up/down and also change indentation.

Also note that C-x C-v RET reloads file.

1.1 Moving an item

Use A-up, A-down to move an item up/down.

1.1.1 Example

  • two, use A-up, A-down to move me
  • one
  • three

1.2 Changing indentation

Use A-left, A-right on a heading to change indentation level.

1.2.1 Example, use A-left, A-right here

1.3 Reenter TODO or checklist

You can enter a new TODO or a new checklist by typing S-A-enter.

1.3.1 TODO A todo, S-A-enter me.

1.3.2 TODO This is the result.

  • [ ] A checklist. S-A-enter me.
  • [ ] This is the result.

2 Operations on TODO item

First set TODO sequence like this: #+SEQ_TODO: TODO(t) NEXT(n) WAITING(w) | CANCELLED(C) DONE(d). Put cursor on it and C-c C-c to take effect.

2.1 Changing state of TODO item

C-c C-t to toggle through TODO states. Choose one.

When automatic logging is set up each state change can be logged to LOGBOOK.

2.1.1 Example

Let's toggle the following TODO item to NEXT then to WAITING and finally to DONE.

2.1.2 DONE Example TODO to toggle through with C-c C-t

CLOSED: [2020-10-02 Fri 10:54]

  • State "DONE" from "WAITING" [2020-10-02 Fri 10:54]
    Finally to DONE.
  • State "WAITING" from "NEXT" [2020-10-02 Fri 10:54]
    Successfully transitioned to WAITING
  • State "NEXT" from "TODO" [2020-10-02 Fri 10:52]
    Successfully transitioned to NEXT

org-log-done variable defines the behavior when a TODO item is set to DONE. For example, if the variable is set to 'time' it registers a timestamp when the item is set to DONE.

2.2 Setting schedule and deadline

You set schedule on a TODO item by C-c C-s.

Deadline is set on a TODO item by C-c C-d.

Let's try them out.

2.2.1 TODO Example task. C-c C-s to schedule it to today and C-c C-d to set deadline to a day after.

DEADLINE: <2020-10-03 Sat> SCHEDULED: <2020-10-02 Fri>

2.3 Miscellaneous stuff

If you S-left, S-right on a TODO item, this will traverse the states from list(eg. TODO -> WAITING).

2.4 Basic stuff

3 Checklists

Here is an example checklist. The parent TODO has a counter tallying total number of checked sub-items. You toggle checklist item by C-c C-c.

3.1 Example. Conquer the world! [1/3]

  • [ ] Win the first battle.
  • [ ] Win the second battle.
  • [X] Win the rest! C-c C-c to toggle checklist.

4 Tags

Tag is attached to heading by C-c C-q. You can 'tab' to enter custom tag.

4.1 Example, Billy lied! C-c C-q   LIE

You can see Billy is tagged 'LIE'.

5 Drawer

We create a drawer by wrapping the content with :ANY_NAME: and :END:.

Here's a drawer I named :inventory::

I have the following tools:

  • 2x screws
  • 1x electric saw
  • 10 packs of nails

Of course, you can open/close a drawer by TAB.

6 Quick notes

You start a quick note by C-c C-z and finish with C-c C-c.

If org-log-into-drawer is non-nil, quick notes are inserted inside a drawer. Particularly, if it is set to LOGBOOK, all quick notes will be inserted inside a drawer named LOGBOOK.

You can have multiple LOGBOOKs in the same org file. If you place the cursor at a particular LOGBOOK and create a quick note, the note will be placed inside that LOGBOOK.

Let's try that out. I have written a LOGBOOK below and I have placed the cursor on it then created a new quick note C-c C-z. See the content by TAB.

  • Note taken on [2020-10-02 Fri 15:32]
    This is a quick note C-c C-z. It is placed inside the LOGBOOK that the cursor was on.

Here's the content:

  • Note taken on [2020-10-02 Fri 15:32]
    This is a quick note C-c C-z. It is placed inside the LOGBOOK that the cursor was on.

7 Agenda

Before you can use agenda with current file, file needs to be added to org-agenda-files. This can be done within the current file by C-c [. This adds it to org-agenda-files.

C-c ] removes current file from the list.

After this, you may invoke agenda by C-c a. Pressing 'a' from menu enters Agenda for current week or day. This lists all non-closed TODO items inside chronological framework. It lists items for each day in a week.

From inside 'f' or 'b' to move forward/backward a week.

S-f toggles follow mode. In follow mode the TODO item you select from agenda will be followed from within your org file. It highlights the selected item that you follow from agenda.

C-c C-t on a selected TODO item from inside agenda view toggles the state, like you would from inside an org mode document. You can mark a TODO item DONE from within agenda view this way.

'q' to quit agenda view.

7.1 Repeating tasks

You can manually edit the timestamp of a scheduled TODO item to define a repeating task.

For example, let's create a dummy TODO item and edit its timestamp to create a repeating task. We want to wash a car every friday.

7.1.1 TODO Weekly washing car every Friday from today.

SCHEDULED: <2020-10-09 Fri ++1w>

LAST_REPEAT: [2020-10-02 Fri 12:01]
  • State "DONE" from "TODO" [2020-10-02 Fri 12:01]
    See what happens after I wash my car for the first time.

Here is the initial edited timestamp: <2020-10-02 Fri ++1w>. After marking it as DONE, it is automatically rescheduled to <2020-10-09 Fri ++1w> which is next Friday after today.

++1w means 'repeat this task every week from today. Double + prefix means only future tasks are registered. 'w' means 'weekly'.

Here is the snapshot of what agenda looks like for this week:

Week-agenda (W40):
Monday     28 September 2020 W40
Tuesday    29 September 2020
Wednesday  30 September 2020
Thursday    1 October 2020
Friday      2 October 2020
  org-mode-summary:Scheduled:  TODO Example task. C-c C-s to schedule it to today and C-c C-d to set deadline to a day after.
  org-mode-summary:Scheduled:  TODO Weekly washing car every Friday from today.
  org-mode-summary:In   1 d.:  TODO Example task. C-c C-s to schedule it to today and C-c C-d to set deadline to a day after.
Saturday    3 October 2020
  org-mode-summary:Deadline:   TODO Example task. C-c C-s to schedule it to today and C-c C-d to set deadline to a day after.
Sunday      4 October 2020

Note that this is when the TODO item is not rescheduled.

Here is view for two weeks after:

Week-agenda (W42):
Monday     12 October 2020 W42
Tuesday    13 October 2020
Wednesday  14 October 2020
Thursday   15 October 2020
Friday     16 October 2020
  org-mode-summary:Scheduled:  TODO Weekly washing car every Friday from today.
Saturday   17 October 2020
Sunday     18 October 2020

As you can see 'org-mode-summary:Scheduled: TODO Weekly washing car every Friday from today.' is registered every Friday from this week onwards ;)

Here's another example.

7.1.2 TODO Lift weights every other day from today. Set deadline to next week Friday.

SCHEDULED: <2020-10-02 Fri ++2d>

Here timestamp is <2020-10-02 Fri ++2d>. It says we want to lift weigths every other day from today. '2d' means every two days.

8 Advanced agenda

We can filter the items that are shown inside agenda.

We can filter by matching tags for example. For this end, let's create some headings and TODOs with tags attached. We can attach a tag by C-c C-q.

8.1 George told the truth.   TRUTH

8.2 Paul lied.   LIE

8.3 John lied.   LIE

8.4 Sarah lied.   LIE

8.5 David didn't lie.   TRUTH

8.6 Bot tells both the truth and lies!   LIE TRUTH

8.7 Demo

There we go!

Let's filter headings with TRUTH tag attached. We do this by entering C-c a m then entering 'TRUTH'. The result is:

  • George told the truth.
  • David didn't lie.
  • Bot tells both the truth and lies!

Now filter headings with LIE tag attached. We do this by entering C-c a m then entering 'LIE'. The result is:

  • Paul lied.
  • John lied.
  • Sarah lied.
  • Bot tells both the truth and lies!

Lets filter headings with TRUTH or LIE tag attached. C-c a m then enter 'LIE|TRUTH'. The result is:

  • George told the truth.
  • Paul lied.
  • John lied.
  • Sarah lied.
  • David didn't lie.
  • Bot tells both the truth and lies!

Basically every item.

Finally, lets filter headings that are both 'LIE' and 'TRUTH'. We do this by C-c a m then 'LIE+TRUTH'. The result is just one:

  • Bot tells both the truth and lies!

Additionally, we can filter just TODO items excluding those that are just headings. Let's try it out.

8.8 TODO I shouldn't lie so often.   LIE

Let's filter just this TODO item that is already marked LIE. To do this C-c a M then enter 'LIE'. This gives just:

  • TODO I shouldn't lie so often.

All is good!

To search for keywords do C-c a s then a keyword to search for.

To create a custom filter do C-c a C.

9 Inserting code snippet

  1. Write #+BEGIN_SRC language
    • for example #+BEGIN_SRC js for javascript.
  2. Write #+END_SRC
  3. Enter C-c ' to write code then C-c ' again to finish.

9.1 Example

function me () {
    this.name = 'Me';
    this.age = 38;
}

me.prototype = {
    greet: function () {
        console.log("Hi I'm", this.name, "of age", this.age);
    }
}

10 Refiling

Refiling is moving/copying an item to a different file/heading.

  • C-c C-w moves the item.
  • C-c A-w copies the item.

Items that can be copied or moved are headings.

You may need to set up org-refile-targets, org-refile-use-outline-path, and org-refile-allow-creating-parent-nodes.

10.1 Example

To copy PAYLOAD below to Copy here, place cursor at it, C-c A-w then enter org-mode-summary.org/Refiling/Copy here.

10.1.1 PAYLOAD copy by C-c A-w

10.2 Copy here

10.2.1 PAYLOAD copy by C-c A-w

11 Exporting an org file

  • C-c C-e then choose from menu.

12 Archiving

Archiving is moving a heading item to potentially a different file/heading. It is like refiling but this time we are purposely archiving it.

First we need to set up #+archive. This sets org-archive-location variable.

Let's investigate the syntax of #+archive.

The basic form of it is #+archive: FILENAME::HEADING. If FILENAME contains %s this is translated as current file. If FILENAME is ommitted it is %s. HEADING is normal heading like * heading or ** heading.

datetree arranges archived items inside a date tree(eg. year 2020/month jan/day 20/time 1300/item).

Let's look at some examples.

  1. #+archive: %s_archived::
    • Let's say current file name is 'mylife'.
    • All archived items will be exported to file named 'mylife_archived'.
  2. #+archive: ::** Archived stuff
    • All archived items will be exported to the current file under heading ** Archived stuff.
  3. #+archive: %s_archived::** Archived stuff
    • Let's assume the current file as 'mylife' again.
    • All archived itms will be exported to mylife_archived/** Archived stuff. In other words, they will be exported to mylife_archived file under the heading ** Archived stuff.

To archive a heading, place the cursor on it then C-c C-x C-s or C-c C-x C-a. They seem to do the same thing.

For demonstration, we have set #+archive: ::/** Archived stuff on this document. We do C-c C-x C-s on * Children of Abraham.

12.0.1 Children of Abraham

  • Issac
  • Ishmael
  • Midian

12.1 Archived stuff

12.1.1 Children of Abraham

ARCHIVE_TIME: 2020-10-02 Fri 16:22
ARCHIVE_FILE: d:/Documents/org-mode-stuff/org-mode-summary.org
ARCHIVE_OLPATH: Archiving
ARCHIVE_CATEGORY: org-mode-summary
  • Issac
  • Ishmael
  • Midian

You can see * Children of Abraham and its content are moved under * Archived stuff.

12.2 Traversing through a list of TODOs and choosing non-open items for archiving

Non-open TODO items are things like DONE and CANCELLED.

There is a way to traverse through all non-open TODO items and archive them in succession. C-u C-c C-x C-s will do this.

Let me demonstrate.

12.2.1 Get rid of non-open TODOs C-u C-c C-x C-s

  1. DONE one (asks to archive)
  2. TODO two
  3. CANCELLED three (asks to archive)
  4. TODO four

12.2.2 Explanation

C-u C-c C-x C-s points out DONE item 'one' and CANCELLED item 'three' from the list and asks to archive them. It skips TODO items that are not closed.

13 Automatic logging of status changes

You first define #+SEQ_TODO.

Here's an example: #+SEQ_TODO: NEXT(n@/!) TODO(t/!) | DONE(d@) CANCELLED(c@).
C-c C-c on it to make it effective on this document.

Let's explain.

  1. TODO: a todo item defined in SEQ_TODO.
  2. t: as usual, hotkey assigned to that TODO state.
  3. @: log a timestamp and a note when TODO state is enetered.
  4. !: log a timestamp when TODO state is left.

Addition to these, we have:

  1. org-log-done: action to do when TODO is DONE.
  2. org-log-reschedule: action to do when TODO is rescheduled. These two are separate from TODO(t@/!) defined above.

13.1 Example TODO state changes and their effects

This is using #+SEQ_TODO defined above.

  • TODO -> NEXT: prompts for a NEXT note with a timestamp and adds it to LOGBOOK.
  • NEXT -> CANCELLED: prompts for a CANCELLED note with a timestamp and adds it to LOGBOOK.
  • CANCELLED - > TODO: does nothing. Test this!
  • TODO -> DONE: prompts for a DONE note with a timestamp and adds it to LOGBOOK.
  • CANCELLED -> NEXT: prompts for a NEXT note with a timestamp and adds it to LOGBOOK.

Here the LOGBOOK is placed under the TODO item.

13.2 org-log-done and org-log-reschedule

  1. org-log-done is action when TODO is DONE.
    • if value is nil, do nothing but just change state to DONE.
    • if value is time, add a timestamp.
    • if value is note, add a note and timestamp.
  2. org-log-reschedule
    • if value is nil, do nothing but just reschedule.
    • if value is time, add a timestamp when reschedule.
    • if value is note, add a note and timestamp.

14 Org capture templates

Org capture template is a template for inserting structured text. We use template for dynaimcally filling the text with live information like prompting for text and current date/time.

We add new templates by customizing org-capture-templates variable.

We insert a template by M-x org-capture.

It is useful to configure org-directory variable beforehand so we can just type file name without having to specify full path (when configuring org-capture-templates).

It is useful to set 'multi-key description'. For example, if you want your menu to look like 'Favorite sports(f)' -> 'Rugby(r)' you set first, multi-key description for 'Favorite sport' with key f, then set 'Template entry' for 'Rugby' with key fr. Note this is not just key r but fr.

14.1 Example template. Football match score

Here is configuration details for football match score template.

Firstly, configuration from org-capture-templates variable defining the football match score template.

football score template:

template entry:
keys: s
description: football match score
capture type: org entry
target location: 
	file & outline path:
		filename: literal: org-mode-summary.org
		headline: Org capture templates
		headline: Example template. Football match score
		headline: Demo
template:
	file:
		template file: test-score-template.org

Now, template code itself which is stored in test-score-template.org file.

* football match
date %U
%^{team 1} vs %^{team 2}
score %^{score}
%?

14.1.1 Explanation

  • %U translates to current date/time.
  • ^{str} translates to str: _ where entered _ is inserted.
  • %? places cursor at this position.

You can see more information by C-h v RET org-capture-templates RET.

14.1.2 Demo

Here is the demo output of inserting the football score template on to this org file.

  1. football match

    date [2020-10-12 Mon 17:58]
    Netherlands vs France
    score 2:1
    This score brief was inserted using a template.

14.2 More examples

14.2.1 Choose my fav color!

* My fav color
%^{Choose your color|black|white|red|blue|orange}
%?

14.2.2 Colors

  1. My fav color

    orange
    Hi trump!

14.2.3 Set a SMART goal!

* TODO %^{SMART goal title}
:PROPERTIES:
:specific: %^{specific}
:measurable: %^{measurable}
:attainable: %^{attainable}
:relevant: %^{relevant}
:time-bound: %^{time-bound}
:END:
%?

14.2.4 SMART goals

  1. TODO Remove Trump from oval office
    specific: Get Trump out of WH
    measurable: All his staff and furniture removed for Biden's
    attainable: When all votes are certified he is gone
    relevant: Smooth transition to Biden admin
    time-bound: 20th January
    

    Cry baby Trump out!

15 PROPERTIES drawer

We can match custom properties from agenda view.

Consider the following example. We will match it from agenda view by the value of :FAV: property.

15.1 My favorite language

FAV: javascript
RATING: 10

We have defined our favorite programming language as javascript. So, let's now search for it from within agenda view. M-x org-agenda m then FAV="javascript". It successfully matches and 'My favorite language" can be seen from agenda view.

Let's define our less favorite language.

15.2 My less favorite language

FAV: java
RATING: 6

Let's match FAV="java". It successfully matches "My less favorite language".

How about matching by :RATING:? Let's do that.

Try matching RATING<10. The behavior of this match is unexpected. It gives a heap of matched items. Why? It's because RATING<10 matches those items with RATING<10 plus those that don't have the property RATING. To fix this we should instead match RATING>0+RATING<10. This matches "My less favorite language" as expected.

Let's do one more match. Try matching RATING>6. Will it match "My favorite language" as expected? Yes it does!

If you placed :FAV: and :RATING: properties outside of :PROPERTIES: drawer they will not turn up in agenda view matches!

Lastly, you can disable logging by adding :LOGGING: nil inside :PROPERTIES: drawer.

16 Archiving to different files

You can confrigure archiving by #+ARCHIVE: file :: heading as we have learned earlier. But there is another way. You can do the same by defining :ARCHIVE: property.

It is defined with the same syntax. Here's an example: :ARCHIVE: track-books.org::* Read books.

You define the ARCHIVE property on the parent header and all the children items inherit it.

To archive a sub-item, place cursor on it and C-c C-x C-a.

16.1 Examples

16.1.1 Books

FAV_AUTHOR: trump
ARCHIVE: ::* Read books
  1. TODO Art of the Deal - Donald Trump C-c C-x C-a here.
    • this TODO item will be moved under * Read books heading on this file.

17 Ordered tasks

Ordered tasks can't be completed without completing them in order.

To create ordered tasks you must first define a top-level heading and add sub-items that are TODO items below it.

Place cursor at the top-level item and C-c C-x o toggles that all sub-items are ordered or not ordered. This action inserts :ORDERED: property and set to true like this: :ORDERED: t.

When this is set, you can't close the next task until the previous task is closed.

We may need to customize org-enforce-todo-dependencies and org-track-ordered-property-with-tag to true.

17.1 Example

17.1.1 PROJ Build a house C-c C-x o here.   ORDERED

ORDERED: t
  1. TODO Build the basement

    SCHEDULED: <2020-10-13 Tue>

  2. TODO Build the ground floor

    SCHEDULED: <2020-10-14 Wed>

  3. TODO Build the roof

    SCHEDULED: <2020-10-15 Thu>

17.2 Explanation

Note that trying to DONE the parent TODO is blocked initially because its children TODOs are not all closed.

Also trying to CANCELLED the second child TODO is blocked by the first child TODO and etc.

Both DONE and CANCELLED are considered 'closed' by our current set up.

If you set org-agenda-dim-block-tasks to true, it will dim tasks that you cannot perform (because of dependency).

If you want to enforce dependency rules on checkbox as well, set org-enforce-todo-checkbox-dependencies to true.

18 Timers

With timer, you can count down or measure how long time has passed since timer was started.

You can stop/resume timer and you can also insert timestamps.

18.1 count down timer

  • Start count down timer byo C-c C-x ;
  • Try stop/resume timer.
    • Pause/resume with C-c C-x ,
  • Try inserting timestamps.
    • Try inserting simple timestamp C-c C-x .
    • Try inserting descriptive timestamp C-c C-x -
  • Finally, stop timer C-u C-c C-x ,

18.1.1 Example. Nuclear meltdown in 60 seconds!

  • Start count down timer C-c C-x ;
  • Try stop/resume timer C-c C-x ,
  • Try inserting simple timestamp C-c C-x .
  • 0:00:52 Meltdown soon
  • 0:00:39 Meldown sooner
  • 0:00:12 Meltdon imminent

18.1.2 Example 2. Nuclear meltdown in 60 seconds!

0:00:48
Meltdown soon; you can A-RET to insert live timestamp.
0:00:28
Meltdown sooner
0:00:23
Meltdown imminent
(no term)
Try inserting descriptive timestamp C-c C-x -

18.2 count up timer

You can also set up 'count up' timer. This is a normal timer that measures how much time has passed. C-c C-x 0

You can start timing from zero which is the default, or you can specify an offset. For example, you can start the timer from 1:00 minute onwards. C-u C-c C-x 0 1:00 RET

18.2.1 with time offset

You can specify an offset. For example C-u C-c C-x 0 1:00 RET sets the offset to 1 minute.

18.3 insert timestamp

Like with count down timer that we have already covered, you can insert timestamp from 'count up' timer.

18.3.1 simple timestamp

  1. Example. IQ test. Let's measure how long Bob has taken for each section.

    0:00:15 First section done
    0:00:31 Second section done
    0:00:39 He forfeited

18.3.2 descriptive timestamp

  1. Example 2. IQ test. Bob wants to resume the test from 40 seconds onwards.
    0:00:48
    Bob resumed his test
    0:00:54
    He finished section three
    0:01:05
    He will resume tomorrow
    • Here we have set the offset to 40 seconds C-u C-c C-x 0 0:40 RET

18.4 pause/resume/stop timer

You can pause/resume timer by C-c C-x ,
You can stop timer by C-u C-c C-x ,

19 Clocking (aka time tracking)

Clocking (tracking) is a function that measures how long a task took to reach completion for you. You simply put cursor on a heading then clock in C-c C-x i and some time later clock out C-c C-x o. This inserts clocking information into a drawer beneath the heading being tracked.

If you set org-clock-into-drawer to "CLOCKING" for instance, this will save clocking information to a drawer :CLOCKING: beneath the header that is being tracked.

Clocking measures a task in hours/minutes not seconds.

Once you clock in on a task, you can leave it and do other things in other parts of the document. Then C-c C-x C-j jumps you back to the tracked task (it places the cursor on the tracked task).

You can manually edit CLOCK timestamps and recalculate the duration by first editing the time(s) then C-c C-c on it.

You can cancel the clock C-c C-x C-q.

19.1 restarting

You can restart the current clocked task C-c C-x C-x. You can choose from list C-u C-c C-x C-x.

You can switch between different clocked tasks. C-u C-c C-x C-i allows you to switch between different clocked tasks and restart the clock.

You can clock out the current clocked task C-c C-x C-o.

  • What is the difference between C-u C-c C-x C-x and C-u C-c C-x C-i?
    • Nothing as I can fathom…

19.2 other stuff

C-c C-x C-d shows accumulated duration for each clocked heading. This turns on display clocking information. Once this is on, it shows accumulated duration for each clocked items.

For example:

Task A
4 min C-c C-x C-d
sub task 1
1 min
sub task 2
2 min
sub task 3
1 min
Task B
5 min …

C-c C-c turns display clocking information off (you would have guessed C-c C-x C-d again would do it but yeh).

19.3 Demo

19.3.1 Task A

  • Start clock first C-c C-x C-i
  • Restart task A after starting Task B C-u C-c C-x C-x

19.3.2 Task B

  • Start clock after Task A. C-c C-x C-i
    • This will clock out Task A.
  • Restart task B after restarting task A C-u C-c C-x C-x
  • Clock out task B C-c C-x C-o
  • Try turning on display clocking info to get aggregate durations.
    • Turn on C-c C-x C-d
    • Turn off C-c C-c

19.3.3 Notes

Try out restarting without menu C-c C-x C-x when switching between clocked tasks. Might be quicker.

20 Column view

Column view is very useful when you want to inspect values of PROPS. It lists the items in a table, with each column a PROP.

You can define columns in two ways. Either, #+COLUMNS or define it inside PROPERTIES/COLUMNS.

20.1 Example. Books

Set :COLUMNS: inside PROPERTIES as

:PROPERTIES:
:COLUMNS: %8TODO(ToDo) %40ITEM(Book) %15GENRE %5PAGES(Pages)
:END:

We define :COLUMNS: on parent heading and PROPS for display on a table within each item beneath the parent heading. For example,

20.1.1 TODO David Allen - Getting Things Done

PAGES: 352
GENRE: Management

You can see that :PAGES: and :GENRE: are referenced inside :COLUMNS: on the parent heading.

Show column view C-c C-x C-c

Quit Q.

20.1.2 Demo

  1. Books Demo C-c C-x C-c for column view
    COLUMNS: %8TODO(ToDo) %40ITEM(Book) %15GENRE %5PAGES(Pages)
    
    1. DONE Art of the Deal
      PAGES: 200
      GENRE: Business
      
    2. TODO Art of Deception
      PAGES: 333
      GENRE: Hacking
      
    3. DONE The C language
      PAGES: 600
      GENRE: Computers
      
    4. TODO Emacs Book
      PAGES: 444
      GENRE: Computers
      

20.1.3 Capturing column view

Do org-columns-insert-dblock to capture a column view. This converts column view to a string and inserts the string to the org file.

ToDo Book GENRE Pages
  Books Demo C-c C-x C-c for column view    
DONE Art of the Deal Business 200
TODO Art of Deception Hacking 333
DONE The C language Computers 600
TODO Emacs Book Computers 444

21 Effort estimates

You can use column view to insert predefined values into a column, like pre-set durations or ratings like poor, good, excellent.

These will be inserted into PROPERTIES drawer of the item selected as property.

Example,

21.0.1 A task

RATING: good

Try defining a custom PROP #+PROPERTY: MyProp_ALL A B C then try inserting them into a task in column view.

21.1 Rating

First define a new PROP called Rating. Remember to C-c C-c it. Something like #+PROPERTY: Rating_ALL # ## ### #### #####.

Then populate tasks. C-c C-x C-c to enter column view. Put cursor on a cell under Rating and S-left, S-right to choose the rating. If you inspect the item's :PROPERTIES: you can see that :RATING: is set.

21.1.1 Books Example

COLUMNS: %8TODO(ToDo) %40ITEM(Book) %15GENRE %5PAGES(Pages) %6Rating(Rating)
  1. DONE Art of the Deal
    PAGES: 200
    GENRE: Business
    RATING: +
    
  2. TODO Art of Deception
    PAGES: 333
    GENRE: Hacking
    RATING: ++
    
  3. DONE The C language
    PAGES: 600
    GENRE: Computers
    RATING: ++++
    
  4. TODO Emacs Book
    PAGES: 444
    GENRE: Computers
    RATING: +++
    

21.2 Example. Assign teachers to classes

We are defining Teachers prop like this: #+PROPERTY: Teachers_ALL gerald hawking newton darwin gauss.

21.2.1 Classes C-c C-x C-c

COLUMNS: %40ITEM(Class) %15TEACHERS(Teachers)
  1. Biology
    TEACHERS: darwin
    
  2. Physics
    TEACHERS: hawking
    
  3. Calculus
    TEACHERS: gauss
    
  4. Statistics
    TEACHERS: newton
    
  5. PE
    TEACHERS: gerald
    

21.2.2 Notes

This confirms you can name any PROP you want, in this case Teachers are defined.

21.3 Effort

We have learned by now that column view can be used to enter pre-set values into items S-left, S-right.

Unlike the previous two examples, effort field is numeric (they are numbers not strings). So we define it a little differently in :COLUMNS:.

:COLUMNS: %5TODO(ToDo)  %40ITEM(Repair item) %10FixMyCar(Est. time){:}

{:} means add the numbers up as a sum.

21.3.1 Fix my car C-c C-x C-c

COLUMNS: %5TODO(ToDo)  %40ITEM(Repair item) %10FixMyCar(Est. time){:}
  1. TODO Fix breaks
    FIXMYCAR: 1:00:00
    
  2. DONE Fix windshield
    FIXMYCAR: 00:15:00
    
  3. DONE Fix engine
    FIXMYCAR: 00:15:00
    
  4. TODO replace oil
    FIXMYCAR: 00:30:00
    

    You can see that the total Est time is displayed at the top as 2 hrs.

22 Linking (internal)

A link is a hyperlink to a different location. An internal link can refer to a heading, an #ID or a #+name.

There are three internal targets for a link. A headline, a line marked with #+NAME:, and an item with a :CUSTOM_ID: property.

Here are the targets.

22.1 A heading, move me here

  • abc
  • 123
  • zzz

We have #+NAME: set to 'ref to fruit table'.

fruit weight
apple 20g
peach 40g
melon 100g
  • #+NAME: is only used to refer to a code block or a table.

We have #+NAME: set to 'ref to helloworld in C'.

int main() {
  printf("%s", "Hello world");
  return 0;
}

22.2 Another heading with an ID id123

CUSTOM_ID: id123

22.3 Links to the above four targets

  • 22.1 -— works!
  • 1 -— works!
  • 1 -— works!
  • 22.2 -— works!

We make a link to an id by #id123 because :CUSTOM_ID: is set to id123.

22.4 Other commands

  • Insert descriptive link with C-c C-l
  • Follow link with C-c C-o
  • Return to previous position C-c &

23 Linking (external)

Try creating an ID M-x org-id-get-create. This generated id can be accessed from outside current file. This is different from #id that we've covered in Linking (internal) section, which is accessible only from current file.

We link to the id by creating a link id:<hash>.

It seems to add files into org-id-locations-file, we customize org-id-extra-files.

I had to fix an issue by adding (require 'org-id) to .emacs file. But now it seems to work very well as expected :)

C-h i to get access to built-in elisp book.

24 Attachments

You can enter the attachment menu C-c C-a.

C-c C-a c <file> copies the file under ./data. It first creates an ID xx<hash> and stores the file under ./data/xx/<hash>.

Currently org-attach-method is set to 'copy'.

C-c C-a m moves the file under ./data/xx/<hash>.

C-c C-a o opens the attachment file. C-c C-a f opens the attachement file directory. C-c C-a d selects and deletes an attachment file. C-c C-a D deletes all attachment files.

24.1 TODO Attach me   ATTACH

ID: ed9835b9-6d1e-4683-9c13-546b0cf1206f
  • Do C-c C-a c makemoney.txt to copy it as an attachment.
  • Do C-c C-a o makemoney.txt to open the attachment.

24.2 Create a new attachment as an emacs buffer   ATTACH

ID: 12e4d175-61a2-4b6f-bd7f-a695a13e1775
  • Do C-c C-a n to add a buffer as an attachment. You can save the buffer and open it here.
  • Save the buffer as hello.txt
  • Open hello.txt C-c C-a o hello.txt

25 Priorities

You can cycle through priorities with S-up or S-down. The priority is marked [#<n>].

You can also set priority thourgh C-c ,

You can set custom priority with #+priorities <n> <m> <d> where n: highest priority, m: lowest priority and d: default. For example #+priorities 1 5 3. You can activate that setting with C-c C-c.

You could try #+priorities A E C.

25.1 task priority a to e

  • [#E]

You could try #+prioirites 1 9 5.

25.2 task prioirity 1 to 9

  • [#6]

It seems you can only have one #+priorities line per org file that is in effect at any time. The line that comes the last is in effect.

25.3 this is an important and urgent task AAA

SCHEDULED: <2020-10-28 Wed>

  • [#A]

25.4 this is least importnat CCC

SCHEDULED: <2020-10-28 Wed>

  • [#C]

25.5 this is less important BBB

SCHEDULED: <2020-10-28 Wed>

  • [#B]

When you enter agenda view C-c a the tasks are sorted by priority. For example, [#A] tasks come before [#C] tasks.

26 Tables

Name Address City Role
B. Obama 1600 Penn Ave Wash. DC POTUS
V. Putin Kremlin Moscow Rus. pres.

Delete column with A-S-left. Insert new column with A-S-right.

Move columns with A-left, A-right.

Insert horizontal line below with C-c -.

Move line with A-top, A-down.

You can also define #+CONSTANTS and #+TBLFM.

PC curr BIOS new BIOS action
A10 15 16 update
A20 15 16 update
A30 14 16 update
A40 16 16  
A50 16 16  
A60 10 16 update

The above example writes action update if curr BIOS is less than bios.

27 Exporting

org-file-apps determines the application to open files.

To export do C-c C-e.

You can set options to change the way the org file is exported.

Add a line with #+OPTIONS: with the following options.

option what it does
d:t show the contents of drawers (except :PROPERTIES:)
\n:t preserve line breaks
todo:t include TODO keywords into exported text
p:t export planing information (SCHEDULE/DEADLINE)

To turn off an option do 'option:nil'.

You can choose to export only subtree.

28 Advanced exporting

Additional options

option what it does
toc table of contents
if turned off, superscript/subscript not rendered
tags export tags
f export footnotes
\n toggle line break preservation
prop properties

You enable option by 'option:t' and turn off option by 'option:nil'.

There is an option to export 'beamer mode' which is like slides from MS Powerpoint. You can enable beamer mode by cusotmizing group org-export under 'org export backends'.

29 Publishing

You can set up so that you can 'publish' all org files in a directory to, say, public_html folder.

Call export dispatcher with C-c C-e then P for publish.

This action exports, for example, selected org files to html pages inside public_html folder.

30 Dynamic blocks

30.1 Build a clock table

You can build a clock table by C-c C-x C-r.

30.1.1 Task A Build clock table by org-clock-report.

Table 1: Clock summary at [2020-10-27 Tue 18:17]
Headline Time  
Total time 0:03  
  Task A Build clock table…   0:03
  • Start clock first C-c C-x C-i
  • Restart task A after starting Task B C-u C-c C-x C-x

Try building a clock table with nested clocks.

There are parameters like :maxlevel 4, :scope subtree, :block thismonth, :step week, and :tstart and :tend to specify a time range.

You can select date by C-c . For example, "<2020-10-27 Tue>".

30.2 Capture column view

Do org-columns-insert-dblock to capture a column view.

30.2.1 Demo

  1. Books Demo C-c C-x C-c for column view
    COLUMNS: %8TODO(ToDo) %40ITEM(Book) %15GENRE %5PAGES(Pages)
    
    1. DONE Art of the Deal
      PAGES: 200
      GENRE: Business
      
    2. TODO Art of Deception
      PAGES: 333
      GENRE: Hacking
      
    3. DONE The C language
      PAGES: 600
      GENRE: Computers
      
    4. TODO Emacs Book
      PAGES: 444
      GENRE: Computers
      
      ToDo Book GENRE Pages
        Books Demo C-c C-x C-c for column view    
      DONE Art of the Deal Business 200
      TODO Art of Deception Hacking 333
      DONE The C language Computers 600
      TODO Emacs Book Computers 444

31 Tracking habits

First enable 'habits' from org-modules.

31.1 TODO Practice guitar frequently

SCHEDULED: <2020-10-27 Tue .+2d>

STYLE: habit
LAST_REPEAT: [2020-10-27 Tue 18:57]
  • State "DONE" from "TODO" [2020-10-23 Fri 18:57]
  • State "DONE" from "TODO" [2020-10-25 Sun 18:57]
  • State "DONE" from "TODO" [2020-10-27 Tue 18:57]
  • need to write :STYLE: habit inside :PROPERTIES:.
  • .+2d/3d means practice guitar preferrably every 2 days and at least every 3 days.
  • timestamps can get long…
  • have a look at habit task from agenda view!

32 Bulk agenda actions

You can enter agenda view M-x org-agenda. Then 't' to list all TODO items.

You can then do bulk actions on them by:

key action
m Mark entry at point
u Unmark entry at point
* Mark all entries
U Unmark all entries
M-m Toggle mark at point
M-* Toggle all marks
% Mark entries based on regex

Then you call bulk action by pressing 'B'.

32.1 Archiving entries

Key Meaning
$ Archive all marked entries to their archive files
A Archive entries by moving them to their respective siblings

The difference is '$' will archive marked items to a separate archive file, whereas 'A' will move them in the same file.

Let's test this. We are gonna bulk archive the following two DONE items.

32.1.1 DONE archive this bulk #1

ARCHIVE_TIME: 2020-11-13 Fri 14:25

32.1.2 DONE archive this bulk #2

ARCHIVE_TIME: 2020-11-13 Fri 14:25
  • The above two DONE items are archived under Archive heading. C-tab to view.

32.1.3 Archive   ARCHIVE

32.2 Change and refile entries

You can do other bulk action from within agenda view.

Key Meaning
t Change TODO state
+ Add a tag to all selected entries
- Remove a tag from all selected entries
f Apply a function to marked entries. See manual for details
r Prompt for a single refile target and move all entries.
  The entries will no longer be in the agenda.
  Refresh(g) to bring them back.

32.3 Change schedules and deadlines

You can prefix the following actions with C-u B.

Key Meaning Prefix means
s Schedule entries. Remove schedule
  You can shift by ++8d for example  
d Set deadline to a specific date Remove deadline
S Scatter.  
  Distribute entries over the next N days Scatter only across weekdays

32.3.1 Known Issues

If you want to use scatter, then org-log-reschedule should not be configured to take notes, otherwise scattering is aborted with an error message after reschedulng the first entry.

33 Source code in org mode

First we need to customize variable org-babel-load-languages. This defines which languages can be evaluated inside an org file.

We surround the code block between #+BEGIN_SRC and #+END_SRC.

We execute the code block by putting cursor at it then C-c C-c.

For example,

whoami

The :results parameter shows how the results are shown.

Value Meaning
:results raw Shows raw results
:results table Shows results as a table
:results list Shows restuls as a list
:results silent Don't show results

33.1 A Graphviz example

GraphVIz is a tool to draw graphs. We surround graphviz code with #+BEGIN_SRC dot :file graph.png :cmdline -Kdot -Tpng. Then we execute similarly C-c C-c.

To use dot you need to add dot to org-babel-load-languages.

I'm guessing the dot program is for linux, but it would be interesting to learn to write graphs using graphviz.

34 Goal setting & goal tracking

This section seems important in that it is very practical. Here is the youtube.

34.1 Approach 1. Property Goals

You can add a new property with C-c C-x p. Or you could define properties by #+PROPERTY: Goal_ALL Short Medium Long None, for example.

You could also set up column view by #+COLUMNS: %58ITEM(Details) %TAGS(Context) %7TODO(TO Do) %7Goal(Goal), for example.

From within agenda view you can enter column view as well. Is it C-x C-x C-c? From there you can insert Goal properties as you wish after entering column view defined above.

Adding Goal values from column view adds :Goal: value to :PROPERTIES: drawer of each affected item. This is the same action as C-c C-x p.

Rainer notes that long term goals will transition to medium then short term goals, in that order.

Try creating a custom view for agenda view that displays items under Goals: Long, Medium, Short, None.

34.2 Approach 2. A dedicated Goals files

Create file goals.org to track your goals.

Create a capture template to enforce SMART goals (Specific, Measurable, Achievable, Reasonable, Timely).

An example of a None goal might be "cleaning fish tank" so fishes are healthy, in that it doesn't require concentrated effort or that it is a 'none' goal.

On the goal org file, you could define To Do Sequence, like this: #+SEQ_TODO: GOAL(g) | ACHIEVED(a) MISSED(m).

Then, under headings Short|Medium|Long|None goals, list the To Do items accordingly.

Then, use a capture template to fill in and insert a SMART goal. You should try to create this template for yourself.

You can add a deadline to the task. You can also under :Actions: add links to id's (that may come from a different file even).

35 Hierarchies of tags

You can do something like #+TAGS: [ Goal : {G@.+} ]. And then you could tag an item with something like G@2018_slimdown and the Goal tag matches that regex. Another example could be G@2018_bulkup.

Then we could search for Goals tags that match the regex. Inside agenda view we could match just 'Goal' and it will list all items that matches {G@.+} regex.

You can also just click on the tag and it will list all the matched items (from org file outside of agenda view).

Date: November 2020

Author: Logan Won-Ki Lee (logan.wonki.lee@gmail.com)

Created: 2020-11-19 Thu 15:49

Validate