### Link Examples Source: https://orgmode.org/quickstart.html Provides examples of creating internal and external links in Org mode. ```org [[https://orgmode.org][a nice website]] [[file:~/Pictures/dank-meme.png]] [[earlier heading][an earlier heading in the document]] ``` -------------------------------- ### Example Block Source: https://orgmode.org/quickstart.html Shows a basic example block for monospace text. ```org #+begin_example monospace #+end_example ``` -------------------------------- ### Startup Keyword Example Source: https://orgmode.org/orgguide.html An example of a STARTUP keyword in an Org file to configure initial visibility. ```org #+STARTUP: content ``` -------------------------------- ### Preamble Example Source: https://orgmode.org/quickstart.html Example of setting title, author, and export options at the beginning of an Org file. ```org #+title: The glories of Org #+author: A. Org Writer ``` -------------------------------- ### List Example Source: https://orgmode.org/quickstart.html Shows examples of unordered and ordered lists, including nested lists and checkboxes. ```org To buy: 1. Milk 2. Eggs - Organic 3. Cheese + Parmesan + Mozzarella ``` ```org - [ ] not started - [-] in progress - [X] complete ``` ```org - [ ] fruits :: get apples - [X] veggies :: get carrots ``` -------------------------------- ### Org Startup Keyword Example Source: https://orgmode.org/guide/Visibility-Cycling.html Example of using the #+STARTUP keyword to configure the initial visibility of an Org file. ```org #+STARTUP: content ``` -------------------------------- ### Heading Example Source: https://orgmode.org/quickstart.html Demonstrates Org mode headings with different levels and TODO keywords. ```org * Welcome to Org-mode ** Sub-heading Each extra ~*~ increases the depth by one level. ``` ```org * TODO Promulgate Org to the world ** TODO Create a quickstart guide ``` -------------------------------- ### Image Link Example Source: https://orgmode.org/quickstart.html Demonstrates how to link to an image in Org mode for export. ```org [[https://upload.wikimedia.org/wikipedia/commons/5/5d/Konigsberg_bridges.png]] ``` -------------------------------- ### Org mode macros Source: https://orgmode.org/quickstart.html Examples of Org mode macros for text formatting and styling. ```Org mode #+macro: attn _*/$1/*_ {{{attn(Attention! This text gets all the markup!)}}} #+html_head: #+latex_header: \usepackage{xcolor} #+macro: red @@html:$1@@@@latex:\textcolor{red}{$1}@@ Regular text. {{{red(This text will be red.)}}} More regular text. ``` -------------------------------- ### Table Example Source: https://orgmode.org/orgguide.html An example of a plain ASCII table in Org mode. ```Org mode | Name | Phone | Age | |-------+-------+-----| | Peter | 1234 | 17 | | Anna | 4321 | 25 | ``` -------------------------------- ### Minimal Emacs Session for Testing Source: https://orgmode.org/manual/Feedback.html Example command to start Emacs with a minimal setup for testing Org mode issues. ```Shell $ emacs -Q -l /path/to/minimal-org.el ``` -------------------------------- ### Source Block Example Source: https://orgmode.org/quickstart.html Illustrates an Org babel source block for Emacs Lisp. ```org #+begin_src emacs-lisp (message "Hello world") #+end_src ``` -------------------------------- ### Publish script example Source: https://orgmode.org/worg/worg-setup.html An example of the publish.sh script that can be adapted for local testing. It highlights the importance of setting the load path for org-mode and htmlize.el. ```shell #!/bin/sh # Example publish.sh script # Set load path for org-mode and htmlize.el export EMACS_LOAD_PATH="/path/to/emacs/lisp" # Run the org export process emacs --batch --eval "(require 'ox-html)" --eval "(org-html-export-to-html-batch \"your-org-file.org\")" # Upload generated HTML pages (example using rsync) rsync -avz "./html/" "user@orgmode.org:/path/to/webroot/" ``` -------------------------------- ### Minimal Org Mode Setup File Source: https://orgmode.org/manual/Feedback.html Example content for a minimal setup file to load the latest Org mode and enable debugging. ```Emacs Lisp ;;; Minimal setup to load latest `org-mode'. ;; Activate debugging. (setq debug-on-error t debug-on-signal nil debug-on-quit nil) ;; Add latest Org mode to load path. (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp")) ``` -------------------------------- ### Org Link Examples Source: https://orgmode.org/orgguide.html Examples of various link types supported by Org mode. ```org-mode ‘http://www.astro.uva.nl/=dominik’| on the web ‘file:/home/dominik/images/jupiter.jpg’| file, absolute path ‘/home/dominik/images/jupiter.jpg’| same as above ‘file:papers/last.pdf’| file, relative path ‘./papers/last.pdf’| same as above ‘file:projects.org’| another Org file ‘docview:papers/last.pdf::NNN’| open in DocView mode at page NNN ‘id:B7423F4D-2E8A-471B-8810-C40F074717E9’| link to heading by ID ‘news:comp.emacs’| Usenet link ‘mailto:adent@galaxy.net’| mail link ‘mhe:folder#id’| MH-E message link ‘rmail:folder#id’| Rmail message link ‘gnus:group#id’| Gnus article link ‘bbdb:R.*Stallman’| BBDB link (with regexp) ‘irc:/irc.com/#emacs/bob’| IRC link ‘info:org#Hyperlinks’| Info node link ``` ```org-mode ‘file:~/code/main.c::255’| Find line 255 ‘file:~/xx.org::My Target’| Find ‘<>’ ‘[[file:~/xx.org::#my-custom-id]]’| Find entry with a custom ID ``` -------------------------------- ### File-local TODO keyword setup Source: https://orgmode.org/elpa.html Example of setting file-specific TODO keywords and their interpretation. ```Org Mode #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED ``` ```Org Mode #+TYP_TODO: Fred Sara Lucy Mike | DONE ``` ```Org Mode #+TODO: TODO(t) | DONE(d) #+TODO: REPORT(r) BUG(b) KNOWNCAUSE(k) | FIXED(f) #+TODO: | CANCELED(c) ``` -------------------------------- ### Simple Org mode table Source: https://orgmode.org/quickstart.html A basic example of an Org mode table using pipe characters for separation. ```Org mode | I | am | a | table | | with | two | rows | ! | ``` -------------------------------- ### Makefile configuration for info directory Source: https://orgmode.org/worg/org-faq Example Makefile snippet showing how to specify the info directory during installation. ```makefile # Where local software is found prefix=/path/to/emacs-root ... # Where info files go. infodir = $(prefix)/share/info ``` -------------------------------- ### HTML raw code inline example Source: https://orgmode.org/orgguide.html Example of how to include raw HTML code inline using @@html:...@@ syntax. ```org @@html:@@bold text@@html:@@ ``` -------------------------------- ### Plain List Example Source: https://orgmode.org/orgguide.html An example of a plain list structure in Org mode, including ordered, unordered, and description list items. ```Org mode * Lord of the Rings My favorite scenes are (in this order) 1. The attack of the Rohirrim 2. Eowyn's fight with the witch king + this was already my favorite scene in the book + I really like Miranda Otto. Important actors in this film are: - Elijah Wood :: He plays Frodo - Sean Astin :: He plays Sam, Frodo's friend. ``` -------------------------------- ### Fast access to TODO states setup Source: https://orgmode.org/elpa.html Example configuration for assigning single-letter shortcuts to TODO states for quick access. ```emacs-lisp (setq org-todo-keywords '((sequence "TODO(t)" "|" "DONE(d)") (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)") (sequence "|" "CANCELED(c)"))) ``` -------------------------------- ### Org mode comments Source: https://orgmode.org/quickstart.html Examples of different comment types in Org mode: line, inline, block, and section comments. ```Org mode # A line comment Example of an @@comment:inline@@ comment. Inline comments are used for end of line comments. @@comment:~#~ won't work@@ Since # only only works if preceeded by a newline follow by whitespace. #+begin_comment This is a block comment. It can span multiple line. As well as other markup. #+begin_src emacs-lisp (+ 1 2) #+end_src #+end_comment * A top level heading ** COMMENT This section and subsections are commented out *** This heading inherits the =COMMENT= keyword This text is commented out ** This heading is not commented This text will be exported and code blocks will run. ``` -------------------------------- ### Time Range Input Examples Source: https://orgmode.org/elpa.html Examples of specifying time ranges using start and end times or start time and duration. ```Org mode '11am-1:15pm'| ⇒ 11:00-13:15 '11h-13h15'| ⇒ same as above '11am--1:15pm'| ⇒ same as above '11am+2:15'| ⇒ same as above ``` -------------------------------- ### Ordered List Offset Example Source: https://orgmode.org/worg/org-release-notes.org Example demonstrating how to start an ordered plain list with a number other than 1 using the [@start:N] syntax. ```Org Mode 1. [@start:12] will star a lit a number 12 ``` -------------------------------- ### Literal Example with Special Characters Source: https://orgmode.org/manual/Literal-examples.html An example demonstrating the need to escape lines starting with special characters like ',', '#+', or ',#+' by inserting a comma before them. ```org #+BEGIN_EXAMPLE ,* I am no real headline #+END_EXAMPLE ``` -------------------------------- ### Regular Outlines Example Source: https://orgmode.org/worg/users/rpr.html An example of how to start a manuscript outline in Org mode. ```org * TODO Abstract * TODO Introduction * TODO Methods * TODO Results * TODO Discussion * TODO Contributions ``` -------------------------------- ### TODO Item Example Source: https://orgmode.org/guide/TODO-Basics.html An example of a headline that becomes a TODO item by starting with the word 'TODO'. ```org *** TODO Write letter to Sam Fortune ``` -------------------------------- ### Markup Example Source: https://orgmode.org/quickstart.html Illustrates various text markup styles in Org mode like bold, italic, underline, strikethrough, code, and verbatim. ```org To markup text in Org, simply surround it with one or more marker characters. *Bold*, /italic/ and _underline_ are fairly intuitive, and the ability to use +strikethrough+ is a plus. You can _/*combine*/_ the basic markup in any order, however ~code~ and =verbatim= need to be the *_~inner-most~_* markers if they are present since their contents are interpreted =_literally_=. ``` -------------------------------- ### Graphical output example Source: https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-octave-matlab.html Example for getting graphical output without leaving open graph windows during evaluation. ```octave figure( 1, "visible", "off" ); sombrero; print -dpng chart.png; ans = "chart.png"; ``` -------------------------------- ### Setupfile for macros Source: https://orgmode.org/worg/org-release-notes.org Example of how to link to a file containing macro definitions using #+SETUPFILE. ```Org Mode #+SETUPFILE: path/to-file ``` -------------------------------- ### Simple publishing configuration Source: https://orgmode.org/manual/Simple-example.html This example publishes a set of Org files to the ‘public_html’ directory on the local machine. ```emacs-lisp (setq org-publish-project-alist '(("org" :base-directory "~/org/" :publishing-function org-html-publish-to-html :publishing-directory "~/public_html" :section-numbers nil :with-toc nil :html-head ""))) ``` -------------------------------- ### Example of defining allowed values for properties Source: https://orgmode.org/guide/Properties.html Demonstrates how to set allowed values for properties like NDisks and Publisher using _ALL suffix. ```org * CD collection :PROPERTIES: :NDisks_ALL: 1 2 3 4 :Publisher_ALL: "Deutsche Grammophon" Philips EMI :END: ``` -------------------------------- ### org-html-htmlize-output-type Source: https://orgmode.org/worg/doc.html Output type to be used by htmlize when formatting code snippets. Choices are `css' to export the CSS selectors only, `inline-css' to export the CSS attribute values inline in the HTML or `nil' to export plain text. We use as default `inline-css', in order to make the resulting HTML self-containing. However, this will fail when using Emacs in batch mode for export, because then no rich font definitions are in place. It will also not be good if people with different Emacs setup contribute HTML files to a website, because the fonts will represent the individual setups. In these cases, it is much better to let Org/Htmlize assign classes only, and to use a style file to define the look of these classes. To get a start for your css file, start Emacs session and make sure that all the faces you are interested in are defined, for example by loading files in all modes you want. Then, use the command `[org-html-htmlize-generate-css]' to extract class definitions. ```Emacs Lisp Output type to be used by htmlize when formatting code snippets. Choices are `css' to export the CSS selectors only,`inline-css' to export the CSS attribute values inline in the HTML or `nil' to export plain text. We use as default `inline-css', in order to make the resulting HTML self-containing. However, this will fail when using Emacs in batch mode for export, because then no rich font definitions are in place. It will also not be good if people with different Emacs setup contribute HTML files to a website, because the fonts will represent the individual setups. In these cases, it is much better to let Org/Htmlize assign classes only, and to use a style file to define the look of these classes. To get a start for your css file, start Emacs session and make sure that all the faces you are interested in are defined, for example by loading files in all modes you want. Then, use the command `\[org-html-htmlize-generate-css]' to extract class definitions. ``` -------------------------------- ### One-time install with ORG_ADD_CONTRIB Source: https://orgmode.org/worg/dev/org-build-system.html Example of a one-time install command specifying ORG_ADD_CONTRIB with quoting for a POSIX shell. ```shell make ORG_ADD_CONTRIB="ox-*" install ``` -------------------------------- ### Compiling and installing Org-mode Source: https://orgmode.org/worg/org-faq Commands to compile, install, and build documentation for Org-mode. ```bash $ cd $HOME/elisp/org-mode && make ``` ```bash $ cd $HOME/elisp/org-mode && make uncompiled ``` ```bash $ cd $HOME/elisp/org-mode && make install ``` -------------------------------- ### org-file-apps Configuration Example Source: https://orgmode.org/worg/doc.html This example shows how to configure org-file-apps to open PDF files with the 'evince' application. ```Emacs Lisp ("pdf" . "evince %s") ``` -------------------------------- ### Basic Org-mode Activation and Key Bindings Source: https://orgmode.org/worg/org-configs/org-customization-guide.html Configuration to activate Org-mode for .org files and set essential global key bindings. ```emacs-lisp (add-to-list 'auto-mode-alist '("\\.org\'" . org-mode)) (global-set-key "\C-cl" 'org-store-link) (global-set-key "\C-ca" 'org-agenda) ;; (global-font-lock-mode 1) Not needed in recent emacsen ``` -------------------------------- ### Structure Templates Example Source: https://orgmode.org/guide/Miscellaneous.html Example of inserting a structure template using `org-insert-structure-template`. ```Emacs Lisp C-c C-, (org-insert-structure-template) ``` -------------------------------- ### Configuring Agenda Start Day Source: https://orgmode.org/elpa.html Example of setting the start date for weekly agendas using a date shift. ```Emacs Lisp (setq org-agenda-start-day "+10d") ``` -------------------------------- ### Source Code Example Source: https://orgmode.org/orgguide.html If the example is source code from a programming language, or any other text that can be marked up by Font Lock in Emacs, you can ask for the example to look like the fontified Emacs buffer. ```emacs-lisp (defun org-xor (a b) "Exclusive or." (if a (not b) b)) ``` -------------------------------- ### Automatically Start Clock in Capture Template Source: https://orgmode.org/worg/org-faq Example of adding `:clock-in t` and `:clock-resume t` parameters to an Org capture template to automatically start the clock. ```emacs-lisp (require 'org-capture) (add-to-list 'org-capture-templates `("c" "Call" entry (file "~/Org/inbox.org") "* Call with %?" :clock-in t :clock-resume t)) ``` -------------------------------- ### org-protocol-protocol-alist example Source: https://orgmode.org/worg/doc.html Example of how to register custom handlers for org-protocol. ```emacs-lisp (setq org-protocol-protocol-alist \='(("my-protocol" :protocol "my-protocol" :function my-protocol-handler-function) ("your-protocol" :protocol "your-protocol" :function your-protocol-handler-function))) ``` -------------------------------- ### Drawer syntax example Source: https://orgmode.org/worg/org-release-notes.org Example of how to create a drawer in Org mode. ```Org mode :HIDDEN: here is some stuff that remains hidden unless TAB is pressed directly in that line :END: ``` -------------------------------- ### Texinfo Definition Commands - Function Example Source: https://orgmode.org/elpa.html Example of a description list item in Org mode starting with 'Function:' being converted to a Texinfo @defun command. ```org - Function: org-texinfo-drawer drawer contents info :: Transcode a DRAWER element from Org to Texinfo. ``` -------------------------------- ### Slide Presentation Export Setup Source: https://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html Example of a level-0-slides.org file for presentation export setup with specific stylesheets and JS options. ```Org Mode #+INFOJS_OPT: path:org-info.js #+INFOJS_OPT: toc:nil view:slide #+STYLE: ``` -------------------------------- ### orgstruct-setup-hook Example Source: https://orgmode.org/worg/doc.html Hook run after orgstruct-mode-map is filled. ```Emacs Lisp Hook run after orgstruct-mode-map is filled. ``` -------------------------------- ### TODO dependencies example Source: https://orgmode.org/elpa.html Illustrates how to set up dependencies between tasks, including ordered subtasks and blocking mechanisms. ```Org Mode * TODO Blocked until (two) is done ** DONE one ** TODO two * Parent :PROPERTIES: :ORDERED: t :END: ** TODO a ** TODO b, needs to wait for (a) ** TODO c, needs to wait for (a) and (b) ``` ```Org Mode * This entry is never blocked :PROPERTIES: :NOBLOCKING: t :END: ``` -------------------------------- ### Plain List Example Source: https://orgmode.org/guide/Plain-Lists.html An example demonstrating the structure of unordered, ordered, and description lists within an Org Mode entry. ```org * Lord of the Rings My favorite scenes are (in this order) 1. The attack of the Rohirrim 2. Eowyn's fight with the witch king + this was already my favorite scene in the book + I really like Miranda Otto. Important actors in this film are: - Elijah Wood :: He plays Frodo - Sean Astin :: He plays Sam, Frodo's friend. ``` -------------------------------- ### Example of defining properties for an entry Source: https://orgmode.org/guide/Properties.html Shows how to define key-value pairs within a PROPERTIES drawer for an Org Mode entry. ```org * CD collection ** Classic *** Goldberg Variations :PROPERTIES: :Title: Goldberg Variations :Composer: J.S. Bach :Publisher: Deutsche Grammophon :NDisks: 1 :END: ``` -------------------------------- ### Applying Export Options Template Source: https://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html How to apply a setup file and set a title in Org-mode files. ```Org Mode #+SETUPFILE: ~/.emacs.d/org-templates/level-N.org #+TITLE: My Title ``` -------------------------------- ### Starting Emacs with a Minimal Init File Source: https://orgmode.org/worg/org-faq Command to start Emacs with a minimal configuration file, useful for debugging. ```shell emacs -Q -l ~/minimal.emacs ``` -------------------------------- ### Numbered Source Code Example Source: https://orgmode.org/manual/Literal-examples.html Demonstrates adding line numbers to source code snippets using the '-n' switch, with an option to specify the starting line number. ```emacs-lisp #+BEGIN_SRC emacs-lisp -n 20 ;; This exports with line number 20. (message "This is line 21") #+END_SRC ``` -------------------------------- ### Logging configuration example Source: https://orgmode.org/worg/org-release-notes.org Example showing how to configure logging for state changes on a per-keyword basis. ```emacs-lisp WAIT(w@) Record a note when entering this state. WAIT(w!) Record a timestamp when entering this state. WAIT(w@/!) Recore a note when entering and timestamp when leaving this state. This is great for getting a record when switching *back* from WAIT to TODO. WAIT(/!) Record a timestamp when leaving this state. Here we not even define a fast access character, but just the logging stuff. ``` -------------------------------- ### HTML raw code block examples Source: https://orgmode.org/orgguide.html Examples of including raw HTML code using #+HTML: and #+BEGIN_EXPORT html ... #+END_EXPORT blocks. ```org #+HTML: Literal HTML code for export #+BEGIN_EXPORT html All lines between these markers are exported literally #+END_EXPORT ``` -------------------------------- ### Time Range Input Examples Source: https://orgmode.org/manual/The-date_002ftime-prompt.html Examples of specifying time ranges using dash separators for start/end times or '+' for start time and duration. ```Org mode ‘11am-1:15pm’| ⇒ 11:00-13:15 ``` ```Org mode ‘11h-13h15’| ⇒ same as above ``` ```Org mode ‘11am--1:15pm’| ⇒ same as above ``` ```Org mode ‘11am+2:15’| ⇒ same as above ``` -------------------------------- ### Multiple keyword sets in one file setup Source: https://orgmode.org/elpa.html Example configuration for using different sets of TODO keywords in parallel within a single Org mode file, such as for bug fixing workflows. ```emacs-lisp (setq org-todo-keywords '((sequence "TODO" "|" "DONE") (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED") (sequence "|" "CANCELED"))) ``` -------------------------------- ### External Link Examples Source: https://orgmode.org/guide/Hyperlinks.html Various examples of external links supported by Org Mode, including web, file, and specific application links. ```Org Mode http://www.astro.uva.nl/=dominik ``` ```Org Mode file:/home/dominik/images/jupiter.jpg ``` ```Org Mode /home/dominik/images/jupiter.jpg ``` ```Org Mode file:papers/last.pdf ``` ```Org Mode ./papers/last.pdf ``` ```Org Mode file:projects.org ``` ```Org Mode docview:papers/last.pdf::NNN ``` ```Org Mode id:B7423F4D-2E8A-471B-8810-C40F074717E9 ``` ```Org Mode news:comp.emacs ``` ```Org Mode mailto:adent@galaxy.net ``` ```Org Mode mhe:folder#id ``` ```Org Mode rmail:folder#id ``` ```Org Mode gnus:group#id ``` ```Org Mode bbdb:R.*Stallman ``` ```Org Mode irc:/irc.com/#emacs/bob ``` ```Org Mode info:org#Hyperlinks ``` -------------------------------- ### Create a bare Git repository on a USB stick Source: https://orgmode.org/worg/org-tutorials/org-vcs.html Initializes a bare Git repository on a mounted USB stick. ```bash cd /media/usbstick mkdir myrepo.git cd myrepo.git git init --bare ``` -------------------------------- ### File-level Tags Source: https://orgmode.org/guide/Tags.html Example of setting tags that all entries in a file should inherit. ```org #+FILETAGS: :Peter:Boss:Secret: ``` -------------------------------- ### Create a bare Bazaar repository on a USB stick Source: https://orgmode.org/worg/org-tutorials/org-vcs.html Initializes a Bazaar repository on a mounted USB stick without storing working copies. ```bash bzr init-repo --no-trees /media/disk/bzr-repo ``` -------------------------------- ### Setup Emacs server on GNU/Linux, BSD, and Unix variants Source: https://orgmode.org/worg/org-contrib/org-protocol.html Add the following lines to the Emacs initialization file (`init.el`, `$HOME/.emacs`) to start Emacs server. ```emacs-lisp (server-start) (require 'org-protocol) ``` -------------------------------- ### Headline Structure Example Source: https://orgmode.org/guide/Headlines.html Demonstrates the hierarchical structure of headlines using stars. ```org * First (top) level headline ** Second level *** Third level some text *** Third level more text * Another first (top) level headline ```