You are on page 1of 74

Getting yourself organized with Orgmode

Concept: Headlines – Outline mode

Every headline starts with one or more *

Visibility of the headline hierarchy:


Local visibility cycling with 
Global visibility cycling with 

Increase or decrease level with  or 

Move up/down within a level with  or 

Move a headline under another top level headline:


Cursor on the headline and then c w
Getting yourself organized with Orgmode
Concept: ToDo keywords

Default is TODO and DONE

Cycling through them with  or 

More keywords can be defined with a line


#+SEQ_TODO:
Items left of | are ToDo items (red)
Items right of | are Done items (green)

Activate line with C C

Get a menu of all keywords: c T


Getting yourself organized with Orgmode
Concept: Schedule, deadline & agenda view

At the moment we have a list without any schedule.

Scheduling is done with  

Deadlines are defined with  

Switch to agenda view with A A

Follow mode with 

Move forward with f


or backward with b
Getting yourself organized with Orgmode
Concept: Repeating tasks

Some tasks occur frequently, so we should


schedule them frequently.

To schedule a repeating task you need to modify the


timestamp. <2016-06-11 Sa repeat>

The term repeat can be:

+1w Next occurence in one week. (w=week, d=day,


m=month, y=year)

++1w Next occurence on the same day of week, but


definitely in the future.

.+4w Next occurence 4 weeks after the task is marked


as done.
Getting yourself organized with Orgmode
Concept: Checklists

Checklists provide a simple „checkoff“ list.

Checklists start with


- [ ] Text for checkitem

New checklist lines can be added with 

You can see the completion of the checklist with


[/] or [%] on the headline.

Checkboxes are toggled with  


Getting yourself organized with Orgmode
E02S01 - Concept: Tags

Tags can be added to headlines and are often used


as a way to mark GTD contexts.

Tags can be predefined with a line


#+TAGS: PHONE(o) …
at the beginning of the file

To assign tags to a headline use  

If you have predefined tags with keys assigned,


you see a menu, but you still can enter free tags
by pressing . Finish definition with .
Getting yourself organized with Orgmode
E02S02 - Function: Agenda mode (advanced)

Agenda selection menu with  a


a Agenda for current week or day
L Timeline for current buffer
t List all TODO entries
T Entries with a special TODO keyword
M Match tags / properties / TODO Keywords
M Like before, but only TODO entries
S Search for keywords
Getting yourself organized with Orgmode
E02S03 - Function: Customized agenda views

Agenda selection menu with  a


 Edit custom agenda views

We want to create view that shows the urgent


tasks and the phone calls in our file

[INS] Buttons insert new rules


[DEL] Buttons delete new rules

At the end press [Apply and Save]


Getting yourself organized with Orgmode
E02S04 – Concept: Drawers
Function: Logging, quick notes

Drawers start with a line :DRAWERNAME:


and end with the next line that says :END:
Everything between those lines is hidden when
the drawer is closed. Open/close it with .

Reserved drawer names are e.g. :LOGBOOK: or


:PROPERTIES:

Customize org-log-intto-drawer to LOGBOOK.


(Menu Options/Customize Emacs/Specific option)

Take quick notes with  


Finish and store the note with  
Getting yourself organized with Orgmode
E02S05 – Function: Archiving

Finished tasks clutter up your org file, so its time to


move them out of the way.

Define a global archive file with


#+ARCHIVE: filename.org::

Archive an entry with   

Archive a subtree with   s

Search all subtrees under a headline and see


which one can be archived with this keys
u   s
Getting yourself organized with Orgmode
E03S01 – Function: Automatic logging of status changes

Goal: Get a logbook entry whenever a ToDo keword changes

#+SEQ_TODO: TODO(t@/!)
t – hotkey assigned to that TODO keyword
@ - log a timestamp and a note when this is entered
! - log a timestamp when you leave that keyword

Goal: Log a „CLOSED“ timestamp when something is done

Customize variable org-log-done

Goal: Log a note with a timestamp every time something is


rescheduled

Customize variable org-log-reschedule


Getting yourself organized with Orgmode
E03S02 – Concept: Splitting your system up into several files

Goal: Instead of one file for all we want to have one


for the private things and one for work

