Thu 17 Mar 2016 — Wed 03 Aug 2016

See Babel Intro

C-c C-c executes a code block.

Tangle means get the code, weave means make a document.

Results

:results value captures the last return value. :results output captures text from stdout.

Session

:session name-of-session lets your persist things from one code block to another.

(Otherwise they are self-contained.)

Calling functions

We can use Babel as a meta-programming language, glueing several others together.

Give code blocks names using #+name: my-function.

Declare their parameters with #+header: :var x=0.

Call them with #+call: my-function(x=5).

Multiple Files

org-babel-lob-ingest (C-c C-v i) allows us to load code blocks from other files.

Tangling

org-babel-tangle

Specify :tangle filename to output a code block to file.

Turn on :noweb yes and then Use to specify a depedendency on some other block.

Languages

Python

The default Python support isn't that good yet. Its output has prompts all over the place, and it can't handle empty lines inside function definitions.

To get around this, we can use the IPython kernel for Jupyter instead.

Include the Jupyter package in your installed Python command. For example, I use something like:

pkgs.python36.withPackages(ps: with ps; [matplotlib tabulate numpy jupyter])

This install will put in assorted Jupyter command line tools for you. For example, you should now be able to run jupyter kernelspec list and see your Python 3 kernel.

Remember to also include (ipython . t) inside the org-babel-load-languages variable.

Unfortunately, ob-ipython has its own difficulty. Mainly, the table export (which works very nicely with normal Python) is broken, and the first listed in their Github readme is out of date.

I'll look at this again next year.

Org-TaskJuggler

Install TaskJuggler

It's a ruby project

sudo aptitude install ruby
mkdir ~/taskjuggler
gem install --install-dir ~/taskjuggler taskjuggler

Making some tasks

  1. Define an effort property and column
  2. Add a taskjugglertag to the top of your tree.
  3. M-x org-export-as-taskjuggler-and-open

Adding dependencies

  • ORDERED property
  • BLOCKER property says what we depend on ('previous-sibling', or a task id)

People

Make a separate tree for people.

Give each person a resourceid property

Give your tasks allocate properties, saying who they depend on.

Org-Mode

TODO Tags

Properties

Each entry in an org-mode outline can have properties. They go inside a PROPERTIES…END block. Each properties is a key-value pair which is written on one line.

* My-Heading
:PROPERTIES:
:Title: Whatever
:END:

C-c C-x p sets a property.

S-left and S-right switch between allowed values for a property.

C-c C-c D kill a property out of the whole file.

Properties may be searched like tags.

There's an API for controlling properties using elisp.

Inheritance

org-use-property-inheritance exists. Probably don't use it.

Column View

Define columns on a file level, or for a particular sub-tree:

#+COLUMNS: %THIS %THAT %TOTHER

You can also control the width of a column (and some other things):

#+COLUMNS: %10FIXEDWIDTH

C-c C-x C-c toggles column view. org-columns-quit exits column view.

Todo Status

Todo status is implemented as a special property.

C-c C-t toggles the todo status of the current branch.

Archiving

C-c C-x a org-toggle-archive-tag

C-u C-c C-x a tag archive children without TODO entries

C-c C-x A org-archive-to-archive-sibling puts it in a parallel subtree

C-C C-x C-s or C-c $ org-archive-subtree

C-u C-c C-x C-s children to subtree

There's also a timestamp one, which I won't bother with.

Sparse-Tree

Let you filter based on dates, regex, properties or TODO.

Collapse most of the tree, so you can only see those things you asked for.

TODO Read This

http://doc.norang.ca/org-mode.html

This looks like the thing.

Includes

Link is C-c l

You can link to another org file using my-file.html

You can include another file using INCLUDE:

#+INCLUDE: "my-file.org" org

Timestamps

http://orgmode.org/manual/Creating-timestamps.html#Creating-timestamps

  • Can repeat
  • Can have ranges
  • Can be generated by an SEXP

C-c . org-time-stamp

C-u C-c . date and time

C-c < org-date-from-calendar today's date

C-C > org-goto-calendar

C-c C-o org-open-at-point open an agenda at that date

Shift + cursor keys change the date

C-c C-y org-evaluate-time-range compute difference between dates

Repeat tasks

Set a repeater interval using + and the keywords y/m/w/d/h for year/month/week/day/hour. For example:

<2005-10-01 Sat +1m>

Setting a repeat task to done will shift the timestamp. It'll also store an extra timestamp to let you know when you did it.

Special Tags

DEADLINE and SCHEDULED tags take a timestamp as an argument. Schedule means when you intend to start working on a thing.

There are commands to show passed deadlines etc.

Clock

C-c C-x C-i clock in, C-c C-x C-o clock out.

There is a special clock table to look at these.

It can be set up to warn you about idle time, and allow you to resolve/adjust the clock.

Timers

Not quite the same as clocks.

There is org-timer-start and org-timer-set-timer.

Estimates

C-C C-x e lets you set an estimate.

Agendas

http://orgmode.org/manual/Agenda-views.html#Agenda-views

C-c a opens the agenda menu. Then you choose which agenda view you want.

You can filter the agenda in various ways:

  • / for tags
  • < for category
  • = for regex
  • ^ nearby things
  • | clear filters
  • space to go to the place where this item came from.
  • F (follow) to display items as you move through the agenda.
  • C-k delete item
  • t toggle todo status
  • C-c schedule it
  • C-d deadline it
  • S-left S-right move the timestamp
  • m mark item
  • B bulk action
  • x exit and clear out opened buffers
  • C-x w write agenda to file
  • C-x C-c C-x toggle columns mode

Date View

  • f go forward in time
  • b go backward in time
  • . today
  • j jump to a day

Files

Agendas need to know which files to look at.

Use C-c [ to add and C-c ] to remove a file. Use C-, and C-. to cycle those files.

C-C C-x < says read my agenda from this subtree. C-c C-x > undoes it.

It doesn't follow includes or links.

You can set up a regex or a directory or whatever.

Org items will get a category based on what file they came from.

Interleave

The Interleave Package is a way to take notes on a PDF side-by-side with an org-mode buffer.

org-capture

You have a notes file, and a key combination.

Press the key combination, type your note, it gets put in the file.

You can do this from anywhere in Emacs.

Export

C-c e

This is obviously excellent.

Consider these headers for latex export:

#+AUTHOR:
#+TITLE:
#+OPTIONS: toc:nil num:0
#+LATEX_HEADER: \usepackage{fullpage, parskip}

TODO Emacs Calendar/Diary Integration

Org can just work out things like %%(org-anniversary). Do that.

%%(org-calendar-holiday)