+** Worf Mode
+
+[[https://github.com/abo-abo/worf][worf]] mode is an extension of vi-like binding for org-mode.
+In =worf-mode=, it is mapping =[=, =]= as =worf-backward= and =worf-forward= in global, wich
+cause we cannot input =[= and =]=, so here I unset this mappings. And redifined this two to
+=M-[= and =M-]=. see this [[https://github.com/abo-abo/worf/issues/19#issuecomment-223756599][issue]]
+
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+
+ (use-package worf
+ :ensure t
+ :commands worf-mode
+ :init (add-hook 'org-mode-hook 'worf-mode)
+ ;; :config
+ ;; (define-key worf-mode-map "[" nil)
+ ;; (define-key worf-mode-map "]" nil)
+ ;; (define-key worf-mode-map (kbd "M-[") 'worf-backward)
+ ;; (define-key worf-mode-map (kbd "M-]") 'worf-forward)
+ )
+
+#+END_SRC
+
+** Get Things Done
+
+Refer to [[http://doc.norang.ca/org-mode.html][Organize Your Life in Plain Text]]
+*** basic setup
+
+standard key binding
+
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (global-set-key "\C-cl" 'org-store-link)
+ (global-set-key "\C-ca" 'org-agenda)
+ (global-set-key "\C-cb" 'org-iswitchb)
+#+END_SRC
+
+*** Plain List
+
+Replace the list bullet =-=, =+=, with =•=, a litter change based [[https://github.com/howardabrams/dot-files/blob/master/emacs-org.org][here]]
+
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ ;; (use-package org-mode
+ ;; :init
+ ;; (font-lock-add-keywords 'org-mode
+ ;; '(("^ *\\([-+]\\) "
+ ;; (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))))
+#+END_SRC
+
+*** Todo Keywords
+
+refer to [[http://coldnew.github.io/coldnew-emacs/#orgheadline94][fancy todo states]],
+
+To track TODO state changes, the =!= is to insert a timetamp, =@= is to insert a note with
+timestamp for the state change.
+
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ ;; (setq org-todo-keywords
+ ;; '((sequence "☛ TODO(t)" "|" "✔ DONE(d)")
+ ;; (sequence "⚑ WAITING(w)" "|")
+ ;; (sequence "|" "✘ CANCELLED(c)")))
+ ; (setq org-todo-keyword-faces
+ ; (quote ("TODO" . (:foreground "red" :weight bold))
+ ; ("NEXT" . (:foreground "blue" :weight bold))
+ ; ("WAITING" . (:foreground "forest green" :weight bold))
+ ; ("DONE" . (:foreground "magenta" :weight bold))
+ ; ("CANCELLED" . (:foreground "forest green" :weight bold))))
+
+
+ (setq org-todo-keywords
+ (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)")
+ ;; (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE" "MEETING")
+ (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" ))))
+
+ (setq org-todo-keyword-faces
+ (quote (("TODO" :foreground "red" :weight bold)
+ ("NEXT" :foreground "blue" :weight bold)
+ ("DONE" :foreground "forest green" :weight bold)
+ ("WAITING" :foreground "orange" :weight bold)
+ ("HOLD" :foreground "magenta" :weight bold)
+ ("CANCELLED" :foreground "forest green" :weight bold)
+ ;; ("MEETING" :foreground "forest green" :weight bold)
+ ;; ("PHONE" :foreground "forest green" :weight bold)
+ )))
+#+END_SRC
+
+Fast todo selections
+
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (setq org-use-fast-todo-selection t)
+ (setq org-treat-S-cursor-todo-selection-as-state-change nil)
+#+END_SRC
+
+TODO state triggers and tags, [[http://doc.norang.ca/org-mode.html][Organize Your Life in Plain Text]]
+
+- Moving a task to =CANCELLED=, adds a =CANCELLED= tag
+- Moving a task to =WAITING=, adds a =WAITING= tag
+- Moving a task to =HOLD=, add =HOLD= tags
+- Moving a task to =DONE=, remove =WAITING=, =HOLD= tag
+- Moving a task to =NEXT=, remove all waiting/hold/cancelled tags
+
+This tags are used to filter tasks in agenda views
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (setq org-todo-state-tags-triggers
+ (quote (("CANCELLED" ("CANCELLED" . t))
+ ("WAITING" ("WAITING" . t))
+ ("HOLD" ("WAITING") ("HOLD" . t))
+ (done ("WAITING") ("HOLD"))
+ ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
+ ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
+ ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
+#+END_SRC
+
+Logging Stuff
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ ;; log time when task done
+ ;; (setq org-log-done (quote time))
+ ;; save clocking into to LOGBOOK
+ (setq org-clock-into-drawer t)
+ ;; save state change notes and time stamp into LOGBOOK drawer
+ (setq org-log-into-drawer t)
+ (setq org-clock-into-drawer "CLOCK")
+#+END_SRC
+
+*** Tags
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (setq org-tag-alist (quote ((:startgroup)
+ ("@office" . ?e)
+ ("@home" . ?h)
+ (:endgroup)
+ ("WAITING" . ?w)
+ ("HOLD" . ?h)
+ ("CANCELLED" . ?c))))
+
+ ;; Allow setting single tags without the menu
+ (setq org-fast-tag-selection-single-key (quote expert))
+#+END_SRC
+
+*** Capture - Refile - Archive
+
+Capture lets you quickly store notes with little interruption of your work flow.
+
+**** Capture Templates
+
+When a new taks needs to be added, categorize it as
+
+All captured file which need next actions are stored in =refile.org=,
+- A new task / note (t) =refile.org=
+- A work task in office =office.org=
+- A jourenl =diary.org=
+- A new habit (h) =refile.org=
+
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (setq org-directory "~/org")
+ (setq org-default-notes-file "~/org/refile.org")
+ (setq sd/org-diary-file "~/org/diary.org")
+
+ (global-set-key (kbd "C-c c") 'org-capture)
+
+ (setq org-capture-templates
+ (quote (("t" "Todo" entry (file org-default-notes-file)
+ "* TODO %?\n:LOGBOOK:\n- Added: %U\t\tAt: %a\n:END:")
+ ("n" "Note" entry (file org-default-notes-file)
+ "* %? :NOTE:\n:LOGBOOK:\n- Added: %U\t\tAt: %a\n:END:")
+ ("j" "Journal" entry (file+datetree sd/org-diary-file)
+ "* %?\n:LOGBOOK:\n:END:" :clock-in t :clock-resume t)
+ ("h" "Habit" entry (file org-default-notes-file)
+ "* NEXT %?\n:LOGBOOK:\n%a\nSCHEDULED: %(format-time-string \"%<<%Y-%m-%d %a .+1d/3d>>\")\n:END:\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n "))))
+#+END_SRC
+
+**** Refiling Tasks
+
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (setq org-refile-targets (quote (;; (nil :maxlevel . 9)
+ (org-agenda-files :maxlevel . 9))))
+
+ (setq org-refile-use-outline-path t)
+
+ (setq org-refile-allow-creating-parent-nodes (quote confirm))
+#+END_SRC
+
+*** Agenda Setup
+Setting agenda files and the agenda view
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (setq org-agenda-files (quote ("~/org/gtd.org"
+ "~/org/work.org")))
+
+ ;; only show today's tasks in agenda view
+ (setq org-agenda-span 'day)
+ ;; Use current windows for agenda view
+ (setq org-agenda-window-setup 'current-window)
+
+ ;; show all feature entries for repeating tasks,
+ ;; this is already setting by default
+ (setq org-agenda-repeating-timestamp-show-all t)
+
+ ;; Show all agenda dates - even if they are empty
+ (setq org-agenda-show-all-dates t)
+#+END_SRC
+
+** Export PDF
+
+Install MacTex-basic and some tex packages
+
+#+BEGIN_SRC bash
+
+ sudo tlmgr update --self
+
+ sudo tlmgr install titlesec framed threeparttable wrapfig multirow enumitem bbding titling tabu mdframed tcolorbox textpos import varwidth needspace tocloft ntheorem environ trimspaces collection-fontsrecommended capt-of
+
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ ;; ;; allow for export=>beamer by placing
+
+ ;; http://emacs-fu.blogspot.com/2011/04/nice-looking-pdfs-with-org-mode-and.html
+ ;; #+LaTeX_CLASS: beamer in org files
+ (unless (boundp 'org-export-latex-classes)
+ (setq org-export-latex-classes nil))
+ (add-to-list 'org-export-latex-classes
+ ;; beamer class, for presentations
+ '("beamer"
+ "\\documentclass[11pt]{beamer}\n
+ \\mode<{{{beamermode}}}>\n
+ \\usetheme{{{{beamertheme}}}}\n
+ \\usecolortheme{{{{beamercolortheme}}}}\n
+ \\beamertemplateballitem\n
+ \\setbeameroption{show notes}
+ \\usepackage[utf8]{inputenc}\n
+ \\usepackage[T1]{fontenc}\n
+ \\usepackage{hyperref}\n
+ \\usepackage{color}
+ \\usepackage{listings}
+ \\lstset{numbers=none,language=[ISO]C++,tabsize=4,
+ frame=single,
+ basicstyle=\\small,
+ showspaces=false,showstringspaces=false,
+ showtabs=false,
+ keywordstyle=\\color{blue}\\bfseries,
+ commentstyle=\\color{red},
+ }\n
+ \\usepackage{verbatim}\n
+ \\institute{{{{beamerinstitute}}}}\n
+ \\subject{{{{beamersubject}}}}\n"
+
+ ("\\section{%s}" . "\\section*{%s}")
+
+ ("\\begin{frame}[fragile]\\frametitle{%s}"
+ "\\end{frame}"
+ "\\begin{frame}[fragile]\\frametitle{%s}"
+ "\\end{frame}")))
+
+ ;; letter class, for formal letters
+
+ (add-to-list 'org-export-latex-classes
+
+ '("letter"
+ "\\documentclass[11pt]{letter}\n
+ \\usepackage[utf8]{inputenc}\n
+ \\usepackage[T1]{fontenc}\n
+ \\usepackage{color}"
+
+ ("\\section{%s}" . "\\section*{%s}")
+ ("\\subsection{%s}" . "\\subsection*{%s}")
+ ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
+ ("\\paragraph{%s}" . "\\paragraph*{%s}")
+ ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))