Orgmode config

I no longer use Spacemacs but anything Org goes into this file.

Agenda

(setq org-agenda-files '("~/org"
                           "~/org/proj"
                           "~/org/blog"))
(setq org-todo-keyword-faces
      '(("NEXT" . "blue")
        ))

Refile

(setq org-refile-allow-creating-parent-nodes 'confirm)
(setq org-refile-targets '((org-agenda-files :maxlevel . 3)))
(setq org-refile-use-outline-path 'file)
(setq org-outline-path-complete-in-steps nil)

Archive

I use a global archive file which contains archived entries from all files.

(setq org-archive-location "~/org/archive.org::** From %s")

Capture

(setq org-default-notes-file "~/org/notes.org")
(setq org-directory (expand-file-name "~/org"))
(setq org-capture-templates
      (quote
       (("j" "Journal" entry
         (file+datetree "~/org/journal.org")
         "* %?")
        ("n" "Notes" entry
         (file+headline "~/org/notes.org" "INBOX")
         "* %?" :prepend t))))

Export

(setq org-export-backends '(ascii beamer html md latex odt))
(setq org-export-with-smart-quotes t)

(setq org-html-doctype "html5")
(setq org-html-html5-fancy t)
(setq org-html-htmlize-output-type 'css)
(setq org-html-htmlize-font-prefix "org-")
(setq org-html-checkbox-type 'html)
(setq org-html-metadata-timestamp-format "%Y-%m-%d")
(setq org-html-head-include-default-style nil)
(setq org-html-head-include-scripts nil)
(setq org-html-head-extra (my-file-get-contents "~/org/blog/parts/styles.html"))
(setq org-html-preamble (my-file-get-contents "~/org/blog/parts/header.html"))
(setq org-html-postamble (my-file-get-contents "~/org/blog/parts/footer.html"))
(setq org-html-divs '((preamble "header" "header")
                      (content "main" "content")
                      (postamble "footer" "footer")))

Publish

This is how I publish my own page. I keep all the drafts into its own folder, which is excluded from publishing. I like footnotes, but TODO keywords should never be visible. These are just defaults, I can always overwrite them with in-buffer settings.

(setq org-publish-project-alist
      `(("blog-content"
         :base-directory "~/org/blog/"
         :with-todo-keywords nil
         :with-footnotes t
         :recursive t
         :exclude "drafts/"
         :publishing-directory "~/var/www"
         :publishing-function org-html-publish-to-html)

        ("blog-static"
         :base-directory "~/org/blog/"
         :base-extension any
         :exclude ".*org$"
         :recursive t
         :publishing-directory "~/var/www"
         :publishing-function org-publish-attachment)

        ("blog" :components ("blog-content" "blog-static"))))

Hooks

(with-eval-after-load 'org
  (add-hook 'org-mode-hook #'visual-line-mode)
  (add-hook 'org-src-mode-hook #'toggle-truncate-lines))

Misc

(setq org-src-fontify-natively t)
(setq org-src-tab-acts-natively t)
(setq org-log-into-drawer t)
(setq org-hide-emphasis-markers t)
(setq org-clock-idle-time 10)
(setq org-link-frame-setup '((file . find-file)))