Using org-mode as the ultimate note taking tool

Whenever there is something important to memorize, I always want to write it down. In fact, Emacs org-mode makes the process easy, pleasant, and in an organized manner. I will use an example to explain how Emacs and org fit into my note-taking process.

I have a dedicated folder containing all my notes, and IT, as one of the most important topic, is a sub-folder. Here is the tree structure of the IT folder.

IT
|-- Acrobat
|   `-- startup_script.org
|-- Emacs
|   |-- debug-lisp.html
|   |-- debug-lisp.org
|   |-- emergency-elisp-steve-yegge.html
|   |-- emergency-lisp.html
|   |-- emergency-lisp.org
|   |-- lisp-programming.html
|   `-- lisp-programming.org
|-- Excel
|   `-- group_formatting.txt
|-- Firefox
|   `-- Firefox Recovery Key.html
|-- HPC
|   |-- Setup_GATE_tool_chain_20100902.lnk
|   |-- bashrc_setup
|   |   `-- bashrc_HPC
|   |-- efficient-way-of-working.html
|   |-- efficient-way-of-working.org
|   |-- tricks.html
|   |-- tricks.org
|   `-- xinhua-hps-bashrc
|-- Linux_commands
|   |-- cat.html
|   |-- cat.org
|   |-- count_files_in_dir.html
|   |-- count_files_in_dir.org
|   |-- find.html
|   |-- find.org
|   |-- find.txt
|   |-- linux_commands.html
|   |-- linux_commands.org
|   |-- scp.txt
|   |-- sed.html
|   |-- sed.org
|   |-- sed_commandline_editor.txt
|   `-- tar.txt
|-- VBA
|   `-- VBA_study_notes.org
|-- X11_cygwin
|   `-- startxwin_of_Xinhua.sh
|-- c++
|   |-- ACM-UNIX-Tutorial-Compiler.html
|   |-- C++Quick-Ref.html
|   |-- C++Std-Lib-Quick-Ref.html
|   |-- Makefiles-short.html
|   `-- gcc-intro.html
|-- cygwin
|   `-- how_to_write_.bashrc_correctly_for_cygwin.org
|-- g++
|   |-- g++compiling.txt
|   |-- gcc&g++.html
|   |-- gcc&g++.org
|   `-- note.txt
|-- gdb
|   |-- debug-tools.html
|   `-- debug-tools.org
|-- latex
|   |-- cygwin_latex_problem.html
|   |-- cygwin_latex_problem.org
|   |-- sumatrapdf-make-emacs_integration.html
|   `-- sumatrapdf-make-emacs_integration.org
|-- make
|   |-- note.html
|   `-- note.org
|-- python
|   |-- math.html
|   `-- math.org
|-- shell
|   |-- bashrc_and_others.htm
|   |-- bashrc_and_others_files
|   |   |-- css_2ad809fd00fb2c1d453a0d2b83bf7b57.css
|   |   |-- ga.js
|   |   |-- gumdrop.png
|   |   |-- index2.jpg
|   |   |-- js_957ff3e13d89532193faea68e21100f9.js
|   |   |-- js_c59e4e9c853d32975fd97f7345ddbabe.js
|   |   `-- show_ads.js
|   |-- notes.html
|   |-- notes.org
|   |-- programming.html
|   `-- programming.org
`-- ssh
    |-- How to set up SSH (for the beginner).pdf
    |-- no_password_access.html
    `-- no_password_access.org

As can be seen, almost every note has two forms: one org file, one html file. The reason that I am showing the IT folder here is to show how I organize my notes through a tree structure representing the hierarchy of related topics.

When I want to take a note, I always think first where does the topic fit into my hierarchal folder systems. Take the Linux command sed for example, I feel like it should be put in IT/Linux_commands/. Thus I enter a emacs function “notes”, which is defined in my .emacs file as

(defun notes ()
  "Switch to my work dir."
   (interactive)
   (find-file "<PATH TO MY NOTES>")
   )

This quickly bring me to my top level dir of all notes, in a dired buffer. Then I quickly follow the hierarchy to IT/Linux_commands/, where I open a file called “sed.org” via [C-x C-f sed.org]

When the file is open, I call another function “make-header”, which I customized from header2 for my own purpose. The function will generate a file header for me automatically, here is the result for the sed.org:

#+TITLE: sed
#+AUTHOR: Da Zhang
#+OPTIONS: H:2 num:t toc:nil
#+OPTIONS: ^:nil
#+OPTIONS: <:nil todo:nil *:t ^:{} @:t ::t |:t TeX:t
#how to change image size: #+attr_html: width="40%"

Basically it will do the following:

  1. set the title to be the file name of the buffer, without its parent path and extension;
  2. set up the options for org mode
  3. insert a note for myself about changing the picture size in org-to-html export, which I still did not remember

Then I just start writing down the quick note about sed.

* how to use variable in a sed: use "" instead of ''
CF http://www.unix.com/shell-programming-scripting/14085-how-can-i-use-variable-sed.html
 - example: note the $1 in the double quotes of the 2nd sed
ORG-LIST-END-MARKER

function sortcsvp() {
    cat $1 | sed '1d' | tr -d '"' | sort -n -t, -k 1 | sed "1 i  $1, , " > ./sort-by-protocol/$1;
}

In most cases I will use #+begin_src and #+end_src for enclose any code, for better appearance in the html output.

At the end, I will just press C-c C-e to export the entire buffer to html, which I will view more frequently from Firefox.

To conclude, Emacs and org-mode offered me a comfort environment for systematically taking notes, organize them, and exporting them into beautiful html pages.

Advertisements

2 thoughts on “Using org-mode as the ultimate note taking tool

    • Hello Chad,

      The reason is to have the title as the name of the file, and the title will appear as the title of the html file after org-export-as-html. Thanks for your comments.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s