The Kalem Book GitHub

This Book describes Kalem's main branch, which may be ahead of the latest release.

Writing in Org

The editor shows the document as it reads: the markup, such as the stars around bold text, is hidden and appears when the cursor is on it, so you can always see and change what is in the file (editor.show_source_markers shows it always or never instead).

An Org file stays Org as Emacs knows it: Kalem writes nothing into it that Org does not define, so a co-author in Emacs never meets a line only Kalem understands. Fonts, sizes and colors are not part of Org and are not offered in an Org file.

1. Headings

A line that starts with stars is a heading: * Chapter, ** Section. Ctrl+1 to Ctrl+6 make the current line a heading of that level, Ctrl+0 makes it plain text again. Alt+Enter inserts a new heading of the same level, as M-RET does in Emacs: on a heading's title the rest of the title moves to it, at the start of a heading it goes above. Insert Heading After Subtree (Emacs's C-RET), Insert Subheading and Insert TODO Heading are in the palette, with Toggle Heading, which turns the line (or the selected lines) into a heading under the entry and a heading back into text, as C-c * does, and Toggle Item, the same with list items (C-c -): a TODO heading becomes an item with a checkbox. Alt+Left and Alt+Right promote and demote a heading, with Shift its whole subtree; Alt+Up and Alt+Down move a subtree past its neighbors. Tab on a heading folds and unfolds it; Shift+Tab cycles the whole document between overview, contents and everything. With Vim keys the z keys fold as in Doom Emacs: za toggles the heading the cursor is under, zo and zc open and close it, zO opens everything under it, zM shows the overview, zR everything, and zA is Shift+Tab; as Vim's closed folds, a folded heading is one line for j and k, and dd or yy takes it whole. In Normal mode M-h and M-l promote and demote a heading (outdent and indent an item, move a table column), M-k and M-j move it, and with Shift (M-H, M-L) the whole subtree, as evil-org has them; Enter marks a TODO heading done (or not done again), toggles a checkbox, opens a link, goes to a footnote's other end or recalculates a table, as Doom's +org/dwim-at-point (Act at Cursor). ]h and [h go to the next and previous heading of the same level, gj and gk to the next and previous element, gh to the element around the cursor and gl into the one at it; ]l and [l go to the next and previous link, ]c and [c to the next and previous source block, and C-S-h, C-S-j, C-S-k and C-S-l are Org's Shift with the arrows (a TODO keyword, the priority, a list's bullet, a date). Ctrl+Enter and Ctrl+Shift+Enter insert an item, a table row or a heading (with its TODO keyword) below or above the one at the cursor and start Insert mode, as Doom's C-RET and C-S-RET (Insert Item Below and Above; in a terminal that can send the keys).

Cut Subtree and Copy Subtree take the heading at the cursor with everything under it, and Paste Subtree pastes one at the level that fits where it goes, as Emacs does. Sort Entries sorts the selected headings, else those under the one at the cursor, else the top-level ones, with the letters of Emacs's org-sort-entries: a by title, n by number, t by time, c by creation time, s by scheduled date, d by deadline, p by priority, o by TODO state, k by clocked time; a capital letter sorts in reverse.

2. Text formatting

Keys Formatting In the file
Ctrl+B Bold *bold*
Ctrl+I Italic /italic/
Ctrl+U Underline _underline_
Ctrl+Shift+X Strike-through +gone+
Ctrl+Shift+K Code ~code~

Verbatim (=verbatim=) is in the palette. With a selection, the keys add the formatting, or remove it when it is already there. Deleting a marker character turns the formatting into plain text, and the status bar says so.

3. Lists and checkboxes

Start a line with - = for a list or =1. = for a numbered one. Enter continues the list, and ends it on an empty item. Tab and Shift+Tab indent and outdent an item, Alt+Enter inserts one, Ctrl+Shift+L cycles the bullet style. Ctrl+Shift+C adds, checks and unchecks a checkbox =[ ], a click toggles it, and statistics cookies such as [1/3] stay up to date. Repair List makes the indentation, bullets and numbers of the list consistent, as Emacs's org-list-repair does.

4. Tables

Ctrl+Shift+T inserts a table; a line starting with | is a row, and typing keeps the columns aligned. Tab and Shift+Tab move between fields, Enter goes to the next row. Alt with Up and Down moves rows, with Left and Right columns; Alt+Shift+Down inserts a row, Alt+Shift+Up deletes one, Alt+Shift+Right inserts a column, Alt+Shift+Left deletes one. Away from the cursor a table is drawn as a grid (a table wider than the window has its widest columns narrowed, their cells' text wrapped inside them), and cells pasted from a spreadsheet become a table. In the palette: Align Table, Insert Horizontal Rule (|---+---| below the row), Sort Rows (by the cursor's column: a alphabetically, n by number, t by time, a capital letter in reverse), Export Table… (CSV when the name ends with .csv, else tab-separated) and Import Table….

4.1. Formulas

A #+TBLFM: line under a table computes fields as in Emacs: $4=$2*$3 fills the fourth column with the product of the second and third, @>$4=vsum(@2..@-1) puts a sum in the last row. F9 recalculates and aligns the table; with org.table_auto_recalc = true, leaving a field with Tab, Shift+Tab or Enter recalculates too. Formulas are Emacs Calc formulas and give Emacs's results: the same references ($2, @3$1, @I..@II, $-1, remote(name, @2$3), column names from a ! row, #+CONSTANTS), functions (vsum, vmean, vmedian, round, if=…), flags (;%.2f=, ;N, ;E, ;T for durations) and dates: $2-$1 between two timestamps is a number of days. Emacs Lisp formulas ('(...)) are kept but not computed.

With the cursor in a field a formula fills, the status bar is the formula bar: it shows the formula, says why the field shows #ERROR when it does, and highlights the fields the formula reads. Edit Formula (F2) asks for the field's formula, =$2*$3 for its column or :=$2*$3 for this field alone, writes the #+TBLFM: line and recalculates. From the command line, kalem table recalc FILE recalculates every table of a file (--iterate until nothing changes, --check for CI).

5. Formulas in the text

LaTeX formulas show typeset: $E=mc^2$, \(a^2+b^2\), $$\sum_i x_i$$ and environments such as \begin{align}. With the cursor inside a formula you see its source, with a preview beside it as you type; a click on a formula takes you into its source, and a formula that cannot be typeset shows its source in a red frame. \newcommand, \def and \DeclareMathOperator in #+LATEX_HEADER: lines work in the document's formulas. Toggle Formula Preview shows every formula as its source. The terminal approximates formulas with Unicode (x², α), and draws displayed ones typeset where it draws images (kitty, iTerm2, WezTerm, sixel).

6. Links

Ctrl+K inserts a link, and typing [[ offers the document's headings, targets and named elements. Ctrl-click (Cmd-click on macOS), or Open Link in the palette, opens the link at the cursor: web links in the browser, file links in Kalem or their application, internal links by jumping. Store Link keeps a link to what is at the cursor, in the file manager the marked files, in a document its file and heading; Insert Stored Link writes them as [[file:…][name]], and Ctrl+K offers the last one. Insert Cross Reference lists what a link can point to, named elements, headings by CUSTOM_ID and <<targets>>, and links to the one you choose. Remove Link replaces the link at the cursor with its description (or its target when it has none).

7. Macros, snippets, captions and blocks

Away from the cursor, a macro such as {{{title}}} shows what the export writes in its place, in the link color and italic: the document's #+MACRO: definitions and Org's own title, author, date, n, time and the rest. An export snippet, @@html:<br>@@, shows its back-end dimmed and its contents as code. Targets (<<here>>) and radio targets (<<<Term>>>) hide their brackets, and every other Term in the text links to the radio target. A #+TOC: headlines 2 line shows the table of contents an export puts there, and a click on a row goes to its heading.

Set Caption and Set Name (Insert menu) write the #+CAPTION: or #+NAME: line of the table, block, picture or paragraph at the cursor; an empty answer removes it. A block shows its kind on a thin first line, a source block its language with a copy button, a comment block dimmed; quote and verse blocks have a bar in the margin, and drawers fold to their first line until the cursor enters them. Insert Block asks for a kind (src, quote, example, center, verse, comment, or another) and wraps the selected lines or writes an empty block; Insert Drawer does the same with a drawer; Insert Horizontal Rule writes -----.

8. Pictures

A link to a picture without a description, [[file:cat.png]], shows the picture in its place (PNG, JPEG, GIF, WebP, BMP, TIFF, SVG), no wider than the text; #+ATTR_ORG: :width 300 or :width 50% above it sets its width, and [[attachment:plan.png]] finds the file in the heading's attachment folder as org-attach keeps it. A picture pasted from the clipboard, or picture files pasted or dropped on a saved document, are copied into NAME_assets beside NAME.org (org.assets_dir names another folder) and linked where the cursor or the mouse is. The terminal editor draws pictures alone on their line where the terminal draws images.

9. Tasks, dates and tags

Ctrl+Enter cycles a heading through its TODO states (TODO, DONE, or the states of the document's #+TODO line); Shift+Left and Shift+Right step through them, Shift+Up and Shift+Down change the priority. In the palette: Set TODO State (a list of the document's keywords to choose from, as SPC m t in Doom), Mark Done, Next Keyword Set and Previous Keyword Set (when #+TODO lines give several), Set Priority and Remove Priority, Set Tags and Toggle Tag (a colon at the end of a heading offers the tags too), Align All Tags, Set Property and Delete Property, Edit Properties (the entry's properties as a list to change, add to or remove from) and Add Note (a note under the heading, in the drawer org.log_into_drawer names). Each writes what the Emacs command of the same name writes.

Schedule (Ctrl+Alt+S) and Set Deadline ask for a date, from a calendar in the graphical editor or typed (today, +3d, friday, 2026-10-05 14:30, with a repeater or warning such as +1w or -3d after it), and write SCHEDULED: or DEADLINE: on the planning line as Emacs does; Remove Schedule and Remove Deadline take them off. Alt+Shift+D inserts a date from the same calendar, where arrows move by day and week and Page Up and Page Down by month; Ctrl+Shift+D inserts the current time stamp. With the cursor on a date, Shift+Up and Shift+Down change the part under it (year, month, day, hour, or the minutes by five; on a repeater such as +1w its number or unit; on a bracket, active becomes inactive), and Shift+Right and Shift+Left move it a day, as in Emacs; on a CLOCK: line the duration follows. With a selection the keys extend it.

Refile (Ctrl+Alt+W) moves the subtree at the cursor under another heading of the document, chosen by outline path, as its last child. Archive to Sibling moves it under an Archive heading among its siblings, tagged ARCHIVE, with the time in ARCHIVE_TIME; Toggle Archive Tag sets or removes the tag. Archiving into another file is not there yet.

With org.enforce_todo_dependencies on, a task cannot be done while a task below it is open, and under a heading with the ORDERED property (Toggle Ordered Subtasks) each task waits for the ones before it; org.enforce_todo_checkbox_dependencies makes it wait for its checkboxes too, and a NOBLOCKING property lifts both. org.todo_state_tags_triggers changes tags with the state: "done: -next +closed" removes next and adds closed when a task is done. These are Emacs's settings of the same names, so a file behaves the same in both.

10. Completion, paste and cursors

Typing #+ offers keywords and blocks, [[ link targets, [fn: footnote labels, and a colon after a heading its tags. In every file, the third letter of a word offers the document's words that start the same way; Ctrl+Space (or Alt+/) asks after a single letter. Up and Down choose, Tab inserts (Enter too, except for words, where it starts a new line), Escape closes.

Paste (Ctrl+V) converts: cells from a spreadsheet become a table, and text copied from a web page or a word processor becomes Org with its headings, emphasis, links, lists and tables (the graphical editor reads that HTML on macOS, and on Linux through wl-paste or xclip). Empty paragraphs in copied HTML stay empty, and several pasted paragraphs are separated from the text on either side of the cursor. Text with preserved whitespace (for example, copied code) uses the clipboard's plain text so its indentation and line breaks stay intact. Clipboard line breaks, including CR, CRLF and Unicode line and paragraph separators, become the document's line endings. Paste as Plain Text (Ctrl+Shift+V) inserts the text as it is, as any paste in a source block does. Copy as Rich Text (Edit menu) copies the selection, or the whole document, as HTML with the Org text beside it, so mail and word processors keep the formatting (on macOS; elsewhere the command copies plain text and says so); Copy as HTML copies the HTML markup itself.

Ctrl+Alt+Down and Ctrl+Alt+Up add a cursor on the next or previous line; Alt-click adds or removes one where you click; Ctrl+D selects the word at the cursor, then each next occurrence, and Select All Occurrences every one; Ctrl+Alt+Shift+Down and Up make a column selection. Typing, Backspace, Delete and the arrows then act at every cursor as one undo step, and Copy takes each selection, one a line. Escape, a click or Single Cursor leaves one cursor.