#+TITLE: Emacs Configuration
#+HTML_HEAD:
#+OPTIONS: html-style:nil
* Startup
** Defaults
#+BEGIN_SRC emacs-lisp
(setq
;; Hide the default startup screen
inhibit-startup-screen t
;; Define where to store recovery files
backup-directory-alist '(("." . "~/.emacs.d/backups"))
;; Use version numbers for backups.
version-control t
;; Number of newest versions to keep.
kept-new-versions 10
;; Number of oldest versions to keep.
kept-old-versions 0
;; Don't ask to delete excess backup versions.
delete-old-versions -1
;; Copy all files, don't rename them.
backup-by-copying t
;; Make backups files under version control.
vc-make-backup-files t
;; Don't confirm following when opening a symlink
vc-follow-symlinks t)
;; Save minibuffer command history
(savehist-mode +1)
(setq savehist-save-minibuffer-history +1
savehist-file "~/.emacs.d/savehist")
(setq savehist-additional-variables
'(kill-ring
search-ring
regexp-search-ring))
;; Automatically close parens when opening them
(electric-pair-mode 1)
;; Show matched parens
(show-paren-mode t)
;; Let y and n be good enough for yes and no questions
(fset 'yes-or-no-p 'y-or-n-p)
;; Auto-refresh files changed on the file system
(global-auto-revert-mode 1)
#+END_SRC
Use UTF-8 as the default encoding
#+BEGIN_SRC emacs-lisp
(set-language-environment "UTF-8")
(set-default-coding-systems 'utf-8)
#+END_SRC
I primarily use OSes that favor unix line endings, but occasionally I use
Windows. This forces the buffers to be utf-8 with unix line endings by default.
#+BEGIN_SRC emacs-lisp
(setq default-buffer-file-coding-system 'utf-8-unix
tab-width 4)
#+END_SRC
Transient-mark-mode makes a region active only when it is highlighted.
Delete-selection-mode allows you to overwrite regions with what you're typing,
pasting, etc. This mimics the behavior of other editors.
#+BEGIN_SRC emacs-lisp
(transient-mark-mode 1)
(delete-selection-mode 1)
#+END_SRC
Trim trailing whitespace in my all of my files. If it turns out there is a
filetype that should include trailing whitespace I will whitelist it.
#+BEGIN_SRC emacs-lisp
(add-hook 'write-file-hooks
'(lambda ()
(delete-trailing-whitespace)))
#+END_SRC
yasnippet's tab completion can conflict with term mode, so disable that
#+BEGIN_SRC emacs-lisp
(add-hook 'term-mode-hook (lambda()
(setq yas-dont-activate-functions t)))
#+END_SRC
** Look and Feel
#+BEGIN_SRC emacs-lisp
;; Hide the toolbar
(tool-bar-mode -1)
;; Hide the scrollbar
(scroll-bar-mode -1)
;; no beep
(setq ring-bell-function 'ignore
visible-bell nil)
;; display the full file path in the titlebar
(setq frame-title-format
(list (format "%s %%S: %%j " (system-name))
'(buffer-file-name "%f" (dired-directory dired-directory "%b"))))
#+END_SRC
Start Emacs full screen by default.
#+BEGIN_SRC emacs-lisp
(toggle-frame-maximized)
#+END_SRC
Winner mode tracks your window layouts so you can cycle between them with
=C-c = and =C-c =. It is extra handy when some other
mode ruins your current window layout.
#+BEGIN_SRC emacs-lisp
(winner-mode 1)
#+END_SRC
** Local Elisp Code
Add directories where I store elisp code to the load path
#+BEGIN_SRC emacs-lisp
(add-to-list 'load-path "~/.emacs.d/local-lib/")
#+END_SRC
Include my custom functions
#+BEGIN_SRC emacs-lisp
(require 'zzq-funcs)
#+END_SRC
Usernames and passwords are stored in a non-published file
#+BEGIN_SRC emacs-lisp
(load "~/.emacs.d/secrets" t)
#+END_SRC
** Keybindings
By default Emacs binds ~C-x k~ to ~kill-buffer~ which asks for the buffer you
want to close. 99.9% of the time I want to kill the buffer that is active so
make that the default behavior
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "C-x k") 'kill-this-buffer)
#+END_SRC
~ibuffer~ is a better buffer list utility so redefine the default buffer list
to it.
#+BEGIN_SRC emacs-lisp
;; Use ibuffer for the buffer list
(global-set-key (kbd "C-x C-b") 'ibuffer)
#+END_SRC
I want to treat whitespace as a word when removing words because I end
up reformatting new lines and indents a lot (python doc strings).
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "") 'maybe-backward-kill-word)
(global-set-key (kbd "") 'maybe-backward-kill-word)
(global-set-key (kbd "M-d") 'maybe-kill-word)
(global-set-key (kbd "") 'maybe-kill-word)
#+END_SRC
* Package Initalization
Define the package repositories
#+BEGIN_SRC emacs-lisp
(setq package-archives '(
("elpa" . "http://elpa.gnu.org/packages/")
;("org" . "http://orgmode.org/elpa/")
;; melpa builds git repositories and can be unstable
("melpa" . "http://melpa.org/packages/")
;; marmalade has version uploaded by the maintainers
;; ("marmalade" . "https://marmalade-repo.org/packages/")
;; melpa-stable builds from git tags but may be missing dependencies
;; ("melpa-stable" . "https://stable.melpa.org/packages/")
))
(package-initialize)
#+END_SRC
I use jweigly's [[https://github.com/jwiegley/use-package][use-package]] to manage packages so it needs to be installed.
#+BEGIN_SRC emacs-lisp
;; Packages are managed by the use-package package, so we need to make sure it's installed
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
;; slight optimization for use-package's :bind directive
(require 'bind-key)
#+END_SRC
Emacs on *nix systems may use a different set of environment variables. This
package can be used to copy over variables from the shell
#+BEGIN_SRC emacs-lisp
(use-package exec-path-from-shell
:ensure t
:init
(exec-path-from-shell-copy-env "RUST_SRC_PATH")
(exec-path-from-shell-copy-env "SSH_AUTH_SOCK")
(exec-path-from-shell-initialize))
#+END_SRC
* Themes
[[https://github.com/synic/jbeans-emacs][jbeans]] is a jellybeans.vim clone maintained by synic
#+BEGIN_SRC emacs-lisp
(use-package jbeans-theme
:ensure t
:config
(load-theme 'jbeans t))
#+END_SRC
* Auto-completion
I use [[https://company-mode.github.io/][company-mode]] for autocompletion.
#+BEGIN_SRC emacs-lisp
(use-package company
:ensure t
:init
(setq
;; Display the suggestion popup quickly
company-idle-delay 0.1
;; Display the suggestion popup after 1 character
company-minimum-prefix-length 1)
:config
(add-hook 'company-mode-hook '(lambda ()
(progn
;; I prefer to use TAB instead of RETURN to finish completion
(define-key company-active-map [return] nil)
(define-key company-active-map [tab] 'company-complete-selection)))))
#+END_SRC
[[https://github.com/expez/company-quickhelp][Company-quickhelp]] displays documentation in a popup next to the match list
#+BEGIN_SRC emacs-lisp
(use-package company-quickhelp
:ensure t
:config
(add-hook 'company-mode-hook '(lambda ()
(progn
(company-quickhelp-mode)))))
#+END_SRC
* Version Control
** Magit
Use [[https://magit.vc/][magit]] to supplement emacs built in version control system
#+BEGIN_SRC emacs-lisp
(use-package magit
:ensure t
:commands (magit-status magit-blame magit-log-buffer-file)
:bind (("C-c v s" . magit-status)
("C-c v B" . magit-blame)
("C-c v L" . magit-log-buffer-file))
:init
(setq ;; Use ivy for magit
magit-completing-read-function 'ivy-completing-read))
#+END_SRC
Use magithub for magit/github integration
#+BEGIN_SRC emacs-lisp
(use-package magithub
:ensure t
:config
(magithub-feature-autoinject t))
#+END_SRC
** diff-hl
[[https://github.com/dgutov/diff-hl][diff-hl]] displays diff information in the margin
#+BEGIN_SRC emacs-lisp
(use-package diff-hl
:ensure t
:init
(setq diff-hl-margin-mode t
diff-hl-flydiff-mode t)
:config
(global-diff-hl-mode))
#+END_SRC
* Packages
** Paradox
[[https://github.com/Malabarba/paradox/][Paradox]] is a better emacs package manager.
#+BEGIN_SRC emacs-lisp
(use-package paradox
:ensure t
:config
(paradox-enable))
#+END_SRC
** expand-region
[[https://github.com/magnars/expand-region.el][expand-region]] will expand a region by meanigful units. For example if you have
the string ~"pony killer"~ and you move the cursor to the first p and hit the key
1 time it will highlight ~pony~, hit it a 2nd time it will highlight ~pony
killer~, and a 3rd time ~"pony killer"~ will be highlighted.
#+BEGIN_SRC emacs-lisp
(use-package expand-region
:ensure t
:bind ("C-=" . er/expand-region))
#+END_SRC
** dired
Dired is a file manager mode built in to emacs.
Dired-eXtra adds some additional functionality to dired
Features include:
- Omitting “uninteresting” files from Dired listings
- Dired local variables file (.dired)
- Shell command guessing
- "Virtual Dired" allows you to view directories based on command output
- Cleaning commands
- Dired current file and file at point commands (C-x C-j)
#+BEGIN_SRC emacs-lisp
;; (require 'dired-x)
#+END_SRC
Emacs' philosophy is to create a new buffer for new content. This makes sense
for an editor but a file manager usually reuses it's window as you browse the
file system. This reverts dired to that behavior, but doesn't fix it if you use
the mouse to click a directory or filename.
- Downloaded dired+.el from https://www.emacswiki.org/emacs/DiredPlus
#+BEGIN_SRC emacs-lisp
(require 'dired+)
(toggle-diredp-find-file-reuse-dir 1)
#+END_SRC
** avy
[[https://github.com/abo-abo/avy][avy]] is a quick way to jump around buffers
#+BEGIN_SRC emacs-lisp
(use-package avy
:ensure t
:bind (("C-:" . avy-goto-line)))
#+END_SRC
** which-key
[[https://github.com/justbur/emacs-which-key][which-key]] displays a pop up with key binding hints as you press them
#+BEGIN_SRC emacs-lisp
(use-package which-key
:ensure t
:diminish which-key-mode
:init
(setq which-key-special-keys nil
which-key-use-C-h-commands t
which-key-echo-keystrokes 0.02
which-key-max-description-length 32
which-key-sort-order 'which-key-key-order-alpha)
:config
(which-key-mode))
#+END_SRC
** ivy/swiper
[[https://github.com/abo-abo/swiper][Ivy]], swiper, and counsel are a framework for autocompleting emacs things
#+BEGIN_SRC emacs-lisp
(use-package ivy
:ensure t
:pin elpa
:diminish ivy-mode
:bind (("C-s" . swiper)
("M-x" . counsel-M-x)
("C-x C-f" . counsel-find-file))
:init
(setq
;; Remove the ^ prefix
ivy-initial-inputs-alist nil
;; Display recently opened files when switching buffers
ivy-use-virtual-buffers t
;; Use ivy for projectile
projectile-completion-system 'ivy
;; Allow the input to be selectable with C-P RET. Useful for creating files
ivy-use-selectable-prompt t)
:config
(ivy-mode 1))
#+END_SRC
** persp-mode
[[https://github.com/Bad-ptr/persp-mode.el][persp-mode]] enables "workspaces" within Emacs. This is similar to how a window
manager might have several desktops
#+BEGIN_SRC emacs-lisp
(use-package persp-mode
:ensure t
:bind (([f8] . persp-switch))
:init
(setq persp-nil-name "Home"
persp-auto-resume-time 0)
;; Adding this so that capturing process is not interrupted with annoying
;; prompts "Kill and Close" etc.
(setq persp-kill-foreign-buffer-behaviour nil
;; increase the default name length
persp-lighter '(:eval (format (propertize " #%.10s"
'face (let ((persp (get-current-persp)))
(if persp
(if (persp-contain-buffer-p (current-buffer) persp)
'persp-face-lighter-default
'persp-face-lighter-buffer-not-in-persp)
'persp-face-lighter-nil-persp)))
(safe-persp-name (get-current-persp)))))
:config
;; Set the persp-mode keymap prefix to , p
(persp-set-keymap-prefix (kbd " p"))
(persp-mode 1))
#+END_SRC
** powerline
[[https://github.com/milkypostman/powerline][powerline]] is a prettier mode line for emacs
#+BEGIN_SRC emacs-lisp
;(use-package powerline
; :ensure t
; :init
; (setq powerline-default-separator 'wave
; powerline-display-mule-info nil)
; :config
; (powerline-default-theme))
#+END_SRC
** projectile
[[https://github.com/bbatsov/projectile][projectile]] adds some features around projects, for example finding only files
that are in the current project (defined by a .git directory).
#+BEGIN_SRC emacs-lisp
(use-package projectile
:ensure t
:diminish projectile-mode
:bind-keymap
("C-c p" . projectile-command-map)
:config
(projectile-global-mode))
#+END_SRC
** elfeed
[[https://github.com/skeeto/elfeed][Elfeed]] is an RSS reader for emacs
#+BEGIN_SRC emacs-lisp
;; (use-package elfeed
;; :ensure t
;; :bind ((" f" . elfeed))
;; :init
;; (setq elfeed-db-directory "~/Shared/elfeeddb"))
#+END_SRC
[[https://github.com/algernon/elfeed-goodies][elfeed-goodies]] adds some ui/ux sugar to the elfeed screen
#+BEGIN_SRC emacs-lisp
;; (use-package elfeed-goodies
;; :ensure t
;; :config
;; (elfeed-goodies/setup))
#+END_SRC
** fill column indicator
FCI-mode draws a pretty little line on the right hand side indicating where the
fill column is.
#+BEGIN_SRC emacs-lisp
;; (use-package fill-column-indicator
;; :ensure t
;; :init
;; (setq
;; fci-rule-width 1
;; fci-rule-color "#202020")
;; :config
;; (add-hook 'prog-mode-hook 'fci-mode))
#+END_SRC
** editorconfig
Some of the project I work on use editorconfig to sync style guide
configurations across everyone's editors
#+BEGIN_SRC emacs-lisp
(use-package editorconfig
:ensure t
:config
(editorconfig-mode 1))
#+END_SRC
** ag
ag is the silversearcher. It's faster than using grep
#+BEGIN_SRC emacs-lisp
(use-package ag
:ensure t)
#+END_SRC
** restclient
[[https://github.com/pashky/restclient.el][restclient]] is a package that allows you to make raw HTTP queries to
websites and returns the response. It is much like the Postman chrome
plugin.
#+BEGIN_SRC emacs-lisp
(use-package restclient
:ensure t
:config
(add-to-list 'auto-mode-alist '("\\.restclient" . restclient-mode)))
#+END_SRC
** yaml
[[https://github.com/yoshiki/yaml-mode][yaml-mode]] adds support for yaml config files
#+BEGIN_SRC emacs-lisp
(use-package yaml-mode
:ensure t
:config
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode)))
#+END_SRC
** helpful
[[https://github.com/Wilfred/helpful][helpful]] is an alternative to the built-in Emacs help that provides more
contextual information
#+BEGIN_SRC emacs-lisp
(use-package helpful
:ensure t
:bind (("C-h f" . helpful-callable)
("C-h v" . helpful-variable )
("C-h k" . helpful-key)))
#+END_SRC
* Languages
** prog-mode
Settings for all programming modes.
#+BEGIN_SRC emacs-lisp
(setq display-line-numbers-width 4)
(defun my-prog-mode-setup ()
(display-line-numbers-mode))
(add-hook 'prog-mode-hook 'my-prog-mode-setup)
#+END_SRC
** flycheck
[[https://github.com/flycheck/flycheck][flycheck]] is an on-the-fly syntax checker for many languages.
#+BEGIN_SRC emacs-lisp
(use-package flycheck
:ensure t
:config
(add-hook 'prog-mode-hook 'flycheck-mode))
#+END_SRC
** flyspell
flyspell is an on-the-fly spell checker
#+BEGIN_SRC emacs-lisp
(use-package flyspell
:ensure t
:config
(add-hook 'prog-mode-hook 'flyspell-prog-mode))
#+END_SRC
** Python
[[https://github.com/proofit404/anaconda-mode][anaconda-mode]] has support for code navigation, docs, and completion for Python.
#+BEGIN_SRC emacs-lisp
(use-package anaconda-mode
:ensure t)
(use-package company-anaconda
:ensure t
:config
(eval-after-load "company"
'(add-to-list 'company-backends '(company-anaconda :with company-capf))))
#+END_SRC
[[https://github.com/porterjamesj/virtualenvwrapper.el][virtualenvwrapper.el]] adds support for virtualenvs for emacs.
#+BEGIN_SRC emacs-lisp
(use-package virtualenvwrapper
:ensure t
:config
(venv-initialize-interactive-shells)
(venv-initialize-eshell))
#+END_SRC
This part is for setting up python mode in the way I prefer.
#+BEGIN_SRC emacs-lisp
(defun my-python-setup ()
(anaconda-mode)
(anaconda-eldoc-mode)
(company-mode)
(auto-fill-mode 1)
(setq-local fill-column 79)
(setq-local indent-tabs-mode nil))
(add-hook 'python-mode-hook 'my-python-setup)
#+END_SRC
** Java
#+BEGIN_SRC emacs-lisp
(defun my-java-setup ()
(company-mode)
(auto-fill-mode 1))
(add-hook 'java-mode-hook 'my-java-setup)
#+END_SRC
** Rust
Installation:
- Install Rust: https://www.rust-lang.org/en-US/install.html
- Install Racer: https://github.com/racer-rust/racer
- Install the Rust source: =rustup component add rust-src= This goes to:
~/.multirust/toolchains/[toolchain]/lib/rustlib/src/rust/src
- Define the =RUST_SRC_PATH= environment var to the source directory
#+BEGIN_SRC emacs-lisp
(use-package rust-mode
:ensure t
:commands (rust-mode))
(use-package cargo
:ensure t
:commands (cargo-minor-mode))
(use-package racer
:ensure t
:commands (racer-mode))
(use-package flycheck-rust
:ensure t
:init
(with-eval-after-load 'rust-mode
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)))
(add-hook 'rust-mode-hook (lambda ()
(racer-mode)
(cargo-minor-mode)))
(add-hook 'racer-mode-hook #'company-mode)
#+END_SRC
** Go
The golang setup requires some additional packages:
#+BEGIN_SRC bash
# Code complete
go get -u github.com/nsf/gocode
# Finds symbols in the code
go get -u github.com/rogpeppe/godef
# Updates imports adding missing ones and removing unused ones
go get -u golang.org/x/tools/cmd/goimports
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defun my-golang-setup ()
(setq-local indent-tabs-mode t)
(setq-local tab-width 4)
;;(go-eldoc-setup)
(add-hook 'before-save-hook 'gofmt-before-save)
(local-set-key (kbd "M-.") 'godef-jump)
(local-set-key (kbd "M-*") 'pop-tag-mark)
(local-set-key (kbd "C-c /") 'comment-or-uncomment-region))
(use-package go-mode
:ensure t
:commands (go-mode)
:config
(add-hook 'go-mode-hook 'my-golang-setup))
(use-package company-go
:ensure t
:config
(add-hook 'go-mode-hook 'company-mode)
(add-to-list 'company-backends 'company-go))
#+END_SRC
** Javascript/JSON
#+BEGIN_SRC emacs-lisp
(defun my-json-setup ()
(make-local-variable 'js-indent-level)
(setq js-indent-level 2))
(add-hook 'json-mode-hook
(my-json-setup))
#+END_SRC
** API Blueprint
#+BEGIN_SRC emacs-lisp
(use-package apib-mode
:ensure t
:config
(add-to-list 'auto-mode-alist '("\\.apib" . apib-mode)))
#+END_SRC
* org-mode
** Setup
#+BEGIN_SRC emacs-lisp
(setq org-directory "~/Resilio Sync/org"
;; Indents headers instead of displaying all of the asterisks
org-startup-indented t
;; Use emac's syntax highlighting for SRC block
org-src-fontify-natively t
;; Don't split the line when hitting M-RET for a new heading
;org-M-RET-may-split-line '((default . nil))
;; Define the default drawers
org-drawers (quote ("PROPERTIES" "LOGBOOK"))
;; define some frequently used tags for the add tag menu
org-tag-alist '(
("project" . ?p)
("@work" . ?w)
("@home" . ?h)
("eventmq" . ?q))
;; Define a default width for inline images. this can be overridden
;; by +ATTR_*: width="200"
org-image-actual-width '(400)
;; Default org-archive-subtree location. Use an archive subdirectory
;; This can be over-written using something like #+ARCHIVE: ::* Archived Tasks
org-archive-location "archive/%s_archive::"
)
(defun my-org-mode-setup ()
(setq-local fill-column 79)
(auto-fill-mode 1)
(setq-local display-line-numbers-width 4))
(add-hook 'org-mode-hook 'my-org-mode-setup)
;; these extensions should be considered org-mode files
(add-to-list 'auto-mode-alist '("\\.\\(org\\|org\.gpg\\|org_archive\\)$" . org-mode))
#+END_SRC
** Key Bindings
Define the keybindings for org-mode related things
| Key | Function | Description |
|--------+-------------------+-------------------------------------|
| F12 | org-agenda | Display the org-agenda menu |
| F9 c g | org-clock-goto | Go to the current clocked task |
| F9 c l | org-clock-in-last | Clock into the last clocked in task |
| F9 c o | org-clock-out | Clock out of the current task |
| C-c c | org-capture | Display the org-capture menu |
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "") 'org-agenda)
(global-set-key (kbd " c g") 'org-clock-goto)
(global-set-key (kbd " c l") 'org-clock-in-last)
(global-set-key (kbd " c o") 'org-clock-out)
(global-set-key (kbd "C-c c") 'counsel-org-capture)
#+END_SRC
** Agenda
Rather than using ~C-[~ and ~C-]~ for adding files to the agenda manually this
defines directories that include all org files in the agenda.
#+BEGIN_SRC emacs-lisp
(setq org-agenda-files '("~/org/"))
#+END_SRC
Set up org capture. This feature lets me hit C-c c to quickly capture
information from any buffer.
#+BEGIN_SRC emacs-lisp
(setq
;; Define the default file for org-capture items
org-default-notes-file "~/org/refile.org"
;; Define how many levels to display when refiling org items
org-refile-targets (quote ((nil :maxlevel . 3)
(org-agenda-files :maxlevel . 3)))
;; Show the full org header path when displaying refile options
org-refile-use-outline-path t
;; Allow refile to create parent nodes with confirmation
org-refile-allow-creating-parent-nodes (quote confirm)
;; generate all possible refile paths so it's faster to search
org-outline-path-complete-in-steps nil
;; Define the menu options for org-capture
org-capture-templates (quote
(("t" "TODO" entry
(file+headline org-default-notes-file "Inbox")
"* TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n")
("T" "TODO w/ file location" entry
(file+headline org-default-notes-file "Inbox")
"* TODO %?\n:PROPERTIES:\n:CREATED: %U\n:LOCACTION: %a\n:END:\n%i")
("i" "Interrupting Task" entry
(file+headline org-default-notes-file "Inbox")
"* Started %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n"
:clock-in :clock-resume)
("e" "Emacs idea" entry
(file+headline "~/org/emacs.org" "Emacs")
"* TODO %^{Task}\n:PROPERTIES:\n:CREATED: %U\n:END:\n"
:immediate-finish t)
("n" "note" entry (file org-default-notes-file)
"* %? :NOTE:\n:PROPERTIES:\n:CREATED: %U\n:END:\n%U\n%a\n")
("j" "Journal" entry (file+datetree "~/org/diary.org.gpg")
"* %u\n%U\n"
:unnarrowed t)
("w" "Web site" entry (file "~/Code/org/refile.org")
"* %a :website:\n:PROPERTIES:\n:CREATED: %U\n:END:\n%:initial")))
)
#+END_SRC
Set up org's TODO system
#+BEGIN_SRC emacs-lisp
(setq
;; Allows selecting capture method by pressing the letter in the parenthesis
;; after C-c C-t
org-use-fast-todo-selection t
;; Define the default states for TODO items
org-todo-keywords '((sequence "TODO(t)" "NEXT" "STARTED" "WAITING" "|" "DONE(d)" "DELEGATED(g)")
(sequence "|" "CANCELED"))
;; Define the colors for the TODO states
org-todo-keyword-faces '(("NEXT" . "orange")
("STARTED" . "dark yellow")
("WAITING". "dark orange")
("DELEGATED" . "light blue")
("CANCELED" . "dark red"))
;; Block parent TODO items which have incomplete child TODO items from being
;; marked DONE
org-enforce-todo-dependencies t
;; Block parent TODO items which have incomplete check boxes from being
;; marked DONE
org-enforce-todo-checkbox-dependencies t
;; Log the time a TODO task is marked as DONE
org-log-done 'time
)
#+END_SRC
org-mode has a built in time tracking system that I like to use.
#+BEGIN_SRC emacs-lisp
(setq
;; Put clock, state, and note entries into the LOGBOOK drawer
org-clock-into-drawer t
;; Show a lot of clock history
org-clock-history-length 23
;; Automatically clock-in if the clock is already open
org-clock-in-resume t
;; Automatically clock out when a task is marked as done
org-clock-out-when-done t
;; Quickly changing tasks will add a time of 0 to the log book. These aren't
;; very helpful so they should be removed
org-clock-out-remove-zero-time-clocks t
;; save running clock and history when exiting and reopening Emacs
org-clock-persist t
;; Don't prompt when resuming an active clock after close
org-clock-persist-query-resume nil
;; enable autoresolution for open clocks
org-clock-auto-clock-resolution 'when-no-clock-is-running
;; Include the current clocked in task in clock reports
org-clock-report-include-clocking-task t
;; display a warning when idle for x minutes
org-clock-idle-time 15
)
#+END_SRC
** HTMLize
Styles source code blocks when exporting an org file to HTML
#+BEGIN_SRC emacs-lisp
(use-package htmlize
:ensure t)
#+END_SRC