Dynamic blocks
#+BEGIN: clocktable :scope file :maxlevel 2 :block thisweek
#+END:
| <prefix>xu / xU | Update the block at the cursor / all blocks. <C-c><C-c> on the #+BEGIN: line also updates it. |
clocktable parameters (the output matches Emacs 9.8):
| :scope | file|subtree|tree|treeN|agenda|agenda-with-archives| file-with-archives|("a.org" "b.org") |
| :maxlevel | N (default 2) |
| :block | today, yesterday, thisweek, lastweek, thismonth, lastmonth, thisq, lastq, thisyear, lastyear (the this* forms and today take -N / +N), untilnow, 2026-09-23, 2026-W39, 2026-Q3, 2026-09, 2026. It wins over :tstart / :tend. |
| :tstart / :tend | timestamps or <now>, <today>, <yesterday>, <tomorrow>, <-2d>, <+1w>, <-3h> (h from now, d w m y from today) |
| :wstart / :mstart | first day of the week (1 = Monday) / of the month |
| :step | day|week|semimonth|month|quarter|year: one table per period of the :block or :tstart/:tend range (:stepskip0 t skips empty ones) |
| :match | a match string (org-match-syntax) |
| :formula | % adds a percentage column; "$3=$2;t" adds a #+TBLFM line. A #+TBLFM below the table survives updates. |
| :sort (2 . ?T) | sort the rows by a column (a/A n/N t/T) |
| :lang de | headers in de, es, fr, nl, nn, pl, pt-BR or sk |
| :filetitle t | #+TITLE instead of the file name in the file column |
| :properties ("Effort" "OWNER") | property columns (:inherit-props t) |
| :level t | a level column |
| :timestamp t | a timestamp column |
| :tags t | a tags column |
| :emphasize t | bold level 1, italic 2 |
| :link t | link headlines |
| :fileskip0 t | skip files without time |
| :hidefiles t | no file column |
| :tcolumns N | at most N time columns |
| :compact t | one time column, indented headlines |
| :indent nil | no \_ indentation |
| :narrow 40! | cut headlines at 40 characters (the default); :narrow 40 adds a <40> width row instead |
| :header "text" | replace the #+CAPTION: line |
columnview parameters: :id local|global|file:path|ID (default local; a local or ID view covers the subtree of the entry holding the COLUMNS property that entry inherits, else the entry's own subtree, as column view does), :maxlevel, :skip-empty-rows, :indent, :format, :match (tags / property match), :exclude-tags (a b) (inherited tags count), :hlines t|N (a hline before each entry, or each entry of level N or less), :vlines t (column groups), :link t (link items to their headings), :formatter (the name of a global Lua function function(rows, params) returning the lines; columns_dblock_formatter sets one for every block; rows are the titles, "hline", then { level = n, hl = headline, cells... }). Like Emacs (org-columns-dblock-write-default), a first row of width cookies (<25>) is written when the format has widths, and the columns are shrunk; ITEM loses statistics cookies, footnote references, targets and inline src blocks / calls; archived and commented subtrees are skipped. Keywords like #+NAME: above the table and the first #+TBLFM: line below it are kept, and the formulas re-applied. A | in a value is written as \vert{} (Emacs writes it raw, which breaks the table).
Custom blocks:
require("org.dblock").register("myblock", function(params, ctx)
return { "| generated | table |" }
end)