To tangle this file us C-c C-v t. Then use code like this to load it from .emacs or .emacs.d/init.el:
(add-to-list 'load-path "~/git/dotemacs/")
(load-file "~/git/dotemacs/org-dotemacs.elisp")
Maybe we can simplify the process by tangling automatically like here https://github.com/srunnels/emacs-config/blob/master/init.el.
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/")
'("org" . "http://orgmode.org/elpa/"))
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize)
(require 'org-bullets)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
(define-key global-map "\C-cc" 'org-capture)
(setq org-src-fontify-natively t
org-agenda-files (list "~/git/personal/siemens.org"
"~/git/personal/phd.org"
"~/git/personal/private.org"))
(require 'sparql-mode)
(org-babel-do-load-languages
'org-babel-load-languages
'((python . t) (emacs-lisp . t) (sparql . t)))
;; Separate drawers for clocking and logs
(setq org-drawers (quote ("PROPERTIES" "LOGBOOK")))
;; Save clock data and state changes and notes in the LOGBOOK drawer
(setq org-clock-into-drawer t)
(setq org-log-into-drawer t)
(setq org-refile-targets
'(("phd.org" :maxlevel . 1)
("private.org" :maxlevel . 1)
("siemens.org" :maxlevel . 1)))
Count all the TODOs in the subtree not only (direct) children:
(setq org-hierarchical-todo-statistics nil)
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-iswitchb)
(global-set-key "\C-cr" 'org-resolve-clocks)
(defun air-org-skip-subtree-if-habit ()
"Skip an agenda entry if it has a STYLE property equal to \"habit\"."
(let ((subtree-end (save-excursion (org-end-of-subtree t))))
(if (string= (org-entry-get nil "STYLE") "habit")
subtree-end
nil)))
; https://blog.aaronbieber.com/2016/09/24/an-agenda-for-life-with-org-mode.html
(defun air-org-skip-subtree-if-priority (priority)
"Skip an agenda subtree if it has a priority of PRIORITY.
PRIORITY may be one of the characters ?A, ?B, or ?C."
(let ((subtree-end (save-excursion (org-end-of-subtree t)))
(pri-value (* 1000 (- org-lowest-priority priority)))
(pri-current (org-get-priority (thing-at-point 'line t))))
(if (= pri-value pri-current)
subtree-end
nil)))
(setq org-agenda-custom-commands
'(("d" "Daily agenda and all TODOs"
((tags "PRIORITY=\"A\""
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
(org-agenda-overriding-header "High-priority unfinished tasks:")))
(agenda "" ((org-agenda-ndays 1)))
(alltodo ""
((org-agenda-skip-function '(or (air-org-skip-subtree-if-habit)
(air-org-skip-subtree-if-priority ?A)
(org-agenda-skip-if nil '(scheduled deadline))))
(org-agenda-overriding-header "ALL normal priority tasks:"))))
((org-agenda-compact-blocks t)))))
(progn
(setq org-capture-templates
'(("t" "TODO" entry (file+headline "d:/emacs/siemens.org" "Inbox")
"* TODO %?\nEntered on %U\n %i")
("l" "Link" entry (file+olp "d:/emacs/journal.org" "Web Links")
"* %a\n %?\n %i")
("j" "Journal" entry (file+datetree "d:/emacs/journal.org")
"* %?\nEntered on %U\n %i\n %a"))))
(server-start)
(add-to-list 'load-path "d:/emacs/journal.org")
(require 'org-protocol)
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize))
(setq TeX-auto-save t)
(setq TeX-parse-self t)
; open latex files with Auctex and reftex
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
; ask for master file when saving a tex document
(setq-default TeX-master nil)
; configure how to automatically generate bibtex keys
; from here http://jblevins.org/log/bibtex
(setq bibtex-align-at-equal-sign t
bibtex-autokey-name-year-separator ""
bibtex-autokey-year-title-separator ""
bibtex-autokey-titleword-first-ignore '("the" "a" "if" "and" "an")
bibtex-autokey-titleword-length 30
bibtex-autokey-titlewords 1)
;; font size
(set-face-attribute 'default nil :height 100)
;; line spacing
(setq-default line-spacing 2)
(add-hook 'org-mode-hook 'turn-on-visual-line-mode)
(load-theme 'monokai t)
(tool-bar-mode -1)
;(require 'smart-mode-line)
(powerline-default-theme)
(require 'epa-file)
(epa-file-enable)