doomemacs/modules/lang/org
Henrik Lissner 0e851ace9b
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.

Fixes #2802, #2737, #2386

The big highlights are:

- Fix #2802: We now update recipe repos *before* updating/installing any
  new packages. No more "Could not find package X in recipe repositories".

- Fix #2737: An edge case where straight couldn't reach a pinned
  commit (particularly with agda).

- Doom is now smarter about what option it recommends when straight
  prompts you to make a choice.

- Introduces a new init path for Doom. The old way:
  - Launch in "minimal" CLI mode in non-interactive sessions
  - Launch a "full" interactive mode otherwise.
  The new way
  - Launch in "minimal" CLI mode *only* for bin/doom
  - Launch is a simple mode for non-interactive sessions that still need
    access to your interactive config (like async org export/babel).
  - Launch a "full" interactive mode otherwise.

  This should fix compatibility issues with plugins that use the
  async.el library or spawn child Emacs processes to fake
  parallelization (like org's async export and babel functionality).

- Your private init.el is now loaded more reliably when running any
  bin/doom command. This gives you an opportunity to configure its
  settings.

- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
  deferred activation of a number of packages. Users can remove these
  modes from these hooks; altogether preventing them from loading,
  rather than waiting for them to load to then disable them,
  e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
  'doom-first-buffer #'smartparens-global-mode)

  Hooks added to doom-first-*-hook variables will be removed once they
  run.

  This should also indirectly fix #2386, by preventing interactive modes
  from running in non-interactive session.

- Added `doom/bump-*` commands to make bumping modules and packages
  easier, and `doom/bumpify-*` commands for converting package!
  statements into user/repo@sha1hash format for bump commits.

