-;; Time-stamp: <2015-02-23 11:42:33 kmodi>
+;; Time-stamp: <2015-02-23 18:07:10 kmodi>
 
 ;; Org Mode
 
-(setq org-agenda-archives-mode nil ;; required in org 8.0+
-      org-agenda-skip-comment-trees nil
-      org-agenda-skip-function nil
-      org-src-fontify-natively t ;; fontify code in code blocks
-      org-pretty-entities t ;; Display entities like \tilde, \alpha, etc in UTF-8 characters
-      org-pretty-entities-include-sub-superscripts nil ;; Display entities like \tilde, \alpha, etc in UTF-8 characters
-      org-export-with-smart-quotes t
-      ;; active single key command execution when at beginning of a headline
-      org-use-speed-commands t
-      ;; Allow _ and ^ characters to sub/super-script strings but only when followed by braces
-      org-use-sub-superscripts         '{}
-      org-export-with-sub-superscripts '{}
-      ;; Insert only timestamp when closing an org TODO item
-      org-log-done 'timestamp
-      ;; org-log-done 'note ;; Insert timestamp and note when closing an org TODO item
-      ;; Source:http://orgmode.org/manual/Closing-items.html
-      org-hide-leading-stars  t ;; hidden leading stars
-      org-agenda-files (concat org-directory "/agenda.files")
-      org-blank-before-new-entry (quote ((heading) (plain-list-item))) ;; prevent auto blank lines
-      org-completion-use-ido t ;; use ido for auto completion
-      org-return-follows-link t ;; Hitting <RET> while on a link follows the link
-      org-startup-folded (quote showeverything)
-      org-todo-keywords (quote ((sequence "TODO" "SOMEDAY" "CANCELED" "DONE")))
-      org-todo-keyword-faces
+(setq org-agenda-archives-mode nil) ; required in org 8.0+
+(setq org-agenda-skip-comment-trees nil)
+(setq org-agenda-skip-function nil)
+(setq org-src-fontify-natively t) ; fontify code in code blocks
+;; Display entities like \tilde, \alpha, etc in UTF-8 characters
+(setq org-pretty-entities t
+      org-pretty-entities-include-sub-superscripts nil)
+(setq org-export-with-smart-quotes t)
+;; active single key command execution when at beginning of a headline
+(setq org-use-speed-commands t)
+;; Allow _ and ^ characters to sub/super-script strings but only when followed by braces
+(setq org-use-sub-superscripts         '{}
+      org-export-with-sub-superscripts '{})
+(setq org-log-done 'timestamp) ; Insert only timestamp when closing an org TODO item
+;; (setq org-log-done 'note) ; Insert timestamp and note when closing an org TODO item
+;; http://orgmode.org/manual/Closing-items.html
+(setq org-hide-leading-stars  t) ; hidden leading stars
+(setq org-blank-before-new-entry (quote ((heading) (plain-list-item)))) ; prevent auto blank lines
+(setq org-completion-use-ido t) ; use ido for auto completion
+(setq org-return-follows-link t) ; Hitting <RET> while on a link follows the link
+(setq org-startup-folded (quote showeverything))
+(setq org-todo-keywords (quote ((sequence "TODO" "SOMEDAY" "CANCELED" "DONE"))))
+(setq org-todo-keyword-faces
       '(("TODO"     . org-warning)
         ("SOMEDAY"  . "#FFEF9F")
-        ("CANCELED" . (:foreground "#94BFF3" :weight bold :strike-through t)))
-      ;; block entries from changing state to DONE while they have children
-      ;; that are not DONE
-      ;; Source: http://orgmode.org/manual/TODO-dependencies.html
-      org-enforce-todo-dependencies t
-      ;; Capture
-      ;; By default, org capture dialog is activated by `C-c c`
-      org-capture-templates
-      '(
-        ("j" "Journal" entry ;; C-c c j
+        ("CANCELED" . (:foreground "#94BFF3" :weight bold :strike-through t))))
+;; block entries from changing state to DONE while they have children
+;; that are not DONE
+;; http://orgmode.org/manual/TODO-dependencies.html
+(setq org-enforce-todo-dependencies t)
+
+;; Capture
+(setq org-capture-templates
+      '(("j" "Journal" entry ; `org-capture' binding + j
          (file+datetree (concat org-directory "/journal.org"))
          "\n* %?\n  Entered on %U")
-        ("n" "Note" entry ;; C-c c n
+        ("n" "Note" entry ; `org-capture' binding + n
          (file (concat org-directory "/notes.org"))
          "\n* %?\n  Context:\n    %i\n  Entered on %U")
-        ("u" "UVM/System Verilog Notes" ;; C-c c u
+        ("u" "UVM/System Verilog Notes" ; `org-capture' binding + u
          entry (file (concat org-directory "/uvm.org"))
          "\n* %?\n  Context:\n    %i\n  Entered on %U")))
 
-(when (boundp 'project1-org-dir) ;; set in setup-secret.el
+(setq org-agenda-files (expand-file-name "agenda.files" org-directory))
+
+(when (boundp 'project1-org-dir) ; set in setup-work.el
   (add-to-list 'org-capture-templates
                '("t" "Project 1 Meeting Notes" entry
                  (file+datetree
-                  (concat project1-org-dir "/dv_meeting_notes.org")) ;; C-c c t
+                  (concat project1-org-dir "/dv_meeting_notes.org"))
                  "\n* %?\n  Entered on %U")))
 
 ;; change the default app for opening pdf files from org
-;; Source: http://stackoverflow.com/questions/8834633/how-do-i-make-org-mode-open-pdf-files-in-evince
-(eval-after-load "org"
-  '(progn
-     (add-to-list 'org-src-lang-modes '("systemverilog" . verilog))
-     (add-to-list 'org-src-lang-modes '("dot"           . graphviz-dot))
-     ;; Change .pdf association directly within the alist
-     (setcdr (assoc "\\.pdf\\'" org-file-apps) "acroread %s")))
+;; http://stackoverflow.com/a/9116029/1219634
+(with-eval-after-load 'org
+  (add-to-list 'org-src-lang-modes '("systemverilog" . verilog))
+  (add-to-list 'org-src-lang-modes '("dot"           . graphviz-dot))
+  ;; Change .pdf association directly within the alist
+  (setcdr (assoc "\\.pdf\\'" org-file-apps) "acroread %s"))
 
 ;; (require 'org-latex) in org version < 8.0
 ;; (setq org-export-latex-listings 'minted) in org version < 8.0
 ;; (add-to-list 'org-export-latex-packages-alist '("" "minted")) in org version < 8.0
 
-;; From <ORG EL DIR>/ox-latex.el
 (use-package ox-latex
   :config
   (progn
     ;; Previewing latex fragments in org mode
-    ;; Source: http://orgmode.org/worg/org-tutorials/org-latex-preview.html
-    ;; (setq org-latex-create-formula-image-program 'dvipng) ;; NOT Recommended
-    (setq org-latex-create-formula-image-program 'imagemagick) ;; Recommended
+    ;; http://orgmode.org/worg/org-tutorials/org-latex-preview.html
+    ;; (setq org-latex-create-formula-image-program 'dvipng) ; NOT Recommended
+    (setq org-latex-create-formula-image-program 'imagemagick) ; Recommended
     (setq org-latex-listings 'minted)
     ;; (setq org-latex-listings 'lstlisting)
 

	 (format "[%s]" desc)
	 (unless org-ascii-links-to-notes (format " (%s)" raw-link))))))))

;; Source: http://endlessparentheses.com/emacs-narrow-or-widen-dwim.html
;; Pressing `C-x C-s' while editing org source code blocks saves and exits
;; the edit.
(eval-after-load 'org-src
  '(define-key org-src-mode-map
     "\C-x\C-s" #'org-edit-src-exit))

;; ;; Enable org export to odt (OpenDocument Text)
;; ;; It is disabled by default in org 8.x

            ))

    ;; "H" option is from the `float' package. That prevents the images from floating around.
    ;; (setq org-latex-default-figure-position "htb") ; default - figures are floating
    (setq org-latex-default-figure-position "H") ; figures are NOT floating

    ;; In order to have that tex convert to pdf, you have to ensure that you have
    ;; minted.sty in your TEXMF folder.