Procedure:
• Customize org-agenda-files so that both files are used
to generate the agenda views.
• Customize refile function (fine tuning)
◦ org-refile-targets
◦ org-refile-use-outline-path
◦ org-refile-allow-creating-parent-nodes

• Move entries with  

• Copy entries with  


Getting yourself organized with Orgmode
E03S03 – Function: The first capture template(s)

Goal: Capturing tasks, ideas and whatever

Procedure:
• Define a capture key in your .emacs file:
(global-set-key (kbd "<f6>") 'org-capture)
• Write template files (e.g. „tpl-todo.txt“
• Press your capture  key and  to configure
◦ Hotkey for capture
◦ Destination
◦ Format
◦ Based on what template file or text

• Start capturing
Getting yourself organized with Orgmode
E03S04 – Function: The :PROPERTIES: drawer

The :PROPERTIES: drawer stores task specific settings and user


defined attributes.

Important: The :PROPERTIES: drawer must immediately


follow the headline!

Goal: You don't want to create a log entry every time a


repeating task is done.

Recipe: Define a :LOGGING: property with value nil

Matching properties in agenda views is possible too.


Getting yourself organized with Orgmode
E03S05 – Function: Archiving to different files

Goal: You want to archive your read books in an extra file


and not inside the global archive file.

Recipe: Define an :ARCHIVE: property with the target


name e.g. :ARCHIVE: track-books.org::* Read books

Definition is done on the top hierachy level and then


inherited to its children.
Getting yourself organized with Orgmode
E04S01 – Function: Ordered tasks

Goal: Tasks should be completed one after the other

Recipe: Define an :ORDERED: property with value „t“

Toggle the :ORDERED: property with   

Customzing variables:
'(org-enforce-todo-dependencies t)
'(org-track-ordered-property-with-tag t)

More customization:
org-agenda-dim-blocked-tasks
org-enforce-todo-checkbox-dependencies
Getting yourself organized with Orgmode
E04S02 – Function: Timers

Goal: Start a countdown timer

Recipe: Start it with   

Goal: Start a relative timer

Recipe: Start it with   0


Start with offset u   0

Insert simple time stamp with   .


Insert description time stamp with   -

Pause timer with   ,


Start again with   ,

Stop timer with U   ,


Getting yourself organized with Orgmode
E04S03 – Function: Clocking (aka time tracking)

Goal: Measure how long you need for a task

Clock in Clock out


      o

Customization: '(org-clock-into-drawer "CLOCKING")

More key combinations:

Restart a clock:   X
Restart with menu: U   X

Jump to clocked task:   j

Cancel clock:   Q

Show times:   d
Getting yourself organized with Orgmode
E04S04 – Function: Column view

Goal: Show your org file in columns

Recipe: Define columns like that


#+COLUMNS: %7TODO(To Do) %58ITEM(Task) …

Column view can be set locally with the


:COLUMNS: property in a property drawer

Show column view:   

Leave column view: Q


Getting yourself organized with Orgmode
E04S05 – Function: Effort estimates

Goal: Estimate the effort that your task will need

Recipe: Effort estimates are stored in a property :Effort:


Easy setup: Define #+PROPERTY: Effort_ALL and
then possible values. Add this to column view with
%8Effort(Effort){:}. The {:} means sum up times.

Show column view:   

Increase effort: 
Decrease effort: 

Leave column view: Q


Getting yourself organized with Orgmode
E05S01 – Function: Linking (internal)

Goal: Link to other items in the acutal file

Recipe: A link looks like that: [[target]] You can also


use a drescription like that [[target][description]]

Targets:
A headline
A place in the document with a #+NAME: target line
An item with a :CUSTOM_ID: property

Special: Radio targets that look like this <<<target>>> create


links on the fly

Key combinations:
Edit links with  L
Follow link with  
Return to previos position  &
Getting yourself organized with Orgmode
E05S02 – Function: Linking (external)

Goal: Link to other items somewhere in the world

Recipe: A link looks like that: [[target]] You can also


use a drescription like that [[target][description]]

Targets: protocol:location

Special: Linking to items with an ID property


ID is an UUID that you can create with
org-id-get-create

Shortcut: Copy the code from the video description to


the end of your ~/.emacs file

Customizing: org-id-locations-file stores in what


file OrgMode should look for IDs
Getting yourself organized with Orgmode
E05S03 – Function: Attachments

Goal: Attach some files to your tasks


Recipe: Call the attachment system with  
S Set a specific directory for the tasks attachment
I Inherit the attachment directory to the children of the task
The attachments are usually stored under ./data/ and then a structure
based on the ID property
 Attach file with the method configured in org-attach-method
 Attach file with by copying
M Attach file by moving (deletes original file)
L Attach file by creating a hard link (not on all file systems)
Y Attach file by creating a symbolic link (not on all file systems)

O Open attachment, if more than one ask for the name


O Open attachment in Emacs
F Open the tasks attachment directory
F Open the tasks attachment directory but force using dired in Emacs

D Select and delete a single attachment


D Delete all attachments

N Create a new attachment as an emacs buffer


Z Synchronzie the task with its attachment directory
Getting yourself organized with Orgmode
E05S04 – Function / Concept: Priorities

Goal: Set priorities to your tasks


Example: Eisenhower's priority matrix

Orgmode priorities are usually A B C.


You can change them by a configuration line:
#+PRIORITIES: 1 5 3
1: highest priority / 5: lowest priority / 3: default

Cycle through priorities with  or 

Direct setting with  ,


Getting yourself organized with Orgmode
E05S05 – Function: Tables

Goal: Organize reference material in tables


Recipe: Orgmode has a built-in table editor
• Separate columns with „|“
• Start rows with „|-“ and press 
• Move columns with  or 
• Delete column with 
• Insert a new column left with 
• Insert a horizontal line with  -
• Define constants with #+CONSTANTS:
• Define forumulas #+TBLFM:
◦ Columns referenced by $colnum
◦ Rows referenced by @rownum
Getting yourself organized with Orgmode
E06S01 – Function: Exporting

Goal: Export your files into HTML or PDF


Recipe: Orgmode has a powerful export tool
call it with  

Customization:
Setting org-file-apps determines the application to open files.

Add a line with #+OPTIONS: to fine tune the output


d:t Show the contents of drawers
\n:t Preserve line breaks
p:t Export planing information
(SCHEDULE / DEADLINE)
todo:t Include TODO keywords into exported text
Getting yourself organized with OrgMode
E06S02 - Advanced exporting

Rainer König

August 16, 2016

Rainer König
Getting yourself organized with OrgMode
Customize new backends

Customoze group "org-export" and there


"org-export-backends"
Enable "beamer" for LATEX beamer support1
Enable "odt" for export to OpenDocument Text

1
This le was created with beamer export.
Rainer König
Getting yourself organized with OrgMode
Add some options for the beamer export

+AUTHOR: Name the author of the document


+TITLE: to dene a title
+SUBTITLE: to dene a subtitle
+DESCRIPTION: Produces meta data, no output by default
+BEAMER_THEME: Select a beamer theme
Google for "latex beamer themes" to get an idea what is
available
+BEAMER_FONT_THEME: Select a font for the beamer
slides

Rainer König
Getting yourself organized with OrgMode
More useful options

Additional #+OPTIONS: (with "nil" or "t")

Option What does it do?


toc Enable Table of contents
 enable sub/superscripting
(used it here for BEAMER_THEME)
tags Export tags
f Export footnotes (used on slide 2)
\n Toggle line break preservation

More options can be found in the manual.

Rainer König
Getting yourself organized with OrgMode
Things to keep in mind

Even if OrgMode oers several export backends, your le is


usually dened for one special backend. Example:
This le looks good if exported to "beamer"
This le looks bad if exported to "odt"
The beamer backend is nice for standardized outline slides, but
its lacking of design and images. So there is a good chance
that your presentation is boring.
Book recommondation: Garr Reynolds - Presentation Zen

Rainer König
Getting yourself organized with OrgMode
Getting yourself organized with OrgMode
E06S03 - Publishing

Rainer König

August 20, 2016

Rainer König
Getting yourself organized with OrgMode
Customize your web server

Goal Enable user directory public_html


On Debian 8 this is done as root user by
# cd /etc/apache2/mods_enabled
# ln -sf ../mods_available/userdir.conf userdir.conf
# ln -sf ../mods_available/userdir.load userdir.load
# systemctl restart apache2.service

Rainer König
Getting yourself organized with OrgMode
Customize your ~/.emacs le

(setq org-publish-project-alist
'(("org"
:base-directory "~/org/"
:publishing-directory "~/public_html"
:publishing-function org-html-publish-to-html
:section-numbers nil
:with-toc nil
)))

