Learning org mode
posted on 2026-10-08
This is bold text. And this is italics. For underlines you have to, well underline. For links we have to use [[]], like this example.
FUNDAMENTAL
* TOP LEVEL HEADING
** Second level heading
some text under second level heading.
*** Third level heading
some text under third level heading.
* ANOTHER TOP LEVEL HEADING
LISTS EXAMPLE
Unordered lists start with '*', '+' or '-'. Ordered lists start with '1.' or '1)'.
For example:
* List of things on my table
My table is messy rn. But, we'll ignore it.
1. My laptop
2. My mobile phone
3. Misc
+ My wallet
+ Lot of instant coffee sackets
+ Sunscreen, etc
Things to keep in mind:
- My wallet :: Actually a card holder.
- Instant coffee :: 3-in-1 instant coffee.
TABLES
Org mode supports tables.
example:
| slno | Name | Phone |
|---|---|---|
| 1 | Shivakumar | 123456 |
| 2 | Tanaya | 654321 |
'C-c |' to create a table.
HYPERLINKS
'C-c C-l' to insert any type of links.
Internal Links
If you want to link something from the current document. We use ‘[[*headline][description]]’ like this External Links.
External Links
Org supports differnt types links like links to file, links to website, etc. For more information refer info "(orgguide) Hyperlinks".
To go to more specific section of a file we use double colon '::'. Like this: 'file:~/code/main.c::255'
TODO's
Any headline becomes a TODO item when it starts with the word ‘TODO’.
To toggle Todo we have to 'C-c C-t'. It also cycles:
,-> (unmarked) -> TODO -> DONE --.
'--------------------------------'
We can also move through the cycle with S-<RIGHT/LEFT>.
example:
TODO This is an example
‘M-x org-agenda t’ (‘org-todo-list’) to track all global TODO's in one buffer. ‘S-M-<RET>’ (‘org-insert-todo-heading’) to insert TODO just below.
To add todo in the current file we use this '#+TODO: TODO(t) | DONE(d)'
Progress logging
‘C-u C-c C-t’ (‘org-todo’) to log the time with the TODO.
Tasks to subtasks
Breaking down tasks to subtasks is done as follows:
example:
* Organize Party [33%]
** TODO Call people [1/2]
*** TODO Peter
*** DONE Sarah
** TODO Buy food
** DONE Talk to neighbor
Add [%] or [/] to these to track the cookies, and can be updated with ‘C-c C-c’.
Checkboxes
Checkboxes are done by adding [ ] infront of the TODO. But, checkboxes won't be seen in the global TODO list.
‘C-c C-c’, ‘C-u C-c C-c’ (‘org-toggle-checkbox’) to toggle checkboxes.
TAGS
Tags are labels added to headlines to refer and cross-corelate information.
Tags must be wrapped with colon (::). example: ‘:work:’
Tag inheritance
Tags are hierarchical structures of outline trees. i.e. if the heading contains the tag then the subheadings will contain the same parent tag.
example:
* Meeting with the French group :work:
** Summary by Frank :boss:notes:
*** TODO Prepare slides for him :action:
In here the TODO heading will contain ‘work’, ‘boss’, ‘notes’, and ‘action’.
To make sure all entires in the current file should inherit certain tags, we need to set:
Setting tags
M-<TAB> offers completion for the tags. To insert a Tag we need to:
‘C-c C-q’ (‘org-set-tags-command’) ‘C-c C-c’ (‘org-set-tags-command’) when the point is in a headline, it does the same as the above command.
We can set default tags for a given file using the ‘TAGS’ keyword, like
Tag groups
you can add a group tag by using brackets and inserting a colon in between the tag and the related item.
example:
Tag search
‘C-c / m’ or ‘C-c \’ (‘org-match-sparse-tree’) Creates a sparse tree with all headlines matching a tag search.
Refer to info "(orgguide)#Tag searches".
PROPERTIES
Properties are key-value pairs associated with an entry. They live in a special drawer with the name ‘PROPERTIES’.
example:
* Some headline
** Some sub-headline
:PROPERTIES:
:Title: Learning org mode
:Author: Shivakumar
:Key: Value
:END:
If we want to define allowed values for a particular property ‘XYZ’, we have to append ‘_ALL’ to it, hence it becomes ‘XYZ_ALL’. And if we want all the entires to inherit the some property we have to set it in the root level. Like this:
#+PROPERTY: XYZ_ALL 1 2 3 4
To set a property we use this command: ‘C-c C-x p’ (‘org-set-property’)
And, to remove a property we use: ‘C-c C-c d’ (‘org-delete-property’)
DATES AND TIME
We can use timestamps in multiple things like planning, in TODO’s, schedule tasks, set deadlines, track time, and more.
Timestamps
A simple timestamp can be applied to an item by assigning date/time to it.
example:
- Some headline
The above is a plain timestamp.
Timestamps with a repeater interval:
example:
- Gotta do some task
For more formats refer info "(orgguide)#Timestamps".
Creating timestamps
‘C-c .’ (‘org-timestamp’) To create a timestamp. When the point is a existing timestamp it would modify the timestamp.
‘C-c !’ (‘org-timestamp-inactive’) Creates an inactive timestamp, i.e. it won’t be added in the agenda entry.
For more info refer info "(orgguide)#Creating Timestamps".
Deadlines and Scheduling
‘C-c C-d’ (‘org-deadline’) To insert a deadline to the task.
example: * TODO Do some task DEADLINE:
‘C-c C-s’ (‘org-schedule’) Ditto, but for schedule.
Clocking Work Time
Org mode allows you to clock the time you spend on specific tasks in a project.
For commands refer info "(orgguide)#Clocking Work Time".
TODO Capture, Refile, Archive
Capture
Captures lets you quickly jot down or capture the ideas or interruptions of your workflow. Its like quick note. You can define templates for your captures.
To set up capture refer info "(orgguide)#Setting up capture".
‘M-x org-capture’ (‘org-capture’) This command lets you create and note down the capture. You will be narrowed buffer to edit.
‘C-c C-c’ (‘org-capture-finalize’) This command is to lets you finilize the noting down the buffer. This lets you confirm the edit you were noting down and then resume the work without any further distraction.
‘C-c C-k’ (‘org-capture-kill’) Abort the capture process and return to the previous state.
Capture templates
You can use templates to capture different types of capture items, and to different capture locations. You can set this for general TODO tasks. etc.
For more info refer info "(orgguide)#Capture templates"
TODO …
WORKING WITH SOURCE CODE
Org mode lets you include source code.
A source code block conforms to this structure:
#+NAME: <name>
#+BEGIN_SRC <language> <switches> <header arguments>
<body>
#+END_SRC
For more info refer Info "orgguide(#Working with Source Code)"
Use ‘C-c '’ to edit the current source code block.
Header arguments
A header argument is specified with an initial colon followed by the argument's name in lowercase.
- System-wide header arguments
- Those are specified by customizing ‘org-babel-default-header-args’ variable.
- Header arguments in properties
- You can set them using ‘header-args’ property or ‘header-args:LANG’ for language LANG.
- Header arguments in code blocks
Header arguments are most commonly set at the source code block level, on the
‘BEGIN_SRC’line:#+NAME: factorial
#+BEGIN_SRChaskell :results silent :exports code :var n=0
fac 0 = 1
fac n = n * fac (n-1)
#+END_SRC
Code block header arguments can span multiple lines using ‘HEADER’ keyword on each line.
Evaluating code blocks
Use ‘C-c C-c’ to evaluate the current code block and then insert the results in the same org document.
example:
(+ 2 2 2)
Output:
6
We can use this as an replacement for jupyter notebooks, cause jupyter is heavy and bloated.
Python example:
def main():
print("This is run from org!")
if __name__ == "__main__":
main()
Output:
This is run from org!
Result of Evaluation
Org handles the results of the code snippet by the headers given to it. The primary determinant, however, is the ‘results’ header argument. It controls the collection, type, format, and handling of code block results.
- Collection
- How the result should be collected from the code block.
- Type
- What result type to except from the execution of the code block. You may choose among ‘table’, ‘list’, ‘scalar’, and ‘file’.
- Format
- How org processes the result. It can be ‘code’, ‘drawer’, ‘html’, etc.
- Handling
- How to insert the result once formated. Allowed values are ‘silent’, ‘replace’ (default), ‘append’ and ‘prepend’.
Exporting code blocks
It is possible to export the code of the code block, the result of the code block execution.
Extracting source code
Use ‘C-c C-v t’ to create pure source code files by extracting code from source blocks in the current buffer.