- straight.el is now commit-pinned, like all other packages. We also
  more reliably install straight.el by cloning it ourselves, rather than
  relying on its bootstrap.el.

  This should prevent infinite "straight has diverged from master"
  prompts whenever we change branches (though, you might have to put up
  with it one more after this update -- see #2937 for workaround).

All the other minor changes:

- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
  simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
  already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
  trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
  doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
  1. Child instances will no longer inherit the process environment of
     the host instance,
  2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-15 01:33:52 -04:00
..
autoload Fix zr, zm, zR & zM vimmish folding in org-mode 2020-05-13 19:31:09 -04:00
contrib Fix journal org files not opening in org-journal 2020-05-08 05:46:19 -04:00
test lang/org: fix tests to reflect f70f788df 2019-11-12 16:15:42 -05:00
config.el Backport bits of CLI rewrite 2020-05-15 01:33:52 -04:00
doctor.el Add org-roam doctor check for the dot executable 2020-05-08 14:06:54 +03:00
packages.el Bump :lang org 2020-05-11 03:00:08 -04:00
README.org Alphabetize org flags in readme 2020-04-18 20:42:31 -04:00

lang/org

Description

This module adds org-mode support to Doom Emacs, along with a number of adjustments, extensions and reasonable defaults to make it more performant and intuitive out of the box:

  • A custom, centralized attachment system that stores files in one place, rather than in the same directory as the input file(s) (only applies to attachments from files in/under org-directory).
  • Executable code blocks with support for a variety of languages and tools (depending on what :lang modules are enabled).
  • Supports an external org-capture workflow through the bin/org-capture shell script and +org-capture/open-frame.
  • A configuration for using org-mode for slide-show presentations or exporting org files to reveal.js slideshows.
  • Drag-and-drop support for images (with inline preview) and media files (drops a file icon and a short link) (requires +dragndrop flag).
  • Integration with pandoc, ipython, jupyter, reveal.js, beamer, and others (requires flags).
  • Export-to-clipboard functionality, for copying text into formatted html, markdown or rich text to the clipboard (see +org/export-to-clipboard and +org/export-to-clipboard-as-rich-text).

Org is a system for writing plain text notes with syntax highlighting, code execution, task scheduling, agenda management, and many more. The whole idea is that you can write notes and mix them with references to things like articles, images, and example code combined with the output of that code after it is executed.

https://www.mfoot.com/blog/2015/11/22/literate-emacs-configuration-with-org-mode/

Module Flags

  • +brain Enables org-brain integration.
  • +dragndrop Enables drag-and-drop support for images and files; inserts inline previews for images and an icon+link for other media types.
  • +gnuplot Installs gnuplot & gnuplot-mode, which enables rendering images from gnuplot src blocks or plotting tables with org-plot/gnuplot (bound to SPC m b p, by default).
  • +hugo Enables integration with hugo to export from Emacs well-formed (blackfriday) markdown.
  • +ipython (DEPRECATED) Enables ipython integration for babel.
  • +journal Enables org-journal integration.
  • +jupyter Enables Jupyter integration for babel.
  • +noter Enables org-noter integration. Keeps notes in sync with a document. Requires pdf-tools (:tools pdf) or DocView or nov.el to be enabled.
  • +pandoc Enables pandoc integration into the Org exporter.
  • +pomodoro Enables a pomodoro timer for clocking time on tasks.
  • +present Enables integration with reveal.js, beamer and org-tree-slide, so Emacs can be used for presentations.
  • +roam Enables org-roam integration.

Plugins

Hacks

  • The window is recentered when following links.
  • The breadcrumbs displayed in eldoc when hovering over an org headline has been reworked to strip out link syntax and normalize font-size disparities.
  • If :ui workspaces is enabled, persp-mode won't register org agenda buffers that are temporarily opened in the background.
  • Temporary org agenda files aren't added to recentf.
  • file: links are highlighted with the error face if they are broken.
  • TAB was changed to toggle only the visibility state of the current subtree, rather than cycle through it recursively. This can be reversed with:

    (after! evil-org
      (remove-hook 'org-tab-first-hook #'+org-cycle-only-current-subtree-h))
  • (Evil users) Nearby tables are formatted when exiting insert or replace mode (see +org-enable-auto-reformat-tables-h).
  • Statistics cookies are updated when saving the buffer of exiting insert mode (see +org-enable-auto-update-cookies-h).
  • Org-protocol has been lazy loaded (see +org-init-protocol-lazy-loader-h); loaded when the server receives a request for an org-protocol:// url.
  • Babel and babel plugins are now lazy loaded (see +org-init-babel-lazy-loader-h); loaded when a src block is executed. No need to use org-babel-do-load-languages in your config, just install your babel packages to extend language support (and ensure its org-babel-execute:* function is autoloaded).
  • If a variable is used as a file path in org-capture-template, it will be resolved relative to org-directory, instead of default-directory (see +org-capture-expand-variable-file-a).

Prerequisites

Org has a few soft dependencies that you will need to make use of Org's more esoteric features:

  • For inline LaTeX previews, you need latex and dvipng.
  • For rendering GNUPlot images (with +gnuplot flag) you need the gnuplot program installed.
  • To run babel code blocks, you need whatever dependencies those languages need. It is recommended you enable the associated :lang module and ensure its dependencies are met, e.g. install the ruby executable for ruby support.

MacOS

brew cask install mactex
brew install gnuplot

Arch Linux

pacman -S texlive-core texlive-bin texlive-science
pacman -S gnuplot

NixOS

environment.systemPackages = with pkgs; [
  # any less than medium isn't guaranteed to work
  texlive.combined.scheme-medium
];

TODO Windows

Features

Invoking the org-capture frame from outside Emacs

The simplest way to use the org-capture frame is through the bin/org-capture script. I'd recommend binding a shortcut key to it. If Emacs isn't running, it will spawn a temporary daemon for you.

Alternatively, you can call +org-capture/open-frame directly, e.g.

emacsclient --eval '(+org-capture/open-frame INTIAL-INPUT KEY)'

Built-in custom link types

This module defines a number of custom link types in +org-init-custom-links-h. They are (with examples):

  • doom-docs:news/2.1.0 (~/.emacs.d/docs/%s)
  • doom-modules:editor/evil/README.org (~/.emacs.d/modules/%s)
  • doom-repo:issues (https://github.com/hlissner/doom-emacs/%s)
  • doom:core/core.el (~/.emacs.d/%s)
  • duckduckgo:search terms
  • gimages:search terms (Google Images)
  • github:hlissner/doom-emacs
  • gmap:Toronto, Ontario (Google Maps)
  • google:search terms
  • org:todo.org ({org-directory}/%s)
  • wolfram:sin(x^3)
  • youtube:P196hEuA_Xc (link only)
  • yt:P196hEuA_Xc (like youtube, but includes an inline preview of the video)

Configuration

Changing org-directory

To modify org-directory it must be set before org has loaded:

;; ~/.doom.d/config.el
(setq org-directory "~/new/org/location/")

Changing org-noter-notes-search-path

To modify org-noter-notes-search-path set:

;; ~/.doom.d/config.el
(setq org-noter-notes-search-path '("~/notes/path/"))