Rainer König
Getting yourself organized with OrgMode
Try the export function

Open your webbrouser and go to http://localhost/~joe/


Call the export dispatcher with C-c C-e
Press "P" for Publish
Chose what to publish

Rainer König
Getting yourself organized with OrgMode
Additional information

OrgMode is keeping timestamps of the exported les in


~/.org-timestamps/
Delete this directory if you delete public_html, otherwise only
les changed since the last run will be exported

Rainer König
Getting yourself organized with OrgMode
Getting yourself organized with OrgMode
E06S04 - Dynamic blocks

Rainer König

August 29, 2016

Rainer König
Getting yourself organized with OrgMode
General info on dynamic blocks

A dynamic block calls a function to create content dynamically


A dynamic block starts with a line #+BEGIN: name
The name is the name of the function to call
A dynamic block can have :parameters
Parmeters are written als :parameter1 value1 . . .
A dynamic block ends with a line #+END:
Some predened functions are available
clocktable to build a time accounting table
columnview do capture a columnview inside a document

Rainer König
Getting yourself organized with OrgMode
Building a clock table

Remember the clocking example in Episode 04?


We add a clock table to it:
Position on the headline and press C-c C-x C-r
Adjust :scope for the scope
(subtree, le, le-with-archives. . . etc.)
Adjust the depth by chainging :maxlevel
Update the table at any time with C-c C-C or C-c C-x C-u
The cursor needs to be on the line with #+BEGIN:
You will see the time of the latest update in the caption line

