Org-mode
Org-mode is a major mode for the GNU Emacs text editor that enables structured note-taking, task management, and document authoring using a lightweight, plain-text markup format in files with the.org extension.[1] It supports hierarchical outlining, TODO lists, timestamps, tables, and hyperlinks, allowing users to organize information hierarchically while maintaining portability across systems.[1] Developed initially for personal productivity, Org-mode has evolved into a versatile tool for project planning, literate programming, and publishing content in formats like HTML, LaTeX, and PDF.[2]
Created by Carsten Dominik in 2003 out of frustration with the limitations of Emacs's existing Outline mode, Org-mode began as a system for outline-based note-taking and project planning.[3] Early enhancements included support for TODO entries, time stamps for scheduling, and tabular data, which quickly made it popular among Emacs users for managing agendas and workflows.[3] By the late 2000s, contributions from developers like Eric Schulte and Dan Davison introduced Org Babel, enabling embedded code blocks in multiple programming languages (such as Python and R) with live execution and result integration, transforming Org-mode into a computational notebook system.[3]
Org-mode's ecosystem includes the Org Agenda for dynamic views of tasks across multiple files, customizable export backends for diverse output formats, and integration with tools like LaTeX for professional document production.[1] Maintained under the GNU project since its inception, it has seen leadership transitions, including Bastien Guerry from 2011 to 2024, succeeded by Ihor Radchenko in December 2024, and ongoing contributions from a global community tracked via the Worg wiki.[3][4] As of November 2025 (version 9.7.36), Org-mode remains actively developed, emphasizing its role as a free, open-source solution for knowledge management within Emacs.[1]
History and Development
Origins and Creation
Org-mode was created in 2003 by Carsten Dominik, a physicist working at the Max Planck Institute for Solar System Research, as a major mode for GNU Emacs aimed at personal note-taking and project planning. Dominik developed it out of frustration with the user interface of Emacs's existing Outline mode, which relied on complex commands and lacked intuitive structure editing for organizing notes, tasks, and documents. His goal was to establish a lightweight, structured plain-text system that avoided proprietary formats, facilitating easy editing, searching, version control, and portability across tools.[3] The first public release came in 2004, when Dominik shared Org-mode via the Emacs Wiki, marking its introduction to a broader audience. This release attracted early adoption within academic and programming communities, particularly among Emacs users in research and software development, who valued its seamless integration and potential for managing complex outlines and workflows. Feedback from these initial users, including bug reports and feature suggestions, began flowing immediately through email and the nascent mailing list.[3][5] Key initial features centered on simplicity and functionality, including hierarchical outlines created using asterisks to denote heading levels—such as a single * for top-level items and multiple for sublevels—enabling tree-like organization of content. Additionally, built-in support for timestamps allowed users to embed scheduling information directly in the text, supporting basic time management without external dependencies. These elements provided a solid foundation for structuring information in a human-readable format while leveraging Emacs's extensibility.[3][6]Evolution and Maintenance
Following its initial development, Org-mode transitioned into a GNU project and was integrated into the core distribution of GNU Emacs starting with version 22.1, released in May 2007. This inclusion marked a significant step in its institutionalization, allowing it to benefit from the broader Emacs ecosystem and GNU maintenance processes while expanding its user base among Emacs users worldwide.[3] Key version milestones highlight Org-mode's evolution. Org 5.0, released in 2007, introduced a foundational export engine that enabled structured output to formats like HTML and LaTeX, laying the groundwork for document authoring capabilities. Org 8.0 in May 2013 brought substantial refactoring, including a modular export backend system (ox- framework) for greater extensibility and performance. Org 9.0, released in November 2016, featured a new parser for more robust handling of complex structures. By Org 9.6, released in late 2022, enhancements included persistent element caching for faster parsing in large files, a new folding backend for improved navigation, and upgrades to MathJax 3 for better mathematical rendering in exports. As of 2025, Org-mode has seen incremental updates in version 9.7 and beyond, focusing on stability and compatibility with modern Emacs features. The stable release as of November 2025 is version 9.7.36.[7][8] Maintenance shifted toward a community-driven model after Carsten Dominik stepped down as lead maintainer in November 2010, with Bastien Guerry taking over from 2011 to 2024. Under Guerry's stewardship, development emphasized collaborative contributions, supported by contributors like Eric Schulte, Nicolas Goaziou, and others. In December 2024, Ihor Radchenko assumed the maintainer role, continuing oversight through the Org Mode core team coordinated via the Worg website, which hosts documentation, development guidelines, and community resources.[9][4] A pivotal evolution was the addition of Org-babel in 2009, enabling executable code blocks within Org documents for literate programming across multiple languages, developed primarily by Eric Schulte and Dan Davison. This feature transformed Org-mode into a computational notebook environment, integrated into core releases by Org 7.0 in 2010. Development workflows also incorporated Git for version control around 2012, facilitating branched feature development and pull requests from the community, with the main repository hosted on the Org-mode Git forge.[10][11] As of 2025, recent developments emphasize ecosystem integration, including enhanced compatibility with Org-roam for personal knowledge management through bidirectional linking and graph visualization. Community efforts have also explored AI-assisted tools for outlining and content generation, such as prototypes for automated linking in Org-roam nodes, though these remain experimental extensions rather than core features. Mobile synchronization has improved via Git-based workflows and third-party tools like organice, enabling seamless editing across devices without proprietary dependencies.[12][13][14]Core Concepts and Syntax
Outline Structure
Org-mode documents are fundamentally organized as hierarchical outlines, leveraging a tree structure where headings serve as nodes and subtrees allow for nesting of content such as plain text, lists, or additional headings.[15] This structure enables users to represent complex information in a nested, easily navigable format, with the entire document forming a single, cohesive tree that can expand or collapse dynamically for focused viewing.[16] The outline's depth is theoretically unlimited, limited only by practical considerations like editor performance, making it suitable for everything from simple notes to intricate project plans.[15] Headings in Org-mode are denoted by leading asterisks, where the number of asterisks indicates the hierarchy level: a single asterisk (*) marks a top-level heading, two (** ) a second-level subheading, and so on, always followed by a space and the heading title.[16] For example:This syntax ensures that all content following a heading until the next heading of equal or lesser level belongs to that heading's subtree, promoting intuitive organization without requiring special delimiters.[15] The use of asterisks provides a lightweight, human-readable way to build deep hierarchies, with Org-mode supporting up to 15 levels by default when inline tasks are enabled, though practical limits are often lower.[16] Metadata and custom properties are managed through dedicated drawers, which are special blocks enclosed by keywords like* Top-Level Heading Some introductory text or a list item here. ** Second-Level Subheading Nested content, such as further details or another list.* Top-Level Heading Some introductory text or a list item here. ** Second-Level Subheading Nested content, such as further details or another list.
:PROPERTIES: and :END: for key-value pairs attached to headings, or more generally with #+BEGIN: and #+END: for broader metadata such as document titles, authors, or configuration directives. A typical properties drawer might appear as:
These drawers allow for structured data storage within the outline, facilitating features like searchability and integration with external tools, while remaining fully editable in plain text.[16] Org-mode supports sparse trees as a dynamic filtering mechanism, which temporarily collapses the outline to display only headings matching specific criteria, such as tags or TODO states, while preserving the hierarchical context of matches.[17] Accessed via the command* Project Task :PROPERTIES: :CUSTOM_ID: task-123 :CREATED: 2023-01-15 :END: Associated notes or content.* Project Task :PROPERTIES: :CUSTOM_ID: task-123 :CREATED: 2023-01-15 :END: Associated notes or content.
C-c /, users can generate these views—for instance, C-c / t to show all TODO items—allowing efficient scanning of large documents without altering the underlying structure.[17] This integrates briefly with task management by highlighting incomplete items based on predefined states.[17]
All Org-mode files are stored in a simple plain-text format with the .org extension, ensuring high portability across editors and platforms, as well as seamless integration with version control systems like Git due to the absence of binary elements or proprietary formatting.[15] This format's simplicity underscores Org-mode's design philosophy, prioritizing accessibility and longevity over visual styling in the source file.[16]
Markup Elements
Org-mode employs a lightweight markup language to enable rich text formatting, hyperlinks, and embedded content directly within plain-text files, facilitating seamless integration of structured notes with visual and interactive elements. This markup operates at both inline and block levels, allowing users to emphasize text, create navigational links, insert media, add annotations, and incorporate mathematical expressions without leaving the Emacs environment. The design prioritizes simplicity and readability in source files while supporting advanced rendering during editing or export.[18] Emphasis and formatting in Org-mode are achieved through simple delimiter-based syntax, which applies styles such as bold, italic, underline, verbatim, and code to selected text. Bold text is marked with asterisks, as in*bold text*, rendering it in a heavier font weight. Italic emphasis uses forward slashes, /italic text/, for slanted or oblique styling. Underlining employs underscores, _underlined text_, to add a line beneath the text; note that the same delimiters are used for subscript when the content follows a non-space character (e.g., CO_2 for CO₂), but standalone or spaced use prioritizes underlining as of version 9.7, with braces enabling explicit subscript like C_{O_2}.[19] Verbatim content, which prevents further processing or interpretation, is enclosed in equals signs, =verbatim text=, typically displayed in a monospaced font without emphasis. Code snippets are delimited by tildes, ~code text~, also monospaced to distinguish them as programming or literal code. These markers must be paired correctly, with contents free of the delimiters themselves to avoid conflicts, and they can nest within certain combinations but not overlap.[18][16]
Links in Org-mode support internal navigation, external references, and custom identifiers, using a uniform bracketed syntax for easy insertion and activation. The general format is [[link][description]], where the link target follows the first pair of brackets and an optional visible description follows the second; if omitted, the target serves as the description. External links to URLs, such as [[](https://orgmode.org)[Org-mode website]], connect to web resources or files, with plain URIs like https://example.com also recognized automatically. Internal links to headings within the same file use [[*Heading Title]] to target exact titles or [[#custom-id]] for headings assigned a CUSTOM_ID property, enabling stable references across document edits. Custom ID-based links, like [[id:unique-uuid]], rely on globally unique identifiers for cross-file or long-term linking, promoting robust document interconnectivity.[20][21]
Images and embeds are incorporated via file links, allowing inline display during editing and labeled presentation in documents. The syntax [[file:path/to/image.png]] embeds an image file, such as [[file:diagram.jpg]], which Org-mode renders inline when toggled via C-c C-x C-v or enabled at startup with org-startup-with-inline-images. For labeling, a #+CAPTION: keyword precedes the link on a separate line, e.g.,
#+CAPTION: Diagram of Org-mode structure[[file:structure.png]] optionally paired with
#+NAME: fig:label for referencing, enhancing accessibility and export compatibility. Image sizing defaults to actual dimensions capped by the window width, customizable per instance with attributes like #+ATTR_ORG: :width 300px.[22]
Footnotes provide a mechanism for inline annotations, defined either at the point of reference or collected at the document's end for cleaner organization. Inline references use [fn:label], such as [fn:1], linking to a definition elsewhere, typically [fn:1] This is the footnote content. placed after a paragraph or at file end. Inline definitions combine reference and content in one, like [fn:: An inline note.], ideal for brief asides. Named footnotes, [fn:my-note], allow reuse across the document, with definitions stored separately; Emacs commands like C-c C-x f facilitate creation and navigation between references and definitions.[23]
LaTeX fragments enable mathematical and technical typesetting directly in Org-mode text, with inline and display modes for flexible integration. Inline math uses dollar signs, $a = b$, or parentheses, $a = b$, embedding formulas within sentences for rendered preview via Emacs' LaTeX integration. Display equations employ double dollars, $$E = mc^2$$, or brackets, $$E = mc^2$$, for centered, multi-line blocks, supporting full environments like \begin{equation}...\end{equation}. Previewing occurs through org-preview-latex-fragment (bound to C-c C-x C-l), generating images or SVG via tools like dvipng, with scalability tied to Emacs font settings. This markup supports export to formats preserving LaTeX fidelity, such as PDF via LaTeX backend.[24][25]
Editing and Organization Features
Navigation and Folding
Org-mode provides efficient tools for navigating hierarchical outlines and controlling the visibility of document sections, enabling users to traverse and manage large files effectively. Basic movement between headings is facilitated by keyboard shortcuts such asC-c C-n to jump to the next visible heading and C-c C-p to move to the previous one, which respect the current visibility state and reveal context as needed.[1] For broader jumps, Org-mode integrates with Emacs' Imenu feature, allowing users to invoke M-x imenu to generate an index menu of all headings for quick selection and navigation within the outline structure.[1] Additionally, regex-based searches are supported through the org-occur command, accessible via C-c / r, which scans the entire buffer for matches and displays them in a sparse tree view with highlighted results and surrounding hierarchy.[1]
Folding and visibility control are central to Org-mode's editing workflow, allowing dynamic expansion and collapse of outline subtrees to focus on relevant sections. The TAB key performs local cycling on a heading, progressing through states: folded (hiding the subtree), children (showing only direct subheadings), and subtree (fully expanding the entire branch).[1] For buffer-wide adjustments, S-TAB (or C-u TAB) cycles through global states: overview (displaying only top-level headings), contents (showing all headings but folding their contents), and show all (unfolding everything).[1] These states can be restored to their startup configuration with C-u C-u TAB, while C-c C-r reveals the local context around the point without altering the overall visibility.[1] Sparse trees extend this functionality by creating temporary, targeted views of the document; invoked via the C-c / dispatcher, they fold the buffer to highlight specific elements, such as C-c / t for all TODO entries or C-c / r for regex matches, with navigation between matches using M-g n and M-g p.[1]
To accelerate routine navigation, Org-mode offers speed commands, which map single keystrokes to common actions when the point is at the beginning of a headline. These are enabled by setting the org-use-speed-commands variable to a non-nil value, after which keys like n for next heading and p for previous provide rapid traversal without multi-key sequences.[1] Additional speed keys are customizable via org-speed-commands.[1] Help for available speed keys is accessible by pressing ? at a headline or using M-x org-speed-command-help.[1]
Visual aids enhance these navigation and folding mechanisms within Emacs buffers. Heading levels are distinguished through fontification, applying varying fonts, sizes, or faces to indicate depth in the outline, which helps users quickly assess structure at a glance.[1] These features collectively support efficient document management, with sparse trees occasionally referenced in task agendas for focused overviews.[1]
Tables and Lists
Org-mode provides robust support for creating and editing tables directly within plain-text documents, using a simple pipe-based syntax that allows for spreadsheet-like functionality. Tables are delimited by vertical bars (|) separating columns, with rows separated by newlines; for example, a basic table might begin with | Name | Age | followed by data rows like | Alice | 30 |. Horizontal rules for separating sections are created using lines starting with |-, such as |---+---|, which Org-mode recognizes and renders appropriately during editing and export. Automatic column alignment occurs upon pressing TAB, ensuring readability without manual adjustment.[26]
Editing tables in Org-mode is facilitated by intuitive keyboard commands integrated into the built-in table editor. The TAB key moves to the next cell, creating a new row if at the end of the current one, while S-TAB navigates to the previous cell; arrow keys also support movement between cells. To insert a new row, use M-S-<down> (or org-table-insert-row), which adds it above the current one (with prefix argument, below), and org-table-insert-column (bound to M-S-<right> in table context) for adding columns. Formulas enable dynamic calculations, specified after the table with #+TBLFM:, such as #+TBLFM: $2=$1*2 to multiply values in the first column and place the result in the second; recalculation is triggered by C-c C-c or automatically on export. Advanced features include named fields for referencing specific cells (e.g., via #+TBLNAME: mytable followed by @2$3 for row 2, column 3) and horizontal rules for structuring complex tables. The orgtbl-mode minor mode enhances table editing in non-Org buffers, providing the same commands for embedding tables in emails or other text. Tables can be exported to formats like CSV or LaTeX, preserving structure and formulas where supported.[26]
Org-mode also excels in handling lists, supporting unordered, ordered, and description types through lightweight markup that integrates seamlessly with the outline structure. Unordered lists begin with bullets like -, +, or * (e.g., - Item one), while ordered lists use numerals followed by a period or parenthesis (e.g., 1. First item); nesting is achieved by indenting sub-items, with Org-mode automatically adjusting bullets or numbers based on customization options like org-list-demote-modify-bullet. Checkboxes for task lists are added using [ ] or [X] (e.g., - [ ] Pending task), toggled with C-c C-c, enabling progress tracking within lists. Description lists employ a double colon (::) to separate terms from their explanations (e.g., - Term :: Detailed description), useful for glossaries or key-value pairs.[27]
Manipulation of lists is streamlined with structure-editing commands that maintain consistency. Inserting a new item uses M-RET, which splits the current item if the cursor is in the middle and preserves indentation for nesting; moving items with M-UP or M-DOWN automatically renumbers ordered lists to ensure sequential integrity. Indentation is adjusted via M-LEFT or M-RIGHT, and bullet styles can be cycled with C-c - for variety in unordered lists. List items conclude at lines with equal or lesser indentation or after two blank lines, allowing flexible grouping without explicit delimiters. These features promote efficient organization, with brief folding of list subtrees available for visibility control during editing.[27]
Task and Time Management
TODO Keywords and States
Org-mode provides a flexible system for marking and tracking tasks by associating TODO keywords with headings, allowing users to represent various states of progress within an outline structure. By default, the system supports two basic states: TODO for pending items requiring action, and DONE for completed ones, enabling a simple cycle from unmarked to TODO to DONE. These keywords are inserted directly into headings, such as*** TODO Prepare report, and can be toggled to manage task status efficiently.[28][29]
Customization of TODO keywords is highly configurable, either globally via the Emacs variable org-todo-keywords or per-file using in-buffer settings. For per-file customization, a line like #+TODO: TODO NEXT | DONE CANCELED defines a sequence of states, where the vertical bar separates active (TODO-like) states from inactive (DONE-like) ones; here, TODO and NEXT indicate ongoing work, while DONE and CANCELED mark resolution. Multiple sets of keywords can coexist in one file, such as a basic TODO | DONE alongside a workflow-specific REPORT BUG | FIXED, allowing diverse task types without global reconfiguration. Changes take effect after pressing C-c C-c on the settings line.[30][31]
State transitions occur by cycling through the defined keywords using the C-c C-t keybinding, which rotates forward (or backward with S-<left> or S-<right>); for direct access, prefix with a number like C-2 C-c C-t to jump to the second state. If fast selection is enabled via org-use-fast-todo-selection, a temporary interface prompts for keyword choice. To track changes, Org-mode supports logging: appending ! to a keyword (e.g., DONE!) records a timestamp upon transition, while @ (e.g., WAIT@) prompts for a note plus timestamp. These logs can be stored in a :LOGBOOK: drawer by setting org-log-into-drawer to "LOGBOOK", automatically inserting entries like CLOSED: [2025-11-10 Sun 14:30] when states change. Subtree-specific logging overrides via properties like :LOGGING: DONE(!).[31][32][28]
Tasks can include planning information through special properties like DEADLINE and SCHEDULED, which integrate timestamps directly under headings. A DEADLINE, inserted with C-c C-d, sets a due date (e.g., DEADLINE: <2025-11-10 Sun> for active or DEADLINE: [2025-11-10 Sun] for inactive, non-agenda-linked), warning in views like the agenda starting org-deadline-warning-days (default 7) days prior. SCHEDULED, via C-c C-s, marks a start date (e.g., SCHEDULED: <2025-11-10 Sun>), listing the task from that point until completion, with delays possible like SCHEDULED: <2025-11-10 Sun -2d>. These properties support active timestamps (angle brackets) for dynamic agenda interaction and inactive ones (square brackets) for static references.[33]
For further categorization, tags can be appended to headings in the form :tag1:tag2:, enabling flexible labeling such as :work:urgent: to group related tasks across the file. Tags inherit from parent headings by default (controlled by org-use-tag-inheritance), so a parent like * Project :boss: passes :boss: to all subentries, facilitating hierarchical organization without repetition.[34][35]
Recurring tasks are handled via repeaters appended to SCHEDULED or DEADLINE timestamps, such as .+1d for daily shifts from completion (e.g., SCHEDULED: <2025-11-10 Sun .+1d>), ++1w for weekly on the same weekday, or +1m for fixed monthly intervals. Upon marking as DONE with C-c C-t, the timestamp advances automatically, resetting the state to TODO; org-log-repeat can log completions for each instance. This mechanism supports habitual tasks without manual rescheduling.[36]
Agenda and Calendar Integration
Org-mode provides powerful agenda views that aggregate tasks from multiple files, offering dynamic overviews for time management and scheduling. The agenda dispatcher, accessed via the keybindingC-c a, serves as the central entry point for generating these views. It includes options for a daily or weekly agenda, which displays scheduled tasks and deadlines in a calendar-like format; a global TODO list showing all unfinished items across agenda files; a timeline view that lists events in chronological order; and other specialized views like tag matches or text searches. These views are built upon basic TODO keywords and states to filter and present actionable items efficiently.[37]
Custom agenda commands allow users to tailor views to specific needs, such as filtering by tags or files. For instance, a command can match entries with tags like +work+today to show only relevant tasks. These are defined through the org-agenda-custom-commands variable, enabling the creation of user-defined buffers that combine multiple search criteria, such as TODO states, tags, or properties. Once configured, custom commands appear in the agenda dispatcher menu, providing quick access to personalized overviews without repetitive manual filtering.[37]
Calendar integration in Org-mode facilitates synchronization with external systems, enhancing its utility for broader time management. The weekly and daily agenda views directly link to the Emacs calendar and diary system, displaying holidays, anniversaries, and diary entries alongside Org tasks when org-agenda-include-diary is set to t. Navigation commands in the agenda buffer, such as SPC or RET, allow jumping to the underlying diary file for editing, while insertions like i add new entries on the fly. For interoperability, Org-mode supports iCalendar (.ics) export via backends like ox-icalendar, which converts headings with timestamps into VEVENT or VTODO entries; commands such as C-c C-e c f export the current file, and C-c C-e c a handles agenda files. Import from .ics files is possible through third-party tools listed in the Org ecosystem, though built-in support focuses on export for compatibility with applications like Google Calendar or Outlook.[38][39]
Time tracking is integrated through clocking features, allowing precise measurement of effort on tasks. To start a timer on a heading, use C-c C-x C-i; stopping it with C-c C-x C-o records the interval in the entry's log drawer. This mechanism supports idle time detection and history of recently clocked tasks for quick resumption. Dynamic reports are generated using clocktables, inserted via #+BEGIN: clocktable in an Org file, which compute totals per subtree or scope, such as :scope file for overall project time. These tables update on refresh (e.g., C-u C-c C-u) and provide summaries like total hours spent, aiding in productivity analysis. Persistence across sessions is enabled by setting org-clock-persist to t.[40]
For efficient task entry and organization, Org-mode includes capture and refile mechanisms. The capture system, invoked with C-c c, uses predefined templates from org-capture-templates to quickly insert new tasks, notes, or links into designated files without disrupting workflow; for example, a template might prompt for a TODO item and file it under a "Tasks" heading. Completion with C-c C-c saves the entry and returns to the original buffer. Complementing this, refiling with C-c C-w (org-refile) moves existing entries or regions to target locations across files, using outline path completion for selection. Targets are configurable via org-refile-targets, and options like org-refile-allow-creating-parent-nodes permit hierarchical adjustments, ensuring tasks flow seamlessly from capture to structured agendas.[41][42]
Literate Programming and Execution
Org-babel Overview
Org-babel, originally developed by Eric Schulte and Dan Davison, was first released in 2009 as an extension to Org-mode that integrates source code execution capabilities directly into Org documents. It enables literate programming by treating code blocks as first-class elements, allowing users to embed, evaluate, and manage executable code alongside documentation in a single plain-text file.[43] This framework supports reproducible research and multi-language interoperability, where code from various programming languages can be woven into hierarchical outlines, with results captured and displayed inline.[44] By activating embedded code blocks, Org-babel transforms static Org files into dynamic, executable documents, promoting clarity and verifiability in computational workflows.[45] The core syntax for defining source code blocks in Org-babel uses the#+BEGIN_SRC and #+END_SRC delimiters, specifying the programming language and optional header arguments on the opening line. For example, a block might begin with #+BEGIN_SRC python :results output, followed by the code, and end with #+END_SRC.[46] The :results header argument controls result capture, with options like output to include stdout or raw for unformatted insertion, ensuring flexible integration of computational outputs into the document structure.[47] These blocks can be placed anywhere in an Org file, excluding comments or fixed-width areas, and support noweb-style references for modular code composition.
Tangled extraction compiles dispersed code blocks into standalone source files, expanding variables, merging blocks with the same name, and applying transformations like adding comments or shebangs via header arguments such as :tangle or :comments.[48] Conversely, weaving integrates code and results into documentation during Org's export process, generating formatted outputs like PDF or HTML that interleave explanations with executed snippets.[48] This dual mechanism supports both code generation for external use and document production for sharing analyses.
Session management in Org-babel allows stateful interactions across multiple blocks using the :session header argument, which names a REPL-like environment (e.g., :session my-session) to preserve variables and state between evaluations.[49] By default, sessions are isolated ("none"), but enabling them facilitates iterative computations, such as building on prior results in data analysis pipelines.
Security features mitigate risks from executing untrusted code by requiring explicit user confirmation before evaluation, controlled via the org-confirm-babel-evaluate variable, which defaults to prompting for each block.[50] Tangling is deliberate and user-initiated, preventing accidental execution of tangled files, while variable insertion occurs safely through noweb references (e.g., <<block-name>>) that expand to literal code text or by linking results without direct injection.[50] Users are advised to load only trusted Org files to avoid potential harm from malicious code.[50] Org-babel supports over 70 programming languages through configurable loaders, enabling broad applicability without delving into specific execution details.[51]
Code Block Execution
Code block execution in Org-mode is initiated by placing the cursor within a source block and pressingC-c C-c, which invokes the org-babel-execute-src-block function to evaluate the code.[52] This command supports execution in over 70 languages, including Python, R, Common Lisp, and shell scripts, with each language handled by dedicated ob-* Emacs Lisp packages such as ob-python or ob-R that must be loaded via the org-babel-load-languages variable.[51][53]
The results of execution are captured and inserted below the block in various formats depending on the :results header argument. Scalar values from the last expression are returned as simple text or numbers, while tabular data—such as data frames in R or lists in Python—is formatted as an Org-mode table for seamless integration with document structure. Graphical outputs, like plots generated by matplotlib in Python or ggplot in R, are handled via the :file header argument to save images (e.g., :file output.png), producing a link to the file in the results section. Raw HTML output can also be generated for web-compatible results, enclosed in an export block to preserve formatting.[47]
Header arguments provide fine-grained control over execution behavior. The :exports argument determines what is included during export: code for source only, results for output only, or both for both, allowing selective visibility of computations. The :eval argument governs whether and how the block is evaluated, with options like never to skip execution entirely, query to prompt the user, or an Emacs Lisp form for conditional evaluation such as (if (org-entry-get nil "EXECUTE" t) "yes" "no") to check a property drawer value. Variable passing via :var enables integration of Org-mode data into code; for instance, :var x=(+ 1 2) evaluates the Elisp expression and binds the result (here, 3) as x in the block's language environment, supporting scalars, tables, lists, or even results from other named blocks.[54][52]
Noweb references facilitate modular code by allowing inclusion of snippets from other blocks using the syntax <<reference>>, where reference matches a block's name or noweb-ref header. Expansion is controlled by the :noweb argument, set to yes for full integration during evaluation or tangling, enabling reusable code across blocks while preserving comments via :noweb-prefix yes.[55]
Error handling during execution prioritizes security and debugging; by default, Org-mode prompts for confirmation before evaluating potentially untrusted code via the org-confirm-babel-evaluate function, which can be customized to always allow or deny. If an error occurs, such as a syntax issue in Python, the stack trace or compiler output is inserted into the results section as text, and Org-mode can link error messages directly to the offending line in the source block for quick navigation. Conditional execution via :eval further mitigates risks by allowing blocks to self-assess before running.[52][50]
Export and Publishing
Export Backends
Org-mode's export functionality is powered by a modular core engine consisting ofox- prefixed modules, which handle the conversion of Org documents into various structured output formats. These modules, such as ox-html for HTML5 generation, ox-latex for LaTeX and subsequent PDF compilation, ox-md for Markdown, ox-odt for OpenDocument Text, and ox-beamer for Beamer presentations, parse the Org syntax tree and apply backend-specific templates to produce the final output.[56] Additional default backends include those for ASCII text, iCalendar, Texinfo, and man pages, providing broad compatibility without requiring external dependencies.[56] As of Org-mode 9.8 (pre-release, November 2025), enhancements include preservation of link protocols in built-in exporters, custom non-numeric footnote anchors in HTML output, and RFC 5545-compliant line endings in iCalendar exports.[8]
Global export settings are configured using the #+OPTIONS: keyword at the document's top level, allowing users to control elements like table of contents inclusion via toc (e.g., toc:3 to limit to three levels) and section numbering with num (e.g., num:t to enable automatic numbering of headlines).[57] These options influence the output across backends, with corresponding Emacs variables such as org-export-with-toc and org-export-with-section-numbers providing programmatic equivalents for finer control.[57] Supported formats extend to EPUB through additional packages like ox-epub, ensuring versatility for digital publishing needs.[56]
The system supports extensibility through custom backends, implemented as ox-NAME packages that can be installed via Emacs packaging or the org-contrib repository, enabling tailored outputs like specialized letter formats with ox-koma-letter.[56] For fine-grained modifications, Org-mode employs filters and hooks, such as the org-export-filter-headline-functions variable, which allows pre- and post-export functions to alter elements like headlines during the translation process.[56]
Batch publishing is facilitated by the org-publish-project-alist variable, which defines projects for exporting entire directories of Org files to target sites, with built-in support for incremental updates to rebuild only changed files and improve efficiency.[56] Styling and theming are integrated via backend-specific keywords, including #+HTML_HEAD: for injecting CSS or JavaScript into HTML outputs and #+LATEX_HEADER: for adding LaTeX preamble commands, such as class declarations, to customize document appearance without altering the core engine.[56]
Customization Options
Org-mode provides extensive user-level configuration options for tailoring export outputs to specific needs, allowing customization through in-buffer keywords, global variables, and header arguments. These settings enable users to control metadata, structure, and content inclusion across various backends, ensuring precise formatting for documents like reports or publications. For instance, metadata keywords such as#+TITLE:, #+AUTHOR:, and #+DATE: define essential document properties that are embedded during export, with #+TITLE: supporting multi-line entries for complex headings and #+DATE: accepting timestamps formatted via the org-export-date-timestamp-format variable.[57] Per-section customization is achieved using blocks like #+BEGIN_EXPORT html followed by backend-specific content and #+END_EXPORT, which insert raw HTML (or other format) elements only in the targeted export, bypassing other backends.[57]
Global and file-specific variables further refine export behavior, such as org-export-with-toc set to t to generate a table of contents, or org-export-headline-levels limited to 3 to control outline depth and prevent excessive nesting in outputs.[57] These can be applied per-file via #+OPTIONS: toc:t H:3 for quick overrides without altering Emacs configuration. Practical examples illustrate their utility: a simple Org outline with headlines and lists can be exported to HTML with navigation by enabling the table of contents, producing a structured webpage where users click through sections seamlessly.[56] Similarly, a TODO agenda view can be customized and exported to a PDF report using the org-agenda-write command with the .pdf extension, requiring Ghostscript for PDF generation, and options such as (ps-landscape-mode t) for orientation or (org-agenda-remove-tags t) for cleaner layouts.[58]
In literate programming contexts, Org-babel integrates customization during export and tangling. Header arguments like :exports results ensure only code block outputs are included in the exported document, omitting source code for concise reports, while :tangle yes extracts blocks to a target file, such as a Python script named from the Org file's base (e.g., document.py), with :comments link adding hyperlinks back to the original Org for traceability.[47] Tangling can include documentation as comments around the extracted code (e.g., with :comments link), creating self-contained scripts with explanatory text, while weaving embeds code blocks and results within the surrounding documentation in the exported document. Graphics handling is refined with arguments like :width 50% to scale images in outputs, applying to file results from code execution.[47]
Advanced features enhance cross-format consistency, such as inline image embedding in LaTeX exports where links like [[file:img.jpg]] are processed into \includegraphics commands, customizable via attributes like :width 5cm or :float nil to avoid floating environments and integrate images directly into text flow.[59] Hyperlinks are preserved across formats by default, with Org's export engine converting internal references (e.g., [[*Headline]]) to appropriate anchors in HTML or PDF, maintaining navigability without additional configuration.[56] These options, drawn from Org's core export framework, allow users to adapt outputs for professional publishing while leveraging the system's built-in backends.[60]
Integrations and Ecosystem
Emacs Package Interactions
Org-mode has been integrated into Emacs as a built-in major mode since Emacs version 22.1, allowing seamless use within the editor without requiring external installation. This core integration enables Org-mode to leverage Emacs's extensible architecture, including hooks such asorg-mode-hook, which runs functions after Org-mode activation to facilitate add-ons and customizations.[61] For instance, developers commonly append functions to org-mode-hook to enable visual tweaks or workflow enhancements automatically upon entering an Org buffer.[62]
Popular extensions build on this foundation to enhance Org-mode's note-taking and organization capabilities. Org-roam, a package inspired by networked thought systems, implements Zettelkasten-style features like bidirectional backlinks and daily notes within Org-mode files, enabling users to create interconnected knowledge bases.[63] Similarly, org-journal provides a structured approach to dated entries, automating the creation and management of journal files in Org format for reflective or chronological logging.[64] Completion interfaces like Helm or Ivy further integrate with Org-mode's refile and capture commands, offering fuzzy searching and previewing of headings across files to streamline task relocation and quick note insertion.
Capture templates in Org-mode extend through packages like org-protocol, which registers a custom URL scheme (org-protocol://) to pull content from browsers or the clipboard directly into Emacs for rapid entry creation.[65] Deft complements this by indexing and searching directories of Org files, providing a lightweight interface for retrieving and editing notes based on content matches.[66]
Visual enhancements improve readability during editing. The org-bullets package replaces standard asterisk bullets with customizable UTF-8 icons, making Org hierarchies more visually distinct without altering the underlying plain-text structure.[67] The org-modern package applies contemporary font locking and text properties to style headlines, keywords, tables, and source blocks for a more polished editing experience.[68] Org-transclusion allows inserting copies of external text content via file or ID links, enabling dynamic inclusion of snippets from other Org files or sources.[69] For focused writing sessions, writeroom-mode activates a full-screen, distraction-free environment that centers text and hides Emacs UI elements, often combined with Org-mode for composing long-form documents.[70]
Version control integration with Magit allows treating Org files as standard repositories, supporting commits, diffs, and branching directly in Emacs. Users can configure Git hooks via Magit to automate Org-specific actions, such as tangling source blocks to code files upon commit, ensuring derived outputs stay synchronized with the source documentation.
External Tool Compatibility
Org-mode extends its utility beyond the Emacs environment through compatibility with various external tools, enabling workflows across mobile, desktop, and web platforms. Mobile applications facilitate on-the-go editing and viewing of Org files. Orgzly Revived, a community-maintained Android outliner (fork of the original Orgzly, whose development halted around 2021), supports notebooks in Org format with synchronization via local directories, Dropbox, or WebDAV, allowing users to manage notes and to-do lists offline; it received updates as of October 2025.[71] [72] Similarly, beorg provides robust iOS support for viewing, searching, editing, and agenda management of Org files, with synchronization via iCloud, Dropbox, WebDAV, or other folder providers; it supports custom task states, priorities, tags, and local notifications. MobileOrg, a legacy iOS app last updated in 2020, offers basic viewing, searching, and partial editing using an asymmetric push-pull mechanism over WebDAV or Dropbox—users push agenda files from Emacs to a staging directory withorg-mobile-push, capture notes on the device, and pull changes back into Emacs via org-mobile-pull—but may have compatibility limitations with current iOS and Org-mode versions.[73] [74]
Desktop viewers and editors outside Emacs enhance accessibility for non-Emacs users. Pandoc, a universal document converter, fully supports Org-mode as an input format, enabling exports to HTML, PDF, Markdown, and other formats while preserving features like headings, lists, tables, and links.[75] For syntax highlighting and basic outlining in Visual Studio Code, the vscode-org-mode extension emulates key Org-mode functionalities, such as folding headlines and TODO state management.[76] Presentations can be created by exporting Org files to LaTeX Beamer or using tools like org-present within Emacs for minimalist slide decks, though external viewers rely on the resulting PDF or HTML outputs.[77]
Synchronization solutions bridge Org-mode with cloud services and calendars. File-level syncing with Nextcloud or ownCloud is achieved by storing .org files in shared directories, often paired with mobile apps like Orgzly Revived or beorg for seamless updates across devices.[78] For calendar integration, the org-caldav package enables bidirectional synchronization of Org-mode agendas and TODO items with CalDAV servers like Nextcloud via iCalendar (.ics) files, supporting deadlines, timestamps, and recurring events.[79] Additionally, Org-mode's built-in iCalendar export functionality generates .ics files from agendas, which can be imported into Google Calendar for viewing and sharing.[39]
Publishing workflows leverage Org-mode exports for static site generation. Exported HTML from Org files integrates with Hugo via the ox-hugo backend, which converts Org syntax to Hugo-compatible Markdown with front-matter for themes, taxonomies, and builds.[80] Jekyll supports Org-mode through plugins like jekyll-org, allowing posts in .org format to be processed into HTML during site builds.[81] For print-ready documents, Org-mode's LaTeX export backend produces .tex files compilable to PDF using pdflatex, incorporating packages for bibliographies, indexes, and complex layouts.[82]
API and scripting capabilities allow external automation of Org-mode features. The org-element-parse-buffer function parses the entire buffer into a structured abstract syntax tree, enabling programmatic access to elements like headlines, links, and properties for custom tools or integrations.[83] Org-protocol provides a URL scheme for external applications, such as browsers, to dispatch actions like capturing links or notes directly into Org buffers via Emacs server.[84]