<-- back RSS Feed

Org Mode

What is org-mode

Org mode is short for "organizing mode" as far as I am aware, however it is much more powerful than the name lets on. Org is a markup language similar to markdown. The main advantage of my use of org-mode over something like markdown is the functions I have written to make my workflow much better. The basic structure of an org document uses '*'s to denote levels of headings.

	* This is a top level heading
	** This heading is beneath
	This is some regular text.

This is similar to markdown which uses a '#' instead of a '*' to denote hierarchy. Org-mode also handles tables far better than markdown as emacs will automatically adjust the size of tables to fit the contents so you don't have to mess around with them. Something that makes the org-mode way of handling tables rather unique is that they are essentially spreadsheets and as such you can perform mathematical functions on cells.


Emacs allows you to export org-mode documents using 'C-c C-e' this brings up a menu that you can use to export into various formats. A personal favourite is that you can create PDF files by exporting org documents through LaTex. Or create its own LaTeX buffer that you can modifiy before you export it. You can also include in-line LaTeX code in your org so that you are able to use the versatility of LaTeX handling of symbols etc.

My functions

My full emacs config is available here.

The main function that I use is one written by a reddit user, I can't remember his username but I will credit him if I find it called 'org-open-point'.

      (defun org-open-point ()
        "Open org mode heading in another window, expand it, and narrow it"
        (setq goal-point (point))
        (call-interactively #'clone-indirect-buffer-other-window)
        (while (not (= goal-point (point)))
          (goto-char goal-point)
          (goto-char goal-point)
        (call-interactively #'org-next-visible-heading)
        (narrow-to-region goal-point (point))
        (goto-char goal-point)
          (fset 'tab
     	      (lambda (&optional arg) "Keyboard macro." (interactive "p")
       	      (kmacro-exec-ring-item (quote ([tab] 0 "%d")) arg)))

What this does is, it will open the contents of an org-mode point in its own so that you can work on it seperately to the rest of the document. This is integral to my workflow as I like to keep 1 buffer on the left with all the points collapsed as a kind of directory and whatever I am currently working on, in another buffer on the right. One problem with this, is it kind of bugs out the point you are writing in so that it will output into the 'directory' buffer on the left outside of the collapsed point like so

	* Collapsed heading...Here is the text I am writing in the other buffer.

The way around this was to format the points so that there is a full stop at the end of the point before I start wrting. This stopped the weird behaviour from before. Here is another function to automate the creation of that formatted heading.

	(defun org-collapsed-point () 
      (let ((org-M-RET-may-split-line nil) ;don't split header line
            (header-name (read-string "New header: ")))
           (insert header-name "\n.")

There is another function that does the same thing essentially but calls org-open-point immeadiately after. These functions in conjunction with the (kill-buffer-and-window) function built in to emacs allow me to write org files very efficently.


Todos in org are very simple, they are simply denoted by a TODO before them. They can be assigned deadlines or scheduled times to do them. I use TODOs in conjunction with 2 apps, Syncthing and Orgzly to get my todo files on my phone.