Rainer König
Getting yourself organized with OrgMode
Advanced clocktable

Use :block thismonth to show a block of time for a month


Move forward with S-right
Move backward with S-left
Use :step week to show weekly values
Use :tstart and :tend to speciy a time range
Date speciers inside double quotes "<2016-08-29 Mo> "

Rainer König
Getting yourself organized with OrgMode
Capturing column view

"Since column view is just an overlay over a buer, it cannot be


exported or printed directly." (The org manual)
But you can create a dynamic block with a column view
Place your cursor where you want the block to be and press
C-c C-x i
You will be asked for a value of the parameter :id
local uses the tree in which the block is located
global uses all headings in the le
"path-to-file" uses the whole le
"ID" uses the subtree with this :ID: property

Rainer König
Getting yourself organized with OrgMode
Getting yourself organized with OrgMode
E06S05 - Tracking habits

Rainer König

August 30, 2016

Rainer König
Getting yourself organized with OrgMode
What is a habit

Habits are recurring tasks that you do frequently. Examples:


Brush your teeth every day
Water your plants in the house every second day
Go to the gym every week
Once habits are really installed in your brain you don't need a
reminder to do them

Rainer König
Getting yourself organized with OrgMode
Prerequisites to track habits

You need to enable the habits module in org-modules


Your habit is a recurring item with a ToDo keyword
representing an "open" state
You need to dene a property STYLE: habit
The syntax for repetitions is a bit dierent:
'.2d/3d' means you do the astk at least every three days, at
most every 2 days.
Important: Logging of changes to DONE needs do be enabled
When you mark the current occurence done don't kill the log
entry with C-c C-k!

Rainer König
Getting yourself organized with OrgMode
Real life example

Goal is to monitor practicing musical instruments


Play the bass for 10 minutes every day
Recurring task with repetition interval '.+1d'
Style "habit" dened as a property

Play guitar every 3rd day at least, better every 2nd day
Recurring tast with repetition interval '.+2d/3d'
Style "habit" dened as a property

Rainer König
Getting yourself organized with OrgMode
How does a habit look in an agenda view?

Looks like a scheduled task, but with a block graph at the end
The ' !' marks the actual date
Every '*' marks a completed task on that day
Background color meaning:
Blue: The task was to be done yet on that day

Green: The task could have been done on that day

Yellow: The task will be overdue the next day

Red: The task is overdue on that day

Rainer König
Getting yourself organized with OrgMode
Additional tips

Customize org-habit-show-habits-only-for-today if you want to


see habits that are not due today
Habit tracking tracks just the successful completion of your
habit
So if you use it like we did in our example dene another task
to track your progress (practice lesson 1, lesso 2 and so on).
Since habit tracking is adding timestamps to the logbook you
should tidy up (delete very old lines) from time to time since
they aren't displayed.
Once a habit is successfully installed (usually arond 3 weeks)
you could also delete the habit tracking task.

Rainer König
Getting yourself organized with OrgMode
Getting yourself organized with OrgMode
E07S01 - Bulk agenda actions

Rainer König

December 21, 2016

Rainer König
Getting yourself organized with OrgMode
Setting marks in agenda view

First you have to select the entries in the agenda that should be
used for the bulk action
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 base don a regular expression

Rainer König
Getting yourself organized with OrgMode
Bulk actions in agenda view

Call for bulk cations by pressing B

then chose what action to perform


after the action is performed the marks are removed
you can toggle persistent marks with *

Archiving entries

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

Rainer König
Getting yourself organized with OrgMode
Bulk actions: Change and rele entries

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 rele target and move all entries.


The entries will no longer be in the agenda, refresh (g)
to bring them back.

Rainer König
Getting yourself organized with OrgMode
Bulk actions: Change schedules and deadlines

Those commands can be prexed with C-u B

Key Meaning Prex means


s Schedule entries. You can shift by Remove schedule
++8d or something similar
d Set deadline to a specic date Remove deadline

S Scatter. Distribute entries over the Scatter only


next N days. N will be prompted. across weekdays

Rainer König
Getting yourself organized with OrgMode
Known Issues

If you want to use scatter, then org-log-reschedule should not


be congured to take notes, otherwise scattering is aborted
with an error message after rescheduling the rst entry.

Rainer König
Getting yourself organized with OrgMode
Getting yourself organized with OrgMode

Episode 7 Snippet 2

How do I use OrgMode in daily life?

December 24, 2016


privat.org
work.org privat.org
schedule.org
work.org privat.org ths.org
schedule.org
work.org privat.org ths.org
schedule.org

W P F V

plan-work.org plan-free.org
Synchronization across PCs

work.org privat.org ths.org


schedule.org

org-global.el

Office Home Smartphone


Capturing ideas
More org files for every area of interest

logbook- review
privat.org

goals

plan-free.org journal archives


Thank you for more than 600 subscribers
on YouTube
Getting yourself organized with OrgMode

Episode 7 Snippet 3

Google calendar integration

January 3, 2017
Goal

Make your Google calendar


entries appear in the
OrgMode agenda views.
Theory
cron job on your pc

c1.ics c1.org
Google
calendar
Ical2org
c2.ics awk / py / pl c2.org

c3.ics c3.org
Problems

Repeating events „by-day“ (e.g Tuesday & Friday)


cause problems to the transformation scripts
Emacs diary approach
cron job on your pc

c1.ics
Google
calendar
Icalendar- Diary
c2.ics import-file Google

c3.ics
OrgMode setup

'(org-agenda-include-diary t)

#include diary-google
Getting yourself organized with OrgMode
E07S04 - Source code in OrgMode

Rainer König

April 20, 2017

Rainer König
Getting yourself organized with OrgMode
Prerequisites

The language that you want to use must be customized in the


variable org-babel-load-languages.
For this snipptet we have added the following languages:
shell (for shell snippets)
dot (for GraphViz code)
Special thanks to Alex Koval for pointing me at the Video about
"Literate Devops" which was very helpful for me.

Rainer König
Getting yourself organized with OrgMode
Shell code in OrgMode

To enter a source code block in an org le you have to type <s and
press the tab button. This will expand to

#+BEGIN_SRC

#+END_SRC

you can then add shell as a language and put shell code in the code
block

Rainer König
Getting yourself organized with OrgMode
Shell parameters

The :results parameter shows how the results are shown:

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

Rainer König
Getting yourself organized with OrgMode
A Graphviz example

GraphViz is a tool to draw graph. We used the following start of


the code block:

#+BEGIN_SRC dot :le graph.png :cmdline -Kdot -Tpng

Param Meaning
:le is the le that we create with Graphviz

:cmdline -Kdot means we call the dot utility


-Tpng means we output in PNG format

Rainer König
Getting yourself organized with OrgMode

You might also like