├── .gitignore ├── etc ├── borg │ ├── config.mk │ └── config.el └── yasnippet │ └── snippets │ ├── python-mode │ ├── numpy │ ├── pandas │ ├── seaborn │ └── matplotlib │ ├── markdown-mode │ └── equation │ ├── message-mode │ ├── hi-all │ └── hi │ ├── org-mode │ ├── equation │ ├── orgemail │ ├── classslides │ └── newpaper │ └── ess-mode │ ├── else │ ├── elif │ ├── if │ ├── for │ └── function ├── var ├── eshell │ └── alias ├── mc-list.el └── abbrev.el ├── Makefile ├── README.org ├── .gitmodules └── init.el /.gitignore: -------------------------------------------------------------------------------- 1 | /var 2 | -------------------------------------------------------------------------------- /etc/borg/config.mk: -------------------------------------------------------------------------------- 1 | EMACS_ARGUMENTS = -q 2 | -------------------------------------------------------------------------------- /etc/yasnippet/snippets/python-mode/numpy: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: numpy 3 | # key: numpy 4 | # -- 5 | import numpy as np -------------------------------------------------------------------------------- /var/eshell/alias: -------------------------------------------------------------------------------- 1 | alias sys systemctl $* 2 | alias lg journalctl $* 3 | alias restart-emacs systemctl --user restart emacs.service 4 | -------------------------------------------------------------------------------- /etc/yasnippet/snippets/python-mode/pandas: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: pandas 3 | # key: pandas 4 | # -- 5 | import pandas as pd -------------------------------------------------------------------------------- /etc/yasnippet/snippets/python-mode/seaborn: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: seaborn 3 | # key: seaborn 4 | # -- 5 | import seaborn as sns -------------------------------------------------------------------------------- /etc/yasnippet/snippets/markdown-mode/equation: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: equation 3 | # key: equation 4 | # -- 5 | $$ $0 $$ {#eq:$1} 6 | -------------------------------------------------------------------------------- /etc/yasnippet/snippets/python-mode/matplotlib: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: matplotlib 3 | # key: matplotlib 4 | # -- 5 | import matplotlib.pyplot as plt -------------------------------------------------------------------------------- /etc/yasnippet/snippets/message-mode/hi-all: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: hi all 3 | # key: all 4 | # -- 5 | Hi all, 6 | 7 | $0 8 | 9 | Alex 10 | -------------------------------------------------------------------------------- /etc/yasnippet/snippets/org-mode/equation: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: equation 3 | # key: equation 4 | # -- 5 | \begin{equation} 6 | $0 7 | \end{equation} 8 | -------------------------------------------------------------------------------- /etc/yasnippet/snippets/org-mode/orgemail: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: orgemail 3 | # key: orgemail 4 | # -- 5 | #+OPTIONS: tex:imagemagick 6 | #+OPTIONS: toc:0 7 | -------------------------------------------------------------------------------- /etc/yasnippet/snippets/message-mode/hi: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: hi 3 | # key: hi 4 | # -- 5 | Hi ${1:`(bjm/mu4e-get-names-for-yasnippet)`}, 6 | 7 | $0 8 | 9 | Alex 10 | -------------------------------------------------------------------------------- /etc/borg/config.el: -------------------------------------------------------------------------------- 1 | ;;; config.el --- -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2018 J. Alexander Branham 4 | 5 | (setq borg-emacs-arguments '("-q")) 6 | -------------------------------------------------------------------------------- /etc/yasnippet/snippets/ess-mode/else: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: else 3 | # key: else 4 | # contributor: jrnold 5 | # -- 6 | else { 7 | `yas/selected-text`$0 8 | } 9 | -------------------------------------------------------------------------------- /etc/yasnippet/snippets/ess-mode/elif: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: else if 3 | # key: elif 4 | # contributor: jrnold 5 | # -- 6 | else if ($1) { 7 | `yas/selected-text`$0 8 | } 9 | -------------------------------------------------------------------------------- /etc/yasnippet/snippets/ess-mode/if: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: if (...) { ... } 3 | # key: if 4 | # contributor: jrnold 5 | # -- 6 | if (${1:condition}) { 7 | `yas/selected-text`$0 8 | } -------------------------------------------------------------------------------- /etc/yasnippet/snippets/ess-mode/for: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: for ( ... in ...) { ... } 3 | # key: for 4 | # contributor: jrnold 5 | # -- 6 | for (${1:i} in ${2:vector}) { 7 | `yas/selected-text`$0 8 | } 9 | -------------------------------------------------------------------------------- /etc/yasnippet/snippets/ess-mode/function: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: FUNC <- function(...) { ... } 3 | # key: func 4 | # contributor: jrnold 5 | # -- 6 | ${1:name} <- function(${2:args}) { 7 | `yas/selected-text`$0 8 | } 9 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | -include lib/borg/borg.mk 2 | 3 | bootstrap-borg: 4 | @git submodule--helper clone --name borg --path lib/borg \ 5 | --url git@github.com:emacscollective/borg.git 6 | @cd lib/borg; git symbolic-ref HEAD refs/heads/master 7 | @cd lib/borg; git reset --hard HEAD 8 | -------------------------------------------------------------------------------- /README.org: -------------------------------------------------------------------------------- 1 | #+AUTHOR: J. Alexander Branham 2 | #+TITLE: My Emacs Configuration 3 | 4 | Highlights from my configuration: 5 | 6 | - Uses the [[https://github.com/emacscollective/borg][borg]] package manager instead of built-in package.el 7 | - Extensive org setup 8 | - Set up for quantitative analysis in R 9 | - Support for \LaTeX with auctex 10 | - Support for references using org-ref 11 | -------------------------------------------------------------------------------- /etc/yasnippet/snippets/org-mode/classslides: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: classslides 3 | # key: classslides 4 | # -- 5 | #+TITLE: $0 6 | #+AUTHOR: J. Alexander Branham 7 | #+EMAIL: branham@utexas.edu 8 | #+DATE: Spring 2016 9 | #+startup: beamer 10 | #+LaTeX_CLASS: beamer 11 | #+LATEX_COMPILER: xelatex 12 | #+OPTIONS: toc:nil H:2 13 | #+LATEX_HEADER: \beamerdefaultoverlayspecification{<+->} 14 | #+LATEX_CLASS_OPTIONS: [colorlinks, urlcolor=blue, aspectratio=169] 15 | #+BEAMER_THEME: metropolis[titleformat=smallcaps, progressbar=frametitle] 16 | -------------------------------------------------------------------------------- /etc/yasnippet/snippets/org-mode/newpaper: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: newpaper 3 | # key: newpaper 4 | # -- 5 | #+TITLE: $0 6 | #+SUBTITLE: 7 | #+AUTHOR: J. Alexander Branham 8 | #+CREATOR: 9 | #+EMAIL: branham@utexas.edu 10 | #+DATE: $1 11 | #+LANGUAGE: en-us 12 | #+OPTIONS: toc:nil 13 | #+LATEX_HEADER: \usepackage[margin=1in]{geometry} 14 | #+LATEX_HEADER: \usepackage[style=authoryear, doi=false, isbn=false, url=false]{biblatex} 15 | #+LATEX_HEADER: \renewbibmacro{in:}{\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}} 16 | #+LATEX_HEADER: \addbibresource{~/Dropbox/bibliography/references.bib} 17 | #+LATEX_HEADER: \usepackage[]{babel} 18 | #+LATEX_CLASS_OPTIONS: [colorlinks, urlcolor=blue,citecolor=blue] 19 | 20 | $2 21 | 22 | \printbibliography 23 | 24 | 25 | -------------------------------------------------------------------------------- /var/mc-list.el: -------------------------------------------------------------------------------- 1 | ;; This file is automatically generated by the multiple-cursors extension. 2 | ;; It keeps track of your preferences for running commands with multiple cursors. 3 | 4 | (setq mc/cmds-to-run-for-all 5 | '( 6 | beginning-of-visual-line 7 | crux-move-beginning-of-line 8 | end-of-visual-line 9 | ess-insert-S-assign 10 | ess-smart-S-assign 11 | ess-smart-comma 12 | indent-for-tab-command 13 | kill-visual-line 14 | org-beginning-of-line 15 | org-delete-char 16 | org-end-of-line 17 | org-kill-line 18 | org-self-insert-command 19 | sp-backward-delete-char 20 | )) 21 | 22 | (setq mc/cmds-to-run-once 23 | '( 24 | helm-M-x 25 | my/mc-hydra/mc/edit-lines-and-exit 26 | my/mc-hydra/mc/mark-all-in-region-regexp-and-exit 27 | my/mc-hydra/mc/mark-next-like-this 28 | my/mc-hydra/nil 29 | my/save-everything-noconfirm 30 | )) 31 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [borg] 2 | pushDefault = jabranham 3 | [submodule "aggressive-indent"] 4 | path = lib/aggressive-indent 5 | url = git@github.com:Malabarba/aggressive-indent-mode.git 6 | remote = "jabranham git@github.com:jabranham/aggressive-indent-mode.git" 7 | [submodule "alert"] 8 | path = lib/alert 9 | url = git@github.com:jwiegley/alert.git 10 | remote = "jabranham git@github.com:jabranham/alert.git" 11 | [submodule "anaconda-mode"] 12 | path = lib/anaconda-mode 13 | url = git@github.com:proofit404/anaconda-mode.git 14 | remote = "jabranham git@github.com:jabranham/anaconda-mode.git" 15 | [submodule "async"] 16 | path = lib/async 17 | url = git@github.com:jwiegley/emacs-async.git 18 | [submodule "auctex"] 19 | path = lib/auctex 20 | url = https://git.savannah.gnu.org/git/auctex.git 21 | info-path = doc 22 | build-step = make extraclean 23 | build-step = ./autogen.sh 24 | build-step = ./configure --prefix=$HOME 25 | build-step = make 26 | build-step = borg-makeinfo 27 | remote = "jabranham git@github.com:jabranham/auctex.git" 28 | [submodule "auto-compile"] 29 | path = lib/auto-compile 30 | url = git@github.com:emacscollective/auto-compile.git 31 | [submodule "biblio"] 32 | path = lib/biblio 33 | url = git@github.com:cpitclaudel/biblio.el.git 34 | [submodule "borg"] 35 | path = lib/borg 36 | url = git@github.com:emacscollective/borg.git 37 | remote = "jabranham git@github.com:jabranham/borg.git" 38 | [submodule "closql"] 39 | path = lib/closql 40 | url = git@github.com:emacscollective/closql.git 41 | [submodule "company"] 42 | path = lib/company 43 | url = git@github.com:company-mode/company-mode.git 44 | [submodule "company-anaconda"] 45 | path = lib/company-anaconda 46 | url = git@github.com:proofit404/company-anaconda.git 47 | [submodule "csv-mode"] 48 | path = lib/csv-mode 49 | url = git@github.com:emacsmirror/csv-mode.git 50 | [submodule "dash"] 51 | path = lib/dash 52 | url = git@github.com:magnars/dash.el.git 53 | no-makeinfo = dash-template.texi 54 | [submodule "diff-hl"] 55 | path = lib/diff-hl 56 | url = git@github.com:dgutov/diff-hl.git 57 | [submodule "dired-du"] 58 | path = lib/dired-du 59 | url = git@github.com:emacsmirror/dired-du.git 60 | [submodule "edit-indirect"] 61 | path = lib/edit-indirect 62 | url = git@github.com:Fanael/edit-indirect.git 63 | [submodule "electric-operator"] 64 | path = lib/electric-operator 65 | url = git@github.com:davidshepherd7/electric-operator.git 66 | remote = "jabranham git@github.com:jabranham/electric-operator.git" 67 | no-byte-compile = electric-operator-benchmark.el 68 | [submodule "elfeed"] 69 | path = lib/elfeed 70 | url = git@github.com:skeeto/elfeed.git 71 | [submodule "elfeed-org"] 72 | path = lib/elfeed-org 73 | url = git@github.com:remyhonig/elfeed-org.git 74 | remote = "jabranham git@github.com:jabranham/elfeed-org.git" 75 | [submodule "emacsql"] 76 | path = lib/emacsql 77 | url = git@github.com:skeeto/emacsql.git 78 | no-byte-compile = emacsql-pg.el 79 | [submodule "epkg"] 80 | path = lib/epkg 81 | url = git@github.com:emacscollective/epkg.git 82 | [submodule "epl"] 83 | path = lib/epl 84 | url = git@github.com:cask/epl.git 85 | [submodule "ess"] 86 | path = lib/ess 87 | url = git@github.com:emacs-ess/ESS.git 88 | remote = "jabranham git@github.com:jabranham/ESS.git" 89 | info-path = doc 90 | [submodule "exec-path-from-shell"] 91 | path = lib/exec-path-from-shell 92 | url = git@github.com:purcell/exec-path-from-shell.git 93 | [submodule "exwm"] 94 | path = lib/exwm 95 | url = git@github.com:ch11ng/exwm.git 96 | [submodule "f"] 97 | path = lib/f 98 | url = git@github.com:rejeep/f.el.git 99 | [submodule "ghub"] 100 | path = lib/ghub 101 | url = git@github.com:magit/ghub.git 102 | [submodule "git-modes"] 103 | path = lib/git-modes 104 | url = git@github.com:magit/git-modes.git 105 | [submodule "git-timemachine"] 106 | path = lib/git-timemachine 107 | url = git@github.com:pidu/git-timemachine.git 108 | remote = "jabranham git@github.com:jabranham/git-timemachine.git" 109 | [submodule "helm"] 110 | path = lib/helm 111 | url = git@github.com:emacs-helm/helm.git 112 | [submodule "helm-bibtex"] 113 | path = lib/helm-bibtex 114 | url = git@github.com:tmalsburg/helm-bibtex.git 115 | remote = "jabranham git@github.com:jabranham/helm-bibtex.git" 116 | [submodule "helm-mu"] 117 | path = lib/helm-mu 118 | url = git@github.com:emacs-helm/helm-mu.git 119 | [submodule "helm-pass"] 120 | path = lib/helm-pass 121 | url = git@github.com:jabranham/helm-pass.git 122 | [submodule "helm-projectile"] 123 | path = lib/helm-projectile 124 | url = git@github.com:bbatsov/helm-projectile.git 125 | [submodule "ht"] 126 | path = lib/ht 127 | url = git@github.com:Wilfred/ht.el.git 128 | [submodule "htmlize"] 129 | path = lib/htmlize 130 | url = git@github.com:hniksic/emacs-htmlize.git 131 | [submodule "hydra"] 132 | path = lib/hydra 133 | url = git@github.com:abo-abo/hydra.git 134 | [submodule "ivy"] 135 | path = lib/ivy 136 | url = git@github.com:abo-abo/swiper.git 137 | [submodule "ledger-mode"] 138 | path = lib/ledger-mode 139 | url = git@github.com:ledger/ledger-mode.git 140 | remote = "jabranham git@github.com:jabranham/ledger-mode.git" 141 | info-path = doc 142 | [submodule "log4e"] 143 | path = lib/log4e 144 | url = git@github.com:aki2o/log4e.git 145 | [submodule "magit"] 146 | path = lib/magit 147 | url = git@github.com:magit/magit.git 148 | info-path = Documentation 149 | [submodule "magit-popup"] 150 | path = lib/magit-popup 151 | url = git@github.com:magit/magit-popup.git 152 | [submodule "markdown-mode"] 153 | path = lib/markdown-mode 154 | url = git@github.com:jrblevin/markdown-mode.git 155 | [submodule "minions"] 156 | path = lib/minions 157 | url = git@github.com:tarsius/minions.git 158 | [submodule "mixed-pitch"] 159 | path = lib/mixed-pitch 160 | url = git@github.com:jabranham/mixed-pitch.git 161 | [submodule "moody"] 162 | path = lib/moody 163 | url = git@github.com:tarsius/moody.git 164 | [submodule "mu4e-alert"] 165 | path = lib/mu4e-alert 166 | url = git@github.com:iqbalansari/mu4e-alert.git 167 | [submodule "multiple-cursors"] 168 | path = lib/multiple-cursors 169 | url = git@github.com:magnars/multiple-cursors.el.git 170 | remote = "jabranham git@github.com:jabranham/multiple-cursors.el.git" 171 | [submodule "names"] 172 | path = lib/names 173 | url = git@github.com:Malabarba/names.git 174 | [submodule "no-littering"] 175 | path = lib/no-littering 176 | url = git@github.com:emacscollective/no-littering.git 177 | [submodule "org"] 178 | path = lib/org 179 | url = https://code.orgmode.org/bzg/org-mode.git 180 | branch = maint 181 | load-path = lisp 182 | info-path = doc 183 | build-step = make compile autoloads info 184 | [submodule "org-ref"] 185 | path = lib/org-ref 186 | url = git@github.com:jkitchin/org-ref.git 187 | remote = "jabranham git@github.com:jabranham/org-ref.git" 188 | [submodule "packed"] 189 | path = lib/packed 190 | url = git@github.com:emacscollective/packed.git 191 | [submodule "parsebib"] 192 | path = lib/parsebib 193 | url = git@github.com:joostkremers/parsebib.git 194 | [submodule "password-store"] 195 | path = lib/password-store 196 | url = git@github.com:emacsmirror/password-store.git 197 | [submodule "pcomplete-extension"] 198 | path = lib/pcomplete-extension 199 | url = git@github.com:thierryvolpiatto/pcomplete-extension.git 200 | [submodule "pdf-tools"] 201 | path = lib/pdf-tools 202 | url = git@github.com:politza/pdf-tools.git 203 | build-step = make 204 | build-step = borg-byte-compile 205 | build-step = borg-update-autoloads 206 | [submodule "pkg-info"] 207 | path = lib/pkg-info 208 | url = git@github.com:lunaryorn/pkg-info.el.git 209 | [submodule "popup"] 210 | path = lib/popup 211 | url = git@github.com:auto-complete/popup-el.git 212 | [submodule "projectile"] 213 | path = lib/projectile 214 | url = git@github.com:bbatsov/projectile.git 215 | [submodule "pythonic"] 216 | path = lib/pythonic 217 | url = git@github.com:proofit404/pythonic.git 218 | [submodule "s"] 219 | path = lib/s 220 | url = git@github.com:magnars/s.el.git 221 | [submodule "spacemacs-theme"] 222 | path = lib/spacemacs-theme 223 | url = git@github.com:nashamri/spacemacs-theme.git 224 | remote = "jabranham git@github.com:jabranham/spacemacs-theme.git" 225 | [submodule "stan-mode"] 226 | path = lib/stan-mode 227 | url = git@github.com:stan-dev/stan-mode.git 228 | load-path = stan-mode 229 | [submodule "system-packages"] 230 | path = lib/system-packages 231 | url = git@github.com:jabranham/system-packages.git 232 | [submodule "tablist"] 233 | path = lib/tablist 234 | url = git@github.com:politza/tablist.git 235 | [submodule "unfill"] 236 | path = lib/unfill 237 | url = git@github.com:purcell/unfill.git 238 | no-byte-compile = test.el 239 | [submodule "use-package"] 240 | path = lib/use-package 241 | url = git@github.com:jwiegley/use-package.git 242 | [submodule "which-key"] 243 | path = lib/which-key 244 | url = git@github.com:justbur/emacs-which-key.git 245 | [submodule "winum"] 246 | path = lib/winum 247 | url = git@github.com:deb0ch/emacs-winum.git 248 | [submodule "with-editor"] 249 | path = lib/with-editor 250 | url = git@github.com:magit/with-editor.git 251 | [submodule "ws-butler"] 252 | path = lib/ws-butler 253 | url = git@github.com:lewang/ws-butler.git 254 | [submodule "xelb"] 255 | path = lib/xelb 256 | url = git@github.com:ch11ng/xelb.git 257 | [submodule "yasnippet"] 258 | path = lib/yasnippet 259 | url = git@github.com:joaotavora/yasnippet.git 260 | -------------------------------------------------------------------------------- /var/abbrev.el: -------------------------------------------------------------------------------- 1 | ;;-*-coding: utf-8;-*- 2 | (define-abbrev-table 'Buffer-menu-mode-abbrev-table '()) 3 | 4 | (define-abbrev-table 'Custom-mode-abbrev-table '()) 5 | 6 | (define-abbrev-table 'Info-edit-mode-abbrev-table '()) 7 | 8 | (define-abbrev-table 'Man-mode-abbrev-table '()) 9 | 10 | (define-abbrev-table 'Rd-mode-abbrev-table 11 | '( 12 | ("`ag" "\\arguments" nil 0) 13 | ("`al" "\\alias" nil 0) 14 | ("`au" "\\author" nil 0) 15 | ("`bf" "\\bold" nil 0) 16 | ("`co" "\\code" nil 0) 17 | ("`de" "\\describe" nil 0) 18 | ("`dn" "\\description" nil 0) 19 | ("`dt" "\\details" nil 0) 20 | ("`em" "\\emph" nil 0) 21 | ("`en" "\\enumerate" nil 0) 22 | ("`ex" "\\examples" nil 0) 23 | ("`fi" "\\file" nil 0) 24 | ("`fo" "\\format" nil 0) 25 | ("`it" "\\item" nil 0) 26 | ("`iz" "\\itemize" nil 0) 27 | ("`kw" "\\keyword" nil 0) 28 | ("`li" "\\link" nil 0) 29 | ("`me" "\\method" nil 0) 30 | ("`na" "\\name" nil 0) 31 | ("`no" "\\note" nil 0) 32 | ("`re" "\\references" nil 0) 33 | ("`sa" "\\seealso" nil 0) 34 | ("`se" "\\section" nil 0) 35 | ("`so" "\\source" nil 0) 36 | ("`ss" "\\subsection" nil 0) 37 | ("`sy" "\\synopsis" nil 0) 38 | ("`ta" "\\tabular" nil 0) 39 | ("`ti" "\\title" nil 0) 40 | ("`us" "\\usage" nil 0) 41 | ("`va" "\\value" nil 0) 42 | )) 43 | 44 | (define-abbrev-table 'TeX-error-overview-mode-abbrev-table '()) 45 | 46 | (define-abbrev-table 'TeX-output-mode-abbrev-table '()) 47 | 48 | (define-abbrev-table 'anaconda-mode-view-mode-abbrev-table '()) 49 | 50 | (define-abbrev-table 'apropos-mode-abbrev-table '()) 51 | 52 | (define-abbrev-table 'awk-mode-abbrev-table '()) 53 | 54 | (define-abbrev-table 'biblio-selection-mode-abbrev-table '()) 55 | 56 | (define-abbrev-table 'bibtex-mode-abbrev-table '()) 57 | 58 | (define-abbrev-table 'bookmark-bmenu-mode-abbrev-table '()) 59 | 60 | (define-abbrev-table 'bookmark-edit-annotation-mode-abbrev-table '()) 61 | 62 | (define-abbrev-table 'borg-build-mode-abbrev-table '()) 63 | 64 | (define-abbrev-table 'c++-mode-abbrev-table '()) 65 | 66 | (define-abbrev-table 'c-mode-abbrev-table '()) 67 | 68 | (define-abbrev-table 'calc-trail-mode-abbrev-table '()) 69 | 70 | (define-abbrev-table 'calendar-mode-abbrev-table '()) 71 | 72 | (define-abbrev-table 'change-log-mode-abbrev-table '()) 73 | 74 | (define-abbrev-table 'checkdoc-output-mode-abbrev-table '()) 75 | 76 | (define-abbrev-table 'comint-mode-abbrev-table '()) 77 | 78 | (define-abbrev-table 'completion-list-mode-abbrev-table '()) 79 | 80 | (define-abbrev-table 'conf-colon-mode-abbrev-table '()) 81 | 82 | (define-abbrev-table 'conf-desktop-mode-abbrev-table '()) 83 | 84 | (define-abbrev-table 'conf-javaprop-mode-abbrev-table '()) 85 | 86 | (define-abbrev-table 'conf-ppd-mode-abbrev-table '()) 87 | 88 | (define-abbrev-table 'conf-space-mode-abbrev-table '()) 89 | 90 | (define-abbrev-table 'conf-toml-mode-abbrev-table '()) 91 | 92 | (define-abbrev-table 'conf-unix-mode-abbrev-table '()) 93 | 94 | (define-abbrev-table 'conf-windows-mode-abbrev-table '()) 95 | 96 | (define-abbrev-table 'conf-xdefaults-mode-abbrev-table '()) 97 | 98 | (define-abbrev-table 'css-mode-abbrev-table '()) 99 | 100 | (define-abbrev-table 'csv-mode-abbrev-table '()) 101 | 102 | (define-abbrev-table 'custom-new-theme-mode-abbrev-table '()) 103 | 104 | (define-abbrev-table 'custom-theme-choose-mode-abbrev-table '()) 105 | 106 | (define-abbrev-table 'dcl-mode-abbrev-table '()) 107 | 108 | (define-abbrev-table 'debugger-mode-abbrev-table '()) 109 | 110 | (define-abbrev-table 'diary-fancy-display-mode-abbrev-table '()) 111 | 112 | (define-abbrev-table 'diary-mode-abbrev-table '()) 113 | 114 | (define-abbrev-table 'diff-mode-abbrev-table '()) 115 | 116 | (define-abbrev-table 'dig-mode-abbrev-table '()) 117 | 118 | (define-abbrev-table 'display-time-world-mode-abbrev-table '()) 119 | 120 | (define-abbrev-table 'doctex-mode-abbrev-table '()) 121 | 122 | (define-abbrev-table 'edebug-eval-mode-abbrev-table '()) 123 | 124 | (define-abbrev-table 'edit-abbrevs-mode-abbrev-table '()) 125 | 126 | (define-abbrev-table 'eieio-custom-mode-abbrev-table '()) 127 | 128 | (define-abbrev-table 'elisp-byte-code-mode-abbrev-table '()) 129 | 130 | (define-abbrev-table 'elpy-refactor-mode-abbrev-table '()) 131 | 132 | (define-abbrev-table 'emacs-lisp-mode-abbrev-table '()) 133 | 134 | (define-abbrev-table 'epa-info-mode-abbrev-table '()) 135 | 136 | (define-abbrev-table 'epa-key-list-mode-abbrev-table '()) 137 | 138 | (define-abbrev-table 'epa-key-mode-abbrev-table '()) 139 | 140 | (define-abbrev-table 'epkg-list-mode-abbrev-table '()) 141 | 142 | (define-abbrev-table 'erc-dcc-chat-mode-abbrev-table '()) 143 | 144 | (define-abbrev-table 'erc-list-menu-mode-abbrev-table '()) 145 | 146 | (define-abbrev-table 'erc-mode-abbrev-table '()) 147 | 148 | (define-abbrev-table 'ert-results-mode-abbrev-table '()) 149 | 150 | (define-abbrev-table 'ert-simple-view-mode-abbrev-table '()) 151 | 152 | (define-abbrev-table 'eshell-mode-abbrev-table '()) 153 | 154 | (define-abbrev-table 'ess-julia-mode-abbrev-table '()) 155 | 156 | (define-abbrev-table 'eww-bookmark-mode-abbrev-table '()) 157 | 158 | (define-abbrev-table 'eww-buffers-mode-abbrev-table '()) 159 | 160 | (define-abbrev-table 'eww-history-mode-abbrev-table '()) 161 | 162 | (define-abbrev-table 'eww-mode-abbrev-table '()) 163 | 164 | (define-abbrev-table 'exwm-mode-abbrev-table '()) 165 | 166 | (define-abbrev-table 'ffip-diff-mode-abbrev-table '()) 167 | 168 | (define-abbrev-table 'flycheck-error-list-mode-abbrev-table '()) 169 | 170 | (define-abbrev-table 'flymake-diagnostics-buffer-mode-abbrev-table '()) 171 | 172 | (define-abbrev-table 'fundamental-mode-abbrev-table '()) 173 | 174 | (define-abbrev-table 'gfm-mode-abbrev-table '()) 175 | 176 | (define-abbrev-table 'gfm-view-mode-abbrev-table '()) 177 | 178 | (define-abbrev-table 'gist-list-mode-abbrev-table '()) 179 | 180 | (define-abbrev-table 'git-gutter+-commit-mode-abbrev-table '()) 181 | 182 | (define-abbrev-table 'gitattributes-mode-abbrev-table '()) 183 | 184 | (define-abbrev-table 'gitconfig-mode-abbrev-table '()) 185 | 186 | (define-abbrev-table 'gitignore-mode-abbrev-table '()) 187 | 188 | (define-abbrev-table 'global-abbrev-table 189 | '( 190 | ("aacross" "across" nil 0) 191 | ("accidentily" "accidentally" nil 0) 192 | ("accomodate" "accommodate" nil 1) 193 | ("accompaning" "accompanying" nil 1) 194 | ("accurary" "accuracy" nil 2) 195 | ("acknowledgement" "acknowledgment" nil 0) 196 | ("acn" "can" nil 0) 197 | ("admitadly" "admittedly" nil 0) 198 | ("admittently" "admittedly" nil 0) 199 | ("advertisment" "advertisement" nil 0) 200 | ("affactionally" "affectionately" nil 0) 201 | ("affectionatley" "affectionately" nil 0) 202 | ("ahve" "have" nil 0) 203 | ("ambivilent" "ambivalent" nil 0) 204 | ("ancedotal" "anecdotal" nil 0) 205 | ("anomoly" "anomaly" nil 0) 206 | ("anonomous" "anonymous" nil 1) 207 | ("appdneix" "appendix" nil 0) 208 | ("arcipeligo" "archipelago" nil 0) 209 | ("arithmatic" "arithmetic" nil 0) 210 | ("aroudn" "around" nil 0) 211 | ("artigicial" "artificial" nil 0) 212 | ("auxillary" "auxiliary" nil 0) 213 | ("colarado" "colorado" nil 0) 214 | ("committment" "commitment" nil 0) 215 | ("committments" "commitments" nil 0) 216 | ("conceptualiation" "conceptualization" nil 0) 217 | ("conversley" "conversely" nil 0) 218 | ("conversly" "conversely" nil 0) 219 | ("convienence" "convenience" nil 0) 220 | ("convienent" "convenient" nil 0) 221 | ("countires" "countries" nil 0) 222 | ("criticise" "criticize" nil 0) 223 | ("definately" "definitely" nil 0) 224 | ("demcoratic" "democratic" nil 0) 225 | ("democraphic" "demographic" nil 0) 226 | ("discrepency" "discrepancy" nil 0) 227 | ("divy" "divvy" nil 0) 228 | ("ebcause" "because" nil 0) 229 | ("educaiton" "education" nil 3) 230 | ("emperical" "empirical" nil 4) 231 | ("entirally" "entirely" nil 0) 232 | ("equivilant" "equivalent" nil 0) 233 | ("equivilently" "equivalently" nil 0) 234 | ("excpetion" "exception" nil 0) 235 | ("exhasperation" "exasperation" nil 0) 236 | ("expidited" "expedited" nil 0) 237 | ("explicitely" "explicitly" nil 2) 238 | ("familarity" "familiarity" nil 0) 239 | ("folowwing" "following" nil 0) 240 | ("forcasting" "forecasting" nil 0) 241 | ("gague" "gauge" nil 1) 242 | ("gaguing" "gauging" nil 0) 243 | ("guidence" "guidance" nil 0) 244 | ("horrendeously" "horrendously" nil 0) 245 | ("hte" "the" nil 2) 246 | ("hten" "then" nil 0) 247 | ("htis" "this" nil 0) 248 | ("hve" "have" nil 0) 249 | ("hyphonating" "hyphenating" nil 0) 250 | ("ideosyncracies" "idiosyncrasies" nil 0) 251 | ("imbalences" "imbalances" nil 0) 252 | ("implicitely" "implicitly" nil 0) 253 | ("incongruent" "congruent" nil 0) 254 | ("increaase" "increase" nil 0) 255 | ("inderdisciplinary" "interdisciplinary" nil 0) 256 | ("indicies" "indices" nil 1) 257 | ("individiauls'" "individuals'" nil 0) 258 | ("infomation" "information" nil 0) 259 | ("ingrediants" "ingredients" nil 0) 260 | ("intrepret" "interpret" nil 2) 261 | ("intrepretation" "interpretation" nil 1) 262 | ("intrepreter" "interpreter" nil 1) 263 | ("intrepreting" "interpreting" nil 1) 264 | ("inversly" "inversely" nil 0) 265 | ("iwth" "with" nil 2) 266 | ("jsut" "just" nil 0) 267 | ("judgements" "judgments" nil 0) 268 | ("knwo" "know" nil 1) 269 | ("lcass" "class" nil 0) 270 | ("magniture" "magnitude" nil 0) 271 | ("methdology" "methodology" nil 1) 272 | ("millinneum" "millennium" nil 0) 273 | ("misintrepreted" "misinterpreted" nil 0) 274 | ("multipled" "multiplied" nil 0) 275 | ("netweok" "network" nil 0) 276 | ("occured" "occurred" nil 1) 277 | ("occurrance" "occurrence" nil 0) 278 | ("oen" "one" nil 0) 279 | ("partisanshpi" "partisanship" nil 0) 280 | ("pecularities" "peculiarities" nil 0) 281 | ("phenomina" "phenomena" nil 0) 282 | ("politiacl" "political" nil 1) 283 | ("postmortum" "postmortem" nil 0) 284 | ("preferneces" "preferences" nil 3) 285 | ("prevelance" "prevalence" nil 0) 286 | ("profeciency" "proficiency" nil 0) 287 | ("prominance" "prominence" nil 0) 288 | ("publically" "publicly" nil 0) 289 | ("reciept" "receipt" nil 0) 290 | ("reciepts" "receipts" nil 1) 291 | ("recommentation" "recommendation" nil 1) 292 | ("recursivelly" "recursively" nil 0) 293 | ("redundent" "redundant" nil 0) 294 | ("relaionship" "relationship" nil 0) 295 | ("relationshpi" "relationship" nil 0) 296 | ("remnents" "remnants" nil 0) 297 | ("represnet" "represent" nil 0) 298 | ("repsonsiveness" "responsiveness" nil 0) 299 | ("republiacns" "republicans" nil 0) 300 | ("resembelence" "resemblance" nil 0) 301 | ("sentance" "sentence" nil 0) 302 | ("sentances" "sentences" nil 1) 303 | ("seperate" "separate" nil 0) 304 | ("sincerally" "sincerely" nil 0) 305 | ("substantivelly" "substantively" nil 0) 306 | ("suitible" "suitable" nil 0) 307 | ("superflous" "superfluous" nil 0) 308 | ("suseptible" "susceptible" nil 0) 309 | ("synthasize" "synthesize" nil 0) 310 | ("systme" "system" nil 0) 311 | ("taht" "that" nil 3) 312 | ("teh" "the" nil 9) 313 | ("tihs" "this" nil 10) 314 | ("travelling" "traveling" nil 0) 315 | ("tyranney" "tyranny" nil 0) 316 | ("ubt" "but" nil 0) 317 | ("ubuquity" "ubiquity" nil 0) 318 | ("underreact" "react" nil 0) 319 | ("unfamilarity" "unfamiliarity" nil 0) 320 | ("unmanagable" "unmanageable" nil 0) 321 | ("wiht" "with" nil 0) 322 | ("woudl" "would" nil 0) 323 | )) 324 | 325 | (define-abbrev-table 'gnus-article-edit-mode-abbrev-table '()) 326 | 327 | (define-abbrev-table 'gnus-article-mode-abbrev-table '()) 328 | 329 | (define-abbrev-table 'gnus-browse-mode-abbrev-table '()) 330 | 331 | (define-abbrev-table 'gnus-category-mode-abbrev-table '()) 332 | 333 | (define-abbrev-table 'gnus-group-mode-abbrev-table '()) 334 | 335 | (define-abbrev-table 'gnus-score-mode-abbrev-table '()) 336 | 337 | (define-abbrev-table 'gnus-sticky-article-mode-abbrev-table '()) 338 | 339 | (define-abbrev-table 'grep-mode-abbrev-table '()) 340 | 341 | (define-abbrev-table 'helm-grep-mode-abbrev-table '()) 342 | 343 | (define-abbrev-table 'helm-major-mode-abbrev-table '()) 344 | 345 | (define-abbrev-table 'helm-moccur-mode-abbrev-table '()) 346 | 347 | (define-abbrev-table 'help-mode-abbrev-table '()) 348 | 349 | (define-abbrev-table 'html-mode-abbrev-table '()) 350 | 351 | (define-abbrev-table 'ibuffer-mode-abbrev-table '()) 352 | 353 | (define-abbrev-table 'idl-mode-abbrev-table '()) 354 | 355 | (define-abbrev-table 'image-dired-display-image-mode-abbrev-table '()) 356 | 357 | (define-abbrev-table 'image-dired-thumbnail-mode-abbrev-table '()) 358 | 359 | (define-abbrev-table 'inferior-emacs-lisp-mode-abbrev-table '()) 360 | 361 | (define-abbrev-table 'inferior-julia-mode-abbrev-table '()) 362 | 363 | (define-abbrev-table 'inferior-python-mode-abbrev-table '()) 364 | 365 | (define-abbrev-table 'ivy-occur-grep-mode-abbrev-table '()) 366 | 367 | (define-abbrev-table 'ivy-occur-mode-abbrev-table '()) 368 | 369 | (define-abbrev-table 'java-mode-abbrev-table '()) 370 | 371 | (define-abbrev-table 'js-jsx-mode-abbrev-table '()) 372 | 373 | (define-abbrev-table 'js-mode-abbrev-table '()) 374 | 375 | (define-abbrev-table 'julia-mode-abbrev-table '()) 376 | 377 | (define-abbrev-table 'latex-mode-abbrev-table '()) 378 | 379 | (define-abbrev-table 'ledger-check-mode-abbrev-table '()) 380 | 381 | (define-abbrev-table 'ledger-mode-abbrev-table 382 | '( 383 | ("RET55" "VFFVX" nil 0) 384 | ("STAR" "VGSTX" nil 0) 385 | )) 386 | 387 | (define-abbrev-table 'ledger-reconcile-mode-abbrev-table '()) 388 | 389 | (define-abbrev-table 'ledger-report-mode-abbrev-table '()) 390 | 391 | (define-abbrev-table 'lisp-mode-abbrev-table '()) 392 | 393 | (define-abbrev-table 'log-edit-mode-abbrev-table '()) 394 | 395 | (define-abbrev-table 'log4e-mode-abbrev-table '()) 396 | 397 | (define-abbrev-table 'magit-cherry-mode-abbrev-table '()) 398 | 399 | (define-abbrev-table 'magit-diff-mode-abbrev-table '()) 400 | 401 | (define-abbrev-table 'magit-log-mode-abbrev-table '()) 402 | 403 | (define-abbrev-table 'magit-log-select-mode-abbrev-table '()) 404 | 405 | (define-abbrev-table 'magit-merge-preview-mode-abbrev-table '()) 406 | 407 | (define-abbrev-table 'magit-mode-abbrev-table '()) 408 | 409 | (define-abbrev-table 'magit-popup-mode-abbrev-table '()) 410 | 411 | (define-abbrev-table 'magit-process-mode-abbrev-table '()) 412 | 413 | (define-abbrev-table 'magit-reflog-mode-abbrev-table '()) 414 | 415 | (define-abbrev-table 'magit-refs-mode-abbrev-table '()) 416 | 417 | (define-abbrev-table 'magit-repolist-mode-abbrev-table '()) 418 | 419 | (define-abbrev-table 'magit-revision-mode-abbrev-table '()) 420 | 421 | (define-abbrev-table 'magit-stash-mode-abbrev-table '()) 422 | 423 | (define-abbrev-table 'magit-stashes-mode-abbrev-table '()) 424 | 425 | (define-abbrev-table 'magit-status-mode-abbrev-table '()) 426 | 427 | (define-abbrev-table 'magit-submodule-list-mode-abbrev-table '()) 428 | 429 | (define-abbrev-table 'magithub-dash-mode-abbrev-table '()) 430 | 431 | (define-abbrev-table 'magithub-issue-post-mode-abbrev-table '()) 432 | 433 | (define-abbrev-table 'makefile-automake-mode-abbrev-table '()) 434 | 435 | (define-abbrev-table 'makefile-bsdmake-mode-abbrev-table '()) 436 | 437 | (define-abbrev-table 'makefile-gmake-mode-abbrev-table '()) 438 | 439 | (define-abbrev-table 'makefile-imake-mode-abbrev-table '()) 440 | 441 | (define-abbrev-table 'makefile-makepp-mode-abbrev-table '()) 442 | 443 | (define-abbrev-table 'makefile-mode-abbrev-table '()) 444 | 445 | (define-abbrev-table 'markdown-mode-abbrev-table '()) 446 | 447 | (define-abbrev-table 'markdown-view-mode-abbrev-table '()) 448 | 449 | (define-abbrev-table 'mediawiki-draft-mode-abbrev-table '()) 450 | 451 | (define-abbrev-table 'mediawiki-mode-abbrev-table '()) 452 | 453 | (define-abbrev-table 'message-mode-abbrev-table '()) 454 | 455 | (define-abbrev-table 'messages-buffer-mode-abbrev-table '()) 456 | 457 | (define-abbrev-table 'mhtml-mode-abbrev-table '()) 458 | 459 | (define-abbrev-table 'mu4e-compose-mode-abbrev-table '()) 460 | 461 | (define-abbrev-table 'mu4e-org-mode-abbrev-table '()) 462 | 463 | (define-abbrev-table 'mu4e~update-mail-mode-abbrev-table '()) 464 | 465 | (define-abbrev-table 'nxml-mode-abbrev-table '()) 466 | 467 | (define-abbrev-table 'objc-mode-abbrev-table '()) 468 | 469 | (define-abbrev-table 'occur-edit-mode-abbrev-table '()) 470 | 471 | (define-abbrev-table 'occur-mode-abbrev-table '()) 472 | 473 | (define-abbrev-table 'org-export-stack-mode-abbrev-table '()) 474 | 475 | (define-abbrev-table 'org-lint--report-mode-abbrev-table '()) 476 | 477 | (define-abbrev-table 'org-mode-abbrev-table '()) 478 | 479 | (define-abbrev-table 'outline-mode-abbrev-table '()) 480 | 481 | (define-abbrev-table 'package-menu-mode-abbrev-table '()) 482 | 483 | (define-abbrev-table 'pdf-annot-list-mode-abbrev-table '()) 484 | 485 | (define-abbrev-table 'pdf-occur-buffer-mode-abbrev-table '()) 486 | 487 | (define-abbrev-table 'pdf-outline-buffer-mode-abbrev-table '()) 488 | 489 | (define-abbrev-table 'perl-mode-abbrev-table '()) 490 | 491 | (define-abbrev-table 'pike-mode-abbrev-table '()) 492 | 493 | (define-abbrev-table 'pkgbuild-mode-abbrev-table '()) 494 | 495 | (define-abbrev-table 'plain-tex-mode-abbrev-table '()) 496 | 497 | (define-abbrev-table 'poly-fallback-mode-abbrev-table '()) 498 | 499 | (define-abbrev-table 'poly-head-tail-mode-abbrev-table '()) 500 | 501 | (define-abbrev-table 'process-menu-mode-abbrev-table '()) 502 | 503 | (define-abbrev-table 'prog-mode-abbrev-table '()) 504 | 505 | (define-abbrev-table 'ps-mode-abbrev-table '()) 506 | 507 | (define-abbrev-table 'ps-run-mode-abbrev-table '()) 508 | 509 | (define-abbrev-table 'python-mode-abbrev-table '()) 510 | 511 | (define-abbrev-table 'python-mode-skeleton-abbrev-table '()) 512 | 513 | (define-abbrev-table 'reftex-select-bib-mode-abbrev-table '()) 514 | 515 | (define-abbrev-table 'reftex-select-label-mode-abbrev-table '()) 516 | 517 | (define-abbrev-table 'reftex-toc-mode-abbrev-table '()) 518 | 519 | (define-abbrev-table 'ruby-mode-abbrev-table '()) 520 | 521 | (define-abbrev-table 'scss-mode-abbrev-table '()) 522 | 523 | (define-abbrev-table 'select-tags-table-mode-abbrev-table '()) 524 | 525 | (define-abbrev-table 'sgml-mode-abbrev-table '()) 526 | 527 | (define-abbrev-table 'sh-mode-abbrev-table '()) 528 | 529 | (define-abbrev-table 'shell-mode-abbrev-table '()) 530 | 531 | (define-abbrev-table 'slitex-mode-abbrev-table '()) 532 | 533 | (define-abbrev-table 'smime-mode-abbrev-table '()) 534 | 535 | (define-abbrev-table 'snippet-mode-abbrev-table '()) 536 | 537 | (define-abbrev-table 'special-mode-abbrev-table '()) 538 | 539 | (define-abbrev-table 'speedbar-mode-abbrev-table '()) 540 | 541 | (define-abbrev-table 'stan-mode-abbrev-table '()) 542 | 543 | (define-abbrev-table 'sx-compose-mode-abbrev-table '()) 544 | 545 | (define-abbrev-table 'sx-inbox-mode-abbrev-table '()) 546 | 547 | (define-abbrev-table 'sx-question-list-mode-abbrev-table '()) 548 | 549 | (define-abbrev-table 'sx-question-mode-abbrev-table '()) 550 | 551 | (define-abbrev-table 'systemd-mode-abbrev-table '()) 552 | 553 | (define-abbrev-table 'tablist-mode-abbrev-table '()) 554 | 555 | (define-abbrev-table 'tabulated-list-mode-abbrev-table '()) 556 | 557 | (define-abbrev-table 'tar-mode-abbrev-table '()) 558 | 559 | (define-abbrev-table 'term-mode-abbrev-table '()) 560 | 561 | (define-abbrev-table 'tex-mode-abbrev-table '()) 562 | 563 | (define-abbrev-table 'tex-shell-abbrev-table '()) 564 | 565 | (define-abbrev-table 'texinfo-mode-abbrev-table '()) 566 | 567 | (define-abbrev-table 'text-mode-abbrev-table '()) 568 | 569 | (define-abbrev-table 'url-cookie-mode-abbrev-table '()) 570 | 571 | (define-abbrev-table 'use-package-statistics-mode-abbrev-table '()) 572 | 573 | (define-abbrev-table 'vc-dir-mode-abbrev-table '()) 574 | 575 | (define-abbrev-table 'vc-git-log-edit-mode-abbrev-table '()) 576 | 577 | (define-abbrev-table 'vc-git-log-view-mode-abbrev-table '()) 578 | 579 | (define-abbrev-table 'vc-git-region-history-mode-abbrev-table '()) 580 | 581 | (define-abbrev-table 'web-mode-abbrev-table '()) 582 | 583 | (define-abbrev-table 'xref--xref-buffer-mode-abbrev-table '()) 584 | 585 | (define-abbrev-table 'yaml-mode-abbrev-table '()) 586 | 587 | -------------------------------------------------------------------------------- /init.el: -------------------------------------------------------------------------------- 1 | ;;; init.el --- Emacs initialization -*- lexical-binding: t; -*- 2 | 3 | 4 | ;;; Commentary: 5 | ;; This is my personal Emacs config. It works for me, but probably won't 6 | ;; for you. The general idea is to load a few things early that need to be 7 | ;; set early, like the package manager, and then use `use-package' to 8 | ;; load/defer/config everything else alphabetically. 9 | 10 | ;;; Code: 11 | 12 | (when (< emacs-major-version 26) ; Minimum version 13 | (error "Your Emacs is too old -- this config requires version 26 or higher")) 14 | 15 | ;; Temporarily raise the gc threshold 16 | (setq gc-cons-threshold (* 50 1000 1000)) 17 | 18 | ;;; Early birds 19 | (progn ; startup & C source code vars 20 | (setq user-init-file (or load-file-name buffer-file-name) 21 | user-emacs-directory (file-name-directory user-init-file)) 22 | (message "Loading %s..." user-init-file) 23 | ;; (package-initialize) 24 | (setq inhibit-startup-buffer-menu t 25 | inhibit-startup-screen t 26 | package-enable-at-startup nil 27 | load-prefer-newer t 28 | ;; don't use popup boxes, just make the minibuffer ask 29 | use-dialog-box nil 30 | initial-major-mode #'org-mode 31 | initial-scratch-message "# Unsaved notes\n\n" 32 | ;; Delete my files by moving them to the trash. I'm human and 33 | ;; occasionally delete things that I actually want later: 34 | delete-by-moving-to-trash t 35 | ;; Emacs has some awful scrolling by default. This gets rid of that. 36 | scroll-step 1 ; keyboard scroll one line at a time 37 | scroll-preserve-screen-position 'always 38 | scroll-conservatively 101 39 | next-screen-context-lines 5 40 | ;; remove auditory clutter: 41 | ring-bell-function #'ignore) 42 | (advice-add #'display-startup-echo-area-message :override #'ignore) 43 | ;; Don't ever use tabs. Always use spaces. 44 | (setq-default indent-tabs-mode nil) 45 | ;; for the lazy: 46 | (defalias 'yes-or-no-p 'y-or-n-p) 47 | ;; remove visual clutter: 48 | (scroll-bar-mode 0) 49 | (tool-bar-mode 0) 50 | (menu-bar-mode 0) 51 | ;; Emacs thinks that some new users may find some commands confusing, so 52 | ;; they're disabled by default. I use these every now and then, so let's 53 | ;; enable them by default: 54 | (put #'downcase-region 'disabled nil) 55 | (put #'upcase-region 'disabled nil) 56 | (put #'narrow-to-region 'disabled nil) 57 | ;; Prefer utf8 58 | (prefer-coding-system 'utf-8)) 59 | 60 | (progn ; `borg' 61 | (add-to-list 'load-path (expand-file-name "lib/borg" user-emacs-directory)) 62 | (require 'borg) 63 | (borg-initialize)) 64 | 65 | (progn ; `use-package' 66 | (setq use-package-enable-imenu-support t) 67 | (require 'use-package) 68 | (setq use-package-compute-statistics t) 69 | ;; Setup a personal keymap. I'll bind various things to this later on: 70 | (bind-keys :prefix "" 71 | :prefix-map my/map)) 72 | 73 | 74 | (use-package auto-compile 75 | :demand t 76 | :custom 77 | (auto-compile-mode-line-counter t "Show compile info in the mode-line") 78 | (auto-compile-source-recreate-deletes-dest t) 79 | (auto-compile-toggle-deletes-nonlib-dest t) 80 | (auto-compile-update-autoloads t) 81 | (auto-compile-display-buffer nil "Don't display compile buffer") 82 | :hook 83 | (auto-compile-inhibit-compile . auto-compile-inhibit-compile-detached-git-head) 84 | :config 85 | (auto-compile-on-load-mode) 86 | (auto-compile-on-save-mode)) 87 | 88 | ;; Finally, I set up no-littering, which keeps my .emacs.d folder clean by 89 | ;; putting files into appropriate subfolders rather than letting them get 90 | ;; saved all over the place: 91 | (use-package no-littering 92 | :demand t) 93 | 94 | ;;; end of early birds, alphabetical from here on out: 95 | 96 | (use-package abbrev 97 | :defer 2 98 | :custom 99 | (save-abbrevs 'silently) 100 | :hook 101 | (text-mode . abbrev-mode)) 102 | 103 | (use-package aggressive-indent 104 | ;; Keep code indented automatically 105 | :defer 10 106 | :config 107 | (global-aggressive-indent-mode)) 108 | 109 | (use-package alert 110 | ;; Set it up so Emacs can send system notifications: 111 | :defer t 112 | :custom 113 | (alert-default-style 'libnotify) 114 | :config 115 | (defun my/pause-notifications () 116 | "Pause notification display." 117 | (interactive) 118 | (shell-command "killall -SIGUSR1 dunst" nil nil) 119 | (message "Notifications paused.")) 120 | (defun my/resume-notifications () 121 | "Resume notification display." 122 | (interactive) 123 | (shell-command "killall -SIGUSR2 dunst" nil nil) 124 | (message "Notifications resumed."))) 125 | 126 | (use-package anaconda-mode 127 | ;; sets up some nice things in python buffers: 128 | :hook 129 | (python-mode . anaconda-mode) 130 | (python-mode . anaconda-eldoc-mode)) 131 | 132 | (use-package appt 133 | ;; keep track of appointments 134 | :defer 2 135 | :custom 136 | (appt-delete-window-function (lambda () t)) 137 | (appt-disp-window-function #'my/appt-display) 138 | (appt-display-interval 12 "Don't notify more than once") 139 | (appt-message-warning-time 12) 140 | (appt-display-mode-line nil) 141 | :config 142 | (defun my/appt-display (time-til _time msg) 143 | (if (listp time-til) 144 | (dotimes (i (length msg)) 145 | (alert (concat (nth i msg) " in " (nth i time-til) " minutes") 146 | :title "Appt")) 147 | (alert (concat msg " in " time-til " minutes") :title "Appt"))) 148 | (appt-activate)) 149 | 150 | (use-package async 151 | ;; Async is written to let things be more async-y in Emacs. I use it for 152 | ;; dired-async mode mostly. 153 | :defer 1 154 | :custom 155 | (dired-async-message-function #'my/dired-async-message-function) 156 | :config 157 | (defun my/dired-async-message-function (text _face &rest args) 158 | "Log messages from dired-async to messages buffer." 159 | ;; For whatever reason, the default for this *doesn't* log it to 160 | ;; *Messages*. Instead, it just displays the notification in the 161 | ;; mode line for 3 seconds, but if you type something it 162 | ;; immediately goes away. So just log it to *Messages* like a sane 163 | ;; person instead: 164 | (message (format "Finished %s" (apply #'format text args)))) 165 | ;; do dired actions asynchronously 166 | (dired-async-mode)) 167 | 168 | (use-package auctex 169 | ;; AuCTeX is better than the built in tex mode; let's use it. 170 | :load tex-site 171 | :mode ("\\.tex\\'" . TeX-latex-mode) 172 | :custom 173 | (TeX-lisp-directory (expand-file-name "~/.emacs.d/lib/auctex")) 174 | (TeX-data-directory (expand-file-name "~/.emacs.d/lib/auctex")) 175 | (TeX-auto-save t) 176 | (TeX-electric-escape t) 177 | (TeX-electric-math '("\\(" . "\\)") "Smart $ behavior") 178 | (TeX-electric-sub-and-superscript t) 179 | (TeX-parse-self t) 180 | (reftex-plug-into-AUCTeX t) 181 | (TeX-source-correlate-method 'synctex) 182 | (TeX-source-correlate-mode t) 183 | (TeX-clean-confirm nil) 184 | ;; TeX-command-list by default contains a bunch of stuff I'll never 185 | ;; use. I use latexmk, xelatexmk, and View. That's pretty much it. 186 | ;; Maybe one day I'll add "clean" back to the list. 187 | (TeX-command-list 188 | '(("latexmk" "latexmk -synctex=1 -quiet -pdf %s" 189 | TeX-run-compile nil t :help "Process file with latexmk") 190 | ("View" "%V" TeX-run-discard-or-function nil t :help "Run Viewer") 191 | ("xelatexmk" "latexmk -synctex=1 -quiet -xelatex %s" 192 | TeX-run-compile nil t :help "Process file with xelatexmk"))) 193 | :hook 194 | (LaTeX-mode . LaTeX-math-mode) 195 | (LaTeX-mode . reftex-mode) 196 | (LaTeX-mode . TeX-PDF-mode) 197 | :config 198 | (setq-default TeX-command-default "latexmk") 199 | ;; revert pdf from file after compilation finishes 200 | (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer) 201 | (use-package latex 202 | :bind 203 | (:map LaTeX-mode-map 204 | ("M-p" . outline-previous-visible-heading) 205 | ("M-n" . outline-next-visible-heading) 206 | ("" . org-cycle)))) 207 | 208 | (use-package auth-source-pass 209 | ;; Integrate Emacs's builtin auth-source with pass: 210 | :if (executable-find "pass") 211 | :demand t 212 | :config 213 | (auth-source-pass-enable)) 214 | 215 | (use-package autoinsert 216 | :defer 2 217 | :config 218 | (auto-insert-mode)) 219 | 220 | (use-package autorevert 221 | :defer 1 222 | :custom 223 | (global-auto-revert-non-file-buffers t) 224 | (auto-revert-verbose nil) 225 | :config 226 | ;; Emacs should refresh buffers automatically so if they've changed on 227 | ;; disk the buffer will update. 228 | (global-auto-revert-mode)) 229 | 230 | (use-package bibtex 231 | :defer t ; built-in with Emacs 232 | :custom 233 | (bibtex-autokey-titleword-length 0) 234 | (bibtex-autokey-titleword-separator "") 235 | (bibtex-autokey-titlewords 0) 236 | (bibtex-autokey-year-length 4) 237 | (bibtex-autokey-year-title-separator "") 238 | (bibtex-align-at-equal-sign t) 239 | ;; The default for bibtex-entry-format includes opts-or-alts, which deletes 240 | ;; empty entries. I want to keep those around, though, because a lot of 241 | ;; forthcoming articles get things like pages later: 242 | (bibtex-entry-format '(required-fields numerical-fields)) 243 | (bibtex-files '("~/Sync/bibliography/references.bib")) 244 | (bibtex-file-path "~/Sync/bibliography/references.bib") 245 | :hook 246 | (bibtex-mode . my/setup-bibtex-mode) 247 | :config 248 | (defun my/setup-bibtex-mode () 249 | "Set up bibtex mode." 250 | (set-fill-column most-positive-fixnum)) 251 | (defun my/bibtex-generate-autokey () 252 | "This overwrites the bibtex-generate-autokey function that comes with Emacs. 253 | 254 | I want my keys to be formatted: authornameYEAR, then a letter if there is already an entry that matches authornameYEAR." 255 | (interactive) 256 | ;; first we delete the existing key 257 | (bibtex-beginning-of-entry) 258 | (re-search-forward bibtex-entry-maybe-empty-head) 259 | (if (match-beginning bibtex-key-in-head) 260 | (delete-region (match-beginning bibtex-key-in-head) 261 | (match-end bibtex-key-in-head))) 262 | (let* ((names (bibtex-autokey-get-names)) 263 | (year (bibtex-autokey-get-year)) 264 | (existing-keys (bibtex-parse-keys)) 265 | key) 266 | (setq key (format "%s%s" names year)) 267 | (let ((ret key)) 268 | (cl-loop for c 269 | from ?b to ?z 270 | while (assoc ret existing-keys) 271 | do (setq ret (format "%s%c" key c))) 272 | ret))) 273 | (advice-add #'bibtex-generate-autokey :override #'my/bibtex-generate-autokey)) 274 | 275 | (use-package browse-url 276 | :defer t 277 | :custom 278 | ;; Use Emacs' built in eww broswer (the Emacs Web Wowser!) by default. 279 | ;; browse-url-browser-function can take a list of regex's and associate a 280 | ;; specific browser with matches. So use eww for everything except a few 281 | ;; things that don't work well: 282 | (browse-url-browser-function 283 | '(("." . browse-url-firefox)))) 284 | 285 | (use-package calc 286 | :defer t 287 | :bind 288 | (:map my/map 289 | ("C" . my/calc-eval-region)) 290 | :config 291 | (defun my/calc-eval-region (arg) 292 | "Evaluate an expression in calc and communicate the result. 293 | 294 | If the region is active evaluate that, otherwise search backwards 295 | to the first whitespace character to find the beginning of the 296 | expression. By default, replace the expression with its value. If 297 | called with the universal prefix argument, keep the expression 298 | and insert the result into the buffer after it. If called with a 299 | negative prefix argument, just echo the result in the 300 | minibuffer." 301 | (interactive "p") 302 | (let (start end) 303 | (if (use-region-p) 304 | (setq start (region-beginning) end (region-end)) 305 | (progn 306 | (setq end (point)) 307 | (setq start (search-backward-regexp "\\s-\\|\n" 0 1)) 308 | (setq start (1+ (if start start 0))) 309 | (goto-char end))) 310 | (let ((value (calc-eval (buffer-substring-no-properties start end)))) 311 | (pcase arg 312 | (1 (delete-region start end)) 313 | (4 (insert " = "))) 314 | (pcase arg 315 | ((or 1 4) (insert value)) 316 | (-1 (message value))))))) 317 | 318 | (use-package calendar 319 | ;; Yes, my text editor comes with a calendar built in. Doesn't yours? 320 | :defer t 321 | :hook 322 | ;; make today easier to find, visually: 323 | (calendar-today-visible . calendar-mark-today) 324 | :config 325 | (setq calendar-location-name "Austin") 326 | (setq calendar-latitude [30 16 north]) 327 | (setq calendar-longitude [97 44 west]) 328 | ;; Show holidays in the calendar 329 | (setq calendar-mark-holidays-flag t) 330 | ;; Weeks start on Sunday 331 | (setq calendar-week-start-day 0) 332 | (setq calendar-date-display-form calendar-iso-date-display-form) 333 | (calendar-set-date-style 'iso)) 334 | 335 | (use-package comint 336 | :defer t 337 | ;; comint is the mode from which inferior processes inherit, like the 338 | ;; python REPL or iESS modes (the R console) 339 | :config 340 | (setq comint-move-point-for-output nil) 341 | (setq comint-scroll-to-bottom-on-input 'this)) 342 | 343 | (use-package company 344 | ;; Company mode provides autocompletion of text and code. 345 | :bind 346 | (:map company-active-map 347 | ("C-s" . company-search-candidates) 348 | ("" . company-complete-common-or-cycle) 349 | ("RET" . company-complete-selection) 350 | ("C-n" . company-select-next) 351 | ("C-p" . company-select-previous)) 352 | :hook 353 | (prog-mode . company-mode) 354 | :custom 355 | (company-idle-delay 0.25) 356 | (company-require-match nil) 357 | (company-minimum-prefix-length 2)) 358 | 359 | (use-package company-anaconda 360 | ;; company for integration with anaconda (loaded above) 361 | :after (anaconda-mode company) 362 | :config 363 | (add-to-list 'company-backends 'company-anaconda)) 364 | 365 | (use-package compile 366 | :defer t 367 | :config 368 | (setq compilation-ask-about-save nil) 369 | (setq compilation-scroll-output 'first-error)) 370 | 371 | (use-package conf-mode 372 | :mode (("\\.service\\'" . conf-unix-mode) 373 | ("\\.timer\\'" . conf-unix-mode) 374 | ("\\.target\\'" . conf-unix-mode) 375 | ("\\.mount\\'" . conf-unix-mode) 376 | ("\\.automount\\'" . conf-unix-mode) 377 | ("\\.slice\\'" . conf-unix-mode) 378 | ("\\.socket\\'" . conf-unix-mode) 379 | ("\\.path\\'" . conf-unix-mode) 380 | ("\\.netdev\\'" . conf-unix-mode) 381 | ("\\.network\\'" . conf-unix-mode) 382 | ("\\.link\\'" . conf-unix-mode) 383 | ("\\.automount\\'" . conf-unix-mode))) 384 | 385 | (use-package csv-mode 386 | ;; Emacs can handle csv files with ease: 387 | :defer) 388 | 389 | (use-package custom 390 | :no-require t 391 | :defer t 392 | :config 393 | ;; Don't write customization settings to init.el ... or anywhere else. 394 | (setq custom-file null-device)) 395 | 396 | (use-package delsel 397 | :defer 1 398 | :config 399 | ;; Emacs by default doesn't replace selected text if you start typing 400 | ;; over it. Since that's the behavior of virtually all other programs, 401 | ;; let's make emacs do that too: 402 | (delete-selection-mode)) 403 | 404 | (use-package diff-hl 405 | :defer 15 406 | ;; highlight changes to files on the side 407 | :hook 408 | (magit-post-refresh . diff-hl-magit-post-refresh) 409 | :config 410 | (global-diff-hl-mode)) 411 | 412 | (use-package dired 413 | ;; Emacs can act as your file finder/explorer. Dired is the built-in way 414 | ;; to do this. 415 | :defer t 416 | :bind 417 | (("C-x C-d" . dired) ; overrides list-directory, which I never use 418 | :map dired-mode-map 419 | ("l" . dired-up-directory)) ; use l to go up in dired 420 | :config 421 | (setq dired-auto-revert-buffer t) 422 | (setq dired-dwim-target t) 423 | (setq dired-recursive-copies 'always) 424 | (setq dired-recursive-deletes 'always) 425 | ;; -l: long listing format REQUIRED in dired-listing-switches 426 | ;; -a: show everything (including dotfiles) 427 | ;; -h: human-readable file sizes 428 | (setq dired-listing-switches "-alh --group-directories-first") 429 | (defun my/dired-ediff-marked () 430 | "Run `ediff' on two marked files in a dired buffer." 431 | (interactive) 432 | (unless (eq 'dired-mode major-mode) 433 | (error "For use in dired buffers only")) 434 | (let ((files (dired-get-marked-files))) 435 | (when (not (eq 2 (length files))) 436 | (error "Two files not marked")) 437 | (ediff (car files) (nth 1 files))))) 438 | 439 | (use-package dired-du 440 | ;; List directory sizes using du: 441 | :bind 442 | (:map dired-mode-map 443 | ("S" . dired-du-mode)) 444 | :custom 445 | (dired-du-size-format t) 446 | :hook 447 | (dired-mode . my/dired-maybe-hide-details) 448 | :config 449 | (defun my/dired-maybe-hide-details () 450 | "Hide details (owner, permissions, etc) in dired unless dired-du-mode is active." 451 | (unless dired-du-mode (dired-hide-details-mode)))) 452 | 453 | (use-package dired-x 454 | :hook 455 | (dired-load . (lambda () (load "dired-x"))) 456 | :bind 457 | ("C-x C-j" . dired-jump) 458 | :custom 459 | ;; By default, dired asks you if you want to delete the dired buffer if 460 | ;; you delete the folder. I can't think of a reason I'd ever want to do 461 | ;; that. 462 | (dired-clean-confirm-killing-deleted-buffers nil)) 463 | 464 | (use-package ediff 465 | ;; Ediff is great, but I have to tell it to use one frame (since I start 466 | ;; Emacs before X/wayland, it defaults to using two frames). 467 | :defer t 468 | :custom 469 | (ediff-window-setup-function #'ediff-setup-windows-plain) 470 | :hook 471 | (ediff-prepare-buffer . my/ediff-prepare-buffer) 472 | :config 473 | (defun my/ediff-prepare-buffer () 474 | "Function to prepare ediff buffers. 475 | 476 | Runs with `ediff-prepare-buffer-hook' so that it gets run on all 477 | three ediff buffers (A, B, and C)." 478 | (when (memq major-mode '(org-mode emacs-lisp-mode)) 479 | ;; unfold org/elisp files 480 | (outline-show-all)))) 481 | 482 | (use-package edit-indirect 483 | ;; Markdown relies on this package for to edit source code blocks like 484 | ;; org mode: 485 | :defer t) 486 | 487 | (use-package eldoc 488 | ;; eldoc shows useful information in the minibuffer and is enabled by 489 | ;; default. 490 | :defer 1 491 | :config 492 | ;; No need to delay showing eldoc 493 | (setq eldoc-idle-delay 0)) 494 | 495 | (use-package elec-pair 496 | :defer 1 497 | :config 498 | (electric-pair-mode)) 499 | 500 | (use-package electric-operator 501 | ;; Electric operator will turn ~a=10*5+2~ into ~a = 10 * 5 + 2~, so let's 502 | ;; enable it for R: 503 | :hook 504 | ((ess-mode python-mode) . electric-operator-mode) 505 | :custom 506 | (electric-operator-R-named-argument-style 'spaced)) 507 | 508 | (use-package elfeed 509 | ;; Manage RSS and atom feeds from within Emacs! 510 | :bind 511 | (:map my/map 512 | ("s" . bjm/elfeed-load-db-and-open) 513 | :map elfeed-search-mode-map 514 | ("l" . my/get-elfeed-log-buffer)) 515 | :custom 516 | (elfeed-db-directory "~/Sync/.elfeed") 517 | (elfeed-search-print-entry-function #'my/elfeed-print-entry) 518 | :init 519 | ;; thanks - 520 | ;; http://pragmaticemacs.com/emacs/read-your-rss-feeds-in-emacs-with-elfeed/ 521 | ;; though slightly modified functions to support syncing .elfeed between 522 | ;; machines makes sure elfeed reads index from disk before launching 523 | (defun bjm/elfeed-load-db-and-open () 524 | "Load the elfeed db from disk before updating." 525 | (interactive) 526 | (elfeed) 527 | (elfeed-db-load) 528 | (elfeed-search-update--force) 529 | (elfeed-update)) 530 | :hook 531 | (elfeed-show-mode . my/setup-elfeed-show-mode) 532 | (elfeed-search-mode . my/setup-elfeed-search-mode) 533 | :config 534 | (defun my/setup-elfeed-show-mode () 535 | "Setup `elfeed-show-mode'." 536 | (setq-local shr-width 80) 537 | ;; Scale down huge images: 538 | (setq-local shr-max-image-proportion 0.6)) 539 | (defun my/setup-elfeed-search-mode () 540 | "Setup `elfeed-search-mode'." 541 | ;; Don't use visual line mode in elfeed-search: 542 | (visual-line-mode -1)) 543 | ;; Overwrite the default print-entry function with one that prints date, 544 | ;; then feed-title, then title: 545 | (defun my/elfeed-print-entry (entry) 546 | "Print ENTRY to the buffer." 547 | (let* ((date (elfeed-search-format-date (elfeed-entry-date entry))) 548 | (title (or (elfeed-meta entry :title) 549 | (elfeed-entry-title entry) "")) 550 | (title-faces (elfeed-search--faces (elfeed-entry-tags entry))) 551 | (title-column (elfeed-format-column 552 | title (+ (window-width) (- 12) (- 12)) :left)) 553 | (feed (elfeed-entry-feed entry)) 554 | (feed-title 555 | (when feed 556 | (or (elfeed-meta feed :title) (elfeed-feed-title feed)))) 557 | (feed-column (elfeed-format-column 558 | feed-title 10 :right))) 559 | (insert (propertize date 'face 'elfeed-search-date-face) " ") 560 | (when feed-title 561 | (insert (propertize feed-column 'face 'elfeed-search-feed-face) " ")) 562 | (insert (propertize title-column 'face title-faces) " "))) 563 | (defun my/get-elfeed-log-buffer () 564 | "Show elfeed log." 565 | (interactive) 566 | (switch-to-buffer-other-window (get-buffer "*elfeed-log*"))) 567 | (use-package elfeed-link)) 568 | 569 | (use-package elfeed-org 570 | :after elfeed 571 | :custom 572 | (rmh-elfeed-org-files '("~/Sync/.elfeed/rmh-elfeed.org")) 573 | :config 574 | (elfeed-org)) 575 | 576 | (use-package elisp-mode 577 | :defer t 578 | :hook 579 | ;; Turn on flymake for emacs-lisp: 580 | (emacs-lisp-mode . my/setup-emacs-lisp-mode) 581 | :config 582 | (defun my/setup-emacs-lisp-mode () 583 | "Setup stuff for elisp." 584 | ;; Sentences end with a double space in elisp: 585 | (setq-local sentence-end-double-space t))) 586 | 587 | (use-package emacsbug 588 | :defer t 589 | :custom 590 | (report-emacs-bug-no-explanations t)) 591 | 592 | (use-package epkg 593 | :defer t 594 | :bind 595 | ("C-h P" . epkg-list-packages) 596 | ("C-h p" . epkg-describe-package) 597 | :custom 598 | (epkg-repository (expand-file-name "var/epkgs/" user-emacs-directory))) 599 | 600 | (use-package erc 601 | ;; ERC is Emacs's client for IRC. 602 | :if (executable-find "pass") 603 | :commands (erc) 604 | :custom 605 | (erc-autojoin-channels-alist '(("freenode.net" "#emacs" "#archlinux"))) 606 | (erc-join-buffer 'bury) 607 | (erc-lurker-hide-list '("JOIN" "PART" "QUIT")) 608 | 609 | (erc-port "6667") 610 | (erc-server-reconnect-attempts 12) 611 | (erc-server-reconnect-timeout 5) 612 | (erc-nick "jabranham") 613 | :hook 614 | (erc-mode . goto-address-mode) 615 | (erc-mode . erc-notifications-mode) 616 | :config 617 | ;; Don't put this in :custom because it causes erc to get loaded. 618 | (setq erc-server "irc.freenode.net" 619 | erc-password (password-store-get "irc.freenode.net"))) 620 | 621 | (use-package eshell 622 | ;; Eshell is Emacs' built-in shell. You get UNIX-y goodness even on 623 | ;; Windows machines, plus it can evaluate elisp. 624 | :defer t 625 | :custom 626 | (eshell-buffer-maximum-lines 20000 "Auto truncate after 20k lines") 627 | (eshell-highlight-prompt nil "My prompt is easy enough to see") 628 | (eshell-hist-ignoredups t "No duplicates in history") 629 | (eshell-history-size 1024 "history size") 630 | (eshell-list-files-after-cd t "List files after cd.") 631 | (eshell-ls-initial-args "-ah" "Also list all files & human-readable filesizes.") 632 | (eshell-plain-echo-behavior t "treat 'echo' like shell echo") 633 | (eshell-prompt-function #'my/eshell-prompt) 634 | (eshell-prompt-regexp "^λ ") 635 | (eshell-scroll-to-bottom-on-input 'this) 636 | (eshell-cmpl-cycle-completions nil) 637 | :hook 638 | ;; Make urls clickable 639 | (eshell-mode . goto-address-mode) 640 | (eshell-mode . my/setup-eshell) 641 | :bind 642 | ("C-c M-e" . eshell) 643 | ("C-c C-M-e" . my/eshell-remote) 644 | :config 645 | (defun my/eshell-remote (host) 646 | "Open eshell on a remote host. 647 | 648 | Uses `pcmpl-ssh-config-hosts' to obtain a list of possible hosts." 649 | (interactive 650 | (list 651 | (completing-read "Host: " (pcmpl-ssh-config-hosts)))) 652 | (eshell) 653 | (setq default-directory (concat "/ssh:" host ":")) 654 | (eshell-reset)) 655 | (defun my/setup-eshell () 656 | "Set up eshell how I want. To be called by `eshell-mode-hook'." 657 | (progn 658 | (eshell-cmpl-initialize) 659 | (define-key eshell-mode-map [remap eshell-pcomplete] 'helm-esh-pcomplete) 660 | (unbind-key "M-s" eshell-mode-map) 661 | (bind-key "M-r" #'helm-eshell-history eshell-mode-map))) 662 | (use-package pcomplete-extension 663 | :demand t) 664 | (defun my/eshell-prompt () 665 | "Function that determines the eshell prompt. Must set 666 | `eshell-prompt-function' to this for it to work." 667 | (let ((path (abbreviate-file-name (eshell/pwd)))) 668 | (concat 669 | ;; working directory 670 | (format (propertize "(%s)") 671 | (propertize path 'face '(:inherit eshell-prompt))) 672 | ;; git info 673 | (when (and (fboundp #'magit-get-current-branch) ; magit might not be loaded yet 674 | (magit-get-current-branch)) 675 | (format (propertize "@%s") 676 | (propertize (magit-get-current-branch) 'face '(:foreground "light slate grey")))) 677 | ;; newline, then prompt 678 | (propertize "\nλ" 'face '(:inherit eshell-prompt)) 679 | ;; need to have a space, otherwise the first text I type gets 680 | ;; propertized to match λ: 681 | " ")))) 682 | 683 | (use-package esh-module 684 | :defer t 685 | :config 686 | ;; Don't show the welcome message banner: 687 | (delq 'eshell-banner eshell-modules-list) 688 | ;; use TRAMP sudo method to avoid retyping sudo password on multiple calls: 689 | (push 'eshell-tramp eshell-modules-list)) 690 | 691 | (use-package ess-r-mode 692 | ;; ESS (Emacs Speaks Statistics) is a great project that makes Emacs 693 | ;; speak with R and other statistical languages 694 | :bind 695 | (:map ess-mode-map 696 | ("M-=" . ess-insert-S-assign) 697 | ("M-p" . my/add-pipe) 698 | ("C-|" . my/ess-eval-pipe-through-line) 699 | :map inferior-ess-mode-map 700 | ("M-=" . ess-insert-S-assign)) 701 | :custom 702 | (ess-ask-for-ess-directory nil "Don't ask for dir when starting a process") 703 | (ess-default-style 'RStudio) 704 | (ess-eldoc-show-on-symbol t "Show eldoc on symbol instead of only inside of parens") 705 | (ess-eval-visibly 'nowait "Don't hog Emacs") 706 | (ess-history-directory (concat user-emacs-directory "var/Rhist/") "Save R history in one place rather than making .Rhistory files everywhere.") 707 | (ess-pdf-viewer-pref "emacsclient") 708 | (ess-use-ido nil "I prefer helm.") 709 | (ess-plain-first-buffername nil "Name first R process R:1") 710 | (ess-nuke-trailing-whitespace-p t) 711 | (ess-R-font-lock-keywords 712 | '((ess-R-fl-keyword:modifiers . t) 713 | (ess-R-fl-keyword:fun-defs . t) 714 | (ess-R-fl-keyword:keywords . t) 715 | (ess-R-fl-keyword:assign-ops . t) 716 | (ess-R-fl-keyword:constants . t) 717 | (ess-fl-keyword:fun-calls . nil) 718 | (ess-fl-keyword:numbers . t) 719 | (ess-fl-keyword:operators . t) 720 | (ess-fl-keyword:delimiters . nil) 721 | (ess-fl-keyword:= . t) 722 | (ess-R-fl-keyword:F&T . t))) 723 | (inferior-R-font-lock-keywords 724 | '((ess-S-fl-keyword:prompt . t) 725 | (ess-R-fl-keyword:messages . t) 726 | (ess-R-fl-keyword:modifiers . t) 727 | (ess-R-fl-keyword:fun-defs . t) 728 | (ess-R-fl-keyword:keywords . t) 729 | (ess-R-fl-keyword:assign-ops . t) 730 | (ess-R-fl-keyword:constants . t) 731 | (ess-fl-keyword:matrix-labels . t) 732 | (ess-fl-keyword:fun-calls . nil) 733 | (ess-fl-keyword:numbers . nil) 734 | (ess-fl-keyword:operators . t) 735 | (ess-fl-keyword:delimiters . nil) 736 | (ess-fl-keyword:= . t) 737 | (ess-R-fl-keyword:F&T . t))) 738 | :hook 739 | (ess-r-post-run . my/ess-execute-screen-options) 740 | :config 741 | (setq ess-write-to-dribble nil) 742 | ;; Make that folder if needed. 743 | (mkdir ess-history-directory t) 744 | (defalias 'ess-smart-S-assign #'self-insert-command) 745 | (defun my/add-pipe () 746 | "Add a pipe operator %>% at the end of the current line. 747 | Don't add one if the end of line already has one. Ensure one 748 | space to the left and start a newline with indentation." 749 | (interactive) 750 | (end-of-line) 751 | (unless (looking-back "%>%" nil) 752 | (just-one-space 1) 753 | (insert "%>%")) 754 | (newline-and-indent)) 755 | (defun my/ess-execute-screen-options () 756 | "Call `ess-execute-screen-options' invisibly." 757 | (ess-execute-screen-options t)) 758 | ;; I sometimes want to evaluate just part of a piped sequence. The 759 | ;; following lets me do so without needing to insert blank lines or 760 | ;; something: 761 | (defun my/ess-beginning-of-pipe-or-end-of-line () 762 | "Find point position of end of line or beginning of pipe %>%." 763 | (if (search-forward "%>%" (line-end-position) t) 764 | (let ((pos (progn 765 | (beginning-of-line) 766 | (search-forward "%>%" (line-end-position)) 767 | (backward-char 3) 768 | (point)))) 769 | (goto-char pos)) 770 | (end-of-line))) 771 | 772 | (defun my/ess-eval-pipe-through-line (vis) 773 | "Like `ess-eval-paragraph' but only evaluates up to the pipe on this line. 774 | 775 | If no pipe, evaluate paragraph through the end of current line. 776 | 777 | Prefix arg VIS toggles visibility of ess-code as for `ess-eval-region'." 778 | (interactive "P") 779 | (save-excursion 780 | (let ((end (progn 781 | (my/ess-beginning-of-pipe-or-end-of-line) 782 | (point))) 783 | (beg (progn (backward-paragraph) 784 | (ess-skip-blanks-forward 'multiline) 785 | (point)))) 786 | (ess-eval-region beg end vis))))) 787 | 788 | (use-package exec-path-from-shell 789 | ;; This ensures Emacs has the same PATH as the rest of my system. It is 790 | ;; necessary for macs (not that I ever use that), or if Emacs is started 791 | ;; via a systemd service, as systemd user services don't inherit the 792 | ;; environment of that user 793 | :if (or (eq system-type 'darwin) 794 | (and (daemonp) 795 | (eq system-type 'gnu/linux))) 796 | :config 797 | (exec-path-from-shell-initialize)) 798 | 799 | (use-package executable 800 | :hook 801 | ;; Emacs can set file permissions automatically. Make scripts executable 802 | ;; so I don't have to remember to do so: 803 | (after-save . executable-make-buffer-file-executable-if-script-p)) 804 | 805 | (use-package eww 806 | :commands (eww eww-search-words) 807 | :bind 808 | ;; If a webpage requires more than eww can handle, I can switch to the 809 | ;; system default by tapping &, but 0 is easier to type: 810 | (:map eww-mode-map 811 | ("0" . eww-browse-with-external-browser))) 812 | 813 | (use-package exwm 814 | ;; EXWM makes Emacs your window manager. It works surprising well. I've 815 | ;; used Gnome and i3 and neither of them seems as intuitive or as stable 816 | ;; as EXWM. 817 | :demand t 818 | :if (getenv "EXWM") 819 | :custom 820 | ;; show all X windows in all workspaces 821 | (exwm-workspace-show-all-buffers t) 822 | (exwm-layout-show-all-buffers t) 823 | (exwm-input-simulation-keys 824 | ;; simulation keys so that e.g. `C-n' goes down in most X applications 825 | '(([?\C-b] . left) 826 | ([?\C-f] . right) 827 | ([?\C-p] . up) 828 | ([?\C-n] . down) 829 | ([?\C-a] . home) 830 | ([?\C-e] . end) 831 | ([?\M-v] . prior) 832 | ([?\C-v] . next) 833 | ([?\C-d] . delete) 834 | ([?\C-k] . (S-end delete)))) 835 | ;; Keybindings that exwm won't pass on to X windows: 836 | (exwm-input-global-keys 837 | `((,(kbd "s-r") . exwm-reset) 838 | (,(kbd "s-t") . exwm-workspace-swap) 839 | ,@(mapcar (lambda (i) 840 | `(,(kbd (format "s-%d" i)) . 841 | (lambda () 842 | (interactive) 843 | (exwm-workspace-switch-create ,i)))) 844 | (number-sequence 0 9)) 845 | (,(kbd "s-d") . my/application-launch) 846 | (,(kbd "") . my/mute) 847 | (,(kbd "") . my/volume-up) 848 | (,(kbd "") . my/volume-down) 849 | (,(kbd "") . my/mute-mic) 850 | (,(kbd "s-l") . my/lock-screen) 851 | (,(kbd "") . my/take-screenshot) 852 | (,(kbd "s-p") . helm-pass))) 853 | :hook 854 | (after-init . my/start-background-programs) 855 | (exwm-floating-exit . exwm-layout-show-mode-line) 856 | (exwm-floating-setup . exwm-layout-hide-mode-line) 857 | (exwm-manage-finish . my/exwm-manage) 858 | (exwm-update-class . my/update-class-name) 859 | (exwm-update-title . my/exwm-rename-buffer-to-title) 860 | :bind 861 | (:prefix-map my/power-menu-map 862 | :prefix "s-C" 863 | ("e" . save-buffers-kill-emacs) 864 | ("l" . my/lock-screen) 865 | ("s" . my/system-suspend) 866 | ("r" . my/system-reboot)) 867 | (:map exwm-mode-map 868 | ;; Use C-q to sent next key to X application literally. 869 | ("C-q" . exwm-input-send-next-key)) 870 | :config 871 | ;; Setting this to 0 makes windowing events much snappier 872 | (setq x-wait-for-event-timeout 0) 873 | ;; Create all 10 workspaces on startup. This increases startup time a 874 | ;; bit, but if I try to switch to a workspace that doesn't exist it 875 | ;; messes up the window configuration. 876 | (setq exwm-workspace-number 10) 877 | ;; Make class name the buffer name 878 | (defun my/update-class-name () 879 | "Update X class name of buffer." 880 | (exwm-workspace-rename-buffer exwm-class-name)) 881 | (defun my/application-launch (&optional command) 882 | (interactive (list (read-shell-command "$ "))) 883 | (start-process-shell-command command nil command)) 884 | (defun my/exwm-manage () 885 | "Setup X applications." 886 | (when (string= "Firefox" exwm-class-name) 887 | (exwm-layout-hide-mode-line))) 888 | (defun my/exwm-rename-buffer-to-title () 889 | "Rename buffer to `exwm-title'" 890 | (when (string= "qutebrowser" exwm-class-name) 891 | (exwm-workspace-rename-buffer exwm-title))) 892 | (defun my/mute () 893 | "Mute" 894 | (interactive) 895 | (start-process "" nil "pactl" "set-sink-mute" "0" "toggle")) 896 | (defun my/volume-up () 897 | "Volume up" 898 | (interactive) 899 | (start-process "" nil "pactl" "set-sink-volume" "0" "+5%")) 900 | (defun my/volume-down () 901 | "Volume down" 902 | (interactive) 903 | (start-process "" nil "pactl" "set-sink-volume" "0" "-5%")) 904 | (defun my/mute-mic () 905 | "Toggle mic mute status" 906 | (interactive) 907 | (start-process "" nil "pactl" "set-source-mute" "1" "toggle")) 908 | (defun my/lock-screen () 909 | "Lock screen" 910 | (interactive) 911 | (shell-command "i3lock -c 000000")) 912 | (defun my/system-suspend () 913 | "Suspend system." 914 | (interactive) 915 | (when (y-or-n-p "Suspend system? ") 916 | (shell-command "systemctl suspend"))) 917 | (defun my/system-reboot () 918 | "Reboot system." 919 | (interactive) 920 | (when (y-or-n-p "Reboot system? ") 921 | (shell-command "systemctl reboot"))) 922 | (defun my/take-screenshot (&optional arg) 923 | "Take a screenshot. 924 | With ARG, take an area-selection screenshot." 925 | (interactive "P") 926 | (mkdir "~/Pictures/screenshots/" t) 927 | (start-process-shell-command 928 | "scrot" nil 929 | (concat "scrot " (when arg "-s ") 930 | "-z " ; no beeping 931 | "~/Pictures/screenshots/screenshot_%Y%m%d_%H%M%S.png"))) 932 | ;; Start some daemons: 933 | (defun my/start-background-programs () 934 | "Start some processes. Hooks into `after-init-hook'." 935 | (make-process 936 | :name "NM-applet" :buffer nil 937 | :command '("nm-applet") ; Networkmanager 938 | :noquery t) 939 | (make-process 940 | :name "Power Manager" :buffer nil 941 | :command '("xfce4-power-manager"); power info & screen brightness 942 | :noquery t) 943 | (make-process 944 | :name "Syncthing" :buffer nil 945 | :command '("syncthing-gtk" "--minimized") ; syncthing 946 | :noquery t) 947 | (make-process 948 | :name "Redshift" :buffer nil 949 | ;; redshift in evenings to reduce eye strain 950 | :command '("systemctl" "--user" "start" "redshift.service")) 951 | (when (string= (system-name) "earth") 952 | (setenv "allow_rgb10_configs" "false")) 953 | (make-process 954 | :name "Compton" :buffer nil 955 | :command '("compton" "--no-fading-openclose") 956 | :noquery t)) 957 | ;; Enable EXWM 958 | (exwm-enable)) 959 | 960 | (use-package exwm-randr 961 | ;; Xrandr (multi-screen) 962 | :after exwm 963 | ;; Only load if I'm on my laptop: 964 | :if (string= (system-name) "mars") 965 | :demand t 966 | :custom 967 | (exwm-randr-workspace-output-plist '(0 "eDP-1" 968 | 1 "DP-2" 969 | 2 "HDMI-1")) 970 | :hook 971 | (exwm-randr-screen-change . my/exwm-manage-screens) 972 | :config 973 | (defun my/exwm-manage-screens () 974 | "Manage screen placement. 975 | To be added to `exwm-randr-screen-change-hook'." 976 | (start-process-shell-command 977 | "xrandr" nil "xrandr --output DP-2 --right-of eDP-1 --auto --output HDMI-1 --left-of eDP-1 --auto")) 978 | (exwm-randr-enable)) 979 | 980 | (use-package faces 981 | ;; faces are how Emacs determines how to display characters (font, size, 982 | ;; color, etc) 983 | :defer t 984 | :bind 985 | ("C-h c" . describe-face) ; overrides describe-key-briefly from help.el 986 | :custom-face 987 | (fixed-pitch-serif ((t (:font "Symbola")))) 988 | :config 989 | (add-to-list 'default-frame-alist 990 | '(font . "monospace-12"))) 991 | 992 | (use-package face-remap 993 | :bind 994 | ;; Everywhere else you can zoom with C-- and C-+. Let's make Emacs 995 | ;; follow that convention: 996 | ("C-=" . text-scale-increase) 997 | ("C-+" . text-scale-increase) 998 | ("C--" . text-scale-decrease)) 999 | 1000 | (progn ; `files.el' 1001 | ;; Don't ask me when I try to create a new file. Just create it. 1002 | (setq confirm-nonexistent-file-or-buffer nil) 1003 | ;; make final newlines if they don't exist: 1004 | (setq require-final-newline t) 1005 | 1006 | ;; C-x C-c is originally bound to kill emacs. I accidentally type this 1007 | ;; from time to time which is super-frustrating. Get rid of it: 1008 | (unbind-key "C-x C-c") 1009 | 1010 | ;; C-x C-s saves the current buffer and C-x s saves all modified buffers 1011 | ;; (visiting files), but asks about each one. Let's create a binding to 1012 | ;; save all file visiting buffers without asking: 1013 | (defun my/save-everything-noconfirm () 1014 | "Call `save-some-buffers' but don't confirm saving." 1015 | (interactive) 1016 | (save-some-buffers t)) 1017 | (bind-key "s-s" #'my/save-everything-noconfirm) 1018 | 1019 | 1020 | ;; This lets me make directories on the fly similar to mkdir -p. Thanks 1021 | ;; --- http://mbork.pl/2016-07-25_Making_directories_on_the_fly 1022 | (defun make-parent-directory () 1023 | "Make sure the directory of `buffer-file-name' exists." 1024 | (make-directory (file-name-directory buffer-file-name) t)) 1025 | (add-hook 'find-file-not-found-functions #'make-parent-directory) 1026 | ;; It's nice to have a function to find this file quickly. Here's one: 1027 | (defun my/find-emacs-file () 1028 | "Find my emacs org file" 1029 | (interactive) 1030 | (find-file (concat user-emacs-directory "init.el"))) 1031 | (bind-key "e" #'my/find-emacs-file my/map) 1032 | ;; Sometimes stuff gets out of whack, this helps me put it back in whack: 1033 | (defun my/save-and-revert-buffer () 1034 | "Save and then revert this buffer." 1035 | (interactive) 1036 | (progn 1037 | (save-buffer) 1038 | (revert-buffer :noconfirm t))) 1039 | (bind-key "G" #'my/save-and-revert-buffer my/map) 1040 | ;; Prompt me to save changed buffers if I'm closing the last frame (and 1041 | ;; Emacs is running as a daemon): 1042 | (when (daemonp) 1043 | (add-to-list 'delete-frame-functions 1044 | (defun my/save-if-last-frame (frame) 1045 | (when (eq 1 (cl-count-if 1046 | (lambda (f) 1047 | (eq 1048 | (frame-parameter f 'display) 1049 | (frame-parameter frame 'display))) 1050 | (visible-frame-list))) 1051 | (save-some-buffers)))))) 1052 | 1053 | (use-package flymake 1054 | :defer t 1055 | :custom 1056 | (flymake-proc-compilation-prevents-syntax-check nil) 1057 | :hook 1058 | ;; Some modes turn `flymake-mode' on by default, I have to tell these 1059 | ;; specifically to do it: 1060 | ((emacs-lisp-mode python-mode LaTeX-mode). flymake-mode) 1061 | :bind 1062 | (:map flymake-mode-map 1063 | ("M-P" . flymake-goto-prev-error) 1064 | ("M-N" . flymake-goto-next-error)) 1065 | :config 1066 | (remove-hook 'flymake-diagnostic-functions #'flymake-proc-legacy-flymake)) 1067 | 1068 | (use-package flyspell 1069 | ;; on the fly spell checking 1070 | :hook 1071 | (text-mode . turn-on-flyspell) 1072 | (prog-mode . flyspell-prog-mode) 1073 | :config 1074 | (setq flyspell-abbrev-p t) 1075 | (setq flyspell-issue-welcome-flag nil) 1076 | (setq flyspell-use-global-abbrev-table-p t) 1077 | (setq flyspell-use-meta-tab nil)) 1078 | 1079 | (use-package frame 1080 | :defer t 1081 | :config 1082 | ;; Don't blink the cursor. It's annoying. 1083 | (blink-cursor-mode -1) 1084 | ;; don't bind C-x C-z to suspend-frame: 1085 | (unbind-key "C-x C-z") 1086 | ;; In fact, I find suspend-frame so unhelpful let's disable it: 1087 | (put #'suspend-frame 'disabled t)) 1088 | 1089 | (use-package git-timemachine 1090 | ;; And to step through the history of a file: 1091 | :bind 1092 | ("C-x M-g t" . git-timemachine)) 1093 | 1094 | (use-package gitattributes-mode 1095 | :defer t) 1096 | (use-package gitconfig-mode 1097 | :defer t) 1098 | (use-package gitignore-mode 1099 | :defer t) 1100 | 1101 | ;;; Helm 1102 | (use-package helm 1103 | ;; A package in a league of its own: https://tuhdo.github.io/helm-intro.html 1104 | ;; load it soon after starting Emacs: 1105 | :defer 1 1106 | :bind 1107 | (("M-x" . helm-M-x) 1108 | ("C-x C-f" . helm-find-files) 1109 | ("M-y" . helm-show-kill-ring) 1110 | ("C-M-z" . helm-resume) 1111 | ([remap occur] . helm-occur) 1112 | ([remap bookmark-jump] . helm-bookmarks) 1113 | ("C-x b" . helm-buffers-list) 1114 | ("C-x C-b" . helm-buffers-list) 1115 | ("M-s M-g" . helm-google-suggest) 1116 | ("M-o" . helm-semantic-or-imenu) 1117 | ("C-h SPC" . helm-all-mark-rings) 1118 | ("M-s g" . helm-grep-do-git-grep) 1119 | ("C-h a" . helm-man-woman) 1120 | :map helm-map 1121 | ("" . helm-execute-persistent-action) 1122 | ("C-i" . helm-execute-persistent-action) 1123 | ("C-z" . helm-select-action)) 1124 | :custom 1125 | (helm-display-header-line nil) 1126 | (helm-echo-input-in-header-line t) 1127 | (helm-net-prefer-curl t) 1128 | (helm-split-window-default-side 'below) 1129 | (helm-split-window-inside-p t) 1130 | (helm-command-prefix-key "M-,") 1131 | :init 1132 | (require 'helm-config) 1133 | :config 1134 | (use-package helm-org 1135 | :bind 1136 | (:map my/map 1137 | ("t" . helm-org-agenda-files-headings))) 1138 | (helm-mode)) 1139 | 1140 | (use-package helm-bibtex 1141 | ;; Helm and references 1142 | :bind 1143 | (:map my/map 1144 | ("r b" . my/find-bib-file)) 1145 | :custom 1146 | (bibtex-completion-bibliography "~/Sync/bibliography/references.bib") 1147 | (bibtex-completion-cite-default-command "autocite") 1148 | (bibtex-completion-library-path "~/Sync/bibliography/bibtex-pdfs") 1149 | (bibtex-completion-notes-extension ".org") 1150 | (bibtex-completion-notes-path "~/Sync/bibliography/notes") 1151 | (bibtex-completion-notes-template-multiple-files "* TODO ${year} - ${title}\n :PROPERTIES:\n :Custom_ID: ${=key=}\n :AUTHOR: ${author}\n :JOURNAL: ${journal}\n :YEAR: ${year}\n :VOLUME: ${volume}\n :PAGES: ${pages}\n :DOI: ${doi}\n :URL: ${url}\n :END:\n") 1152 | (bibtex-completion-cite-commands '("autocite" "textcite" "citep" "citet" "citeauthor" "citeyear" "Citep" "Citet")) 1153 | :config 1154 | (defun my/find-bib-file () 1155 | "Find my main bib file." 1156 | (interactive) 1157 | (find-file bibtex-completion-bibliography))) 1158 | 1159 | (use-package helm-mu 1160 | :defer t 1161 | :after (helm mu4e) 1162 | :bind 1163 | (("M-s m" . helm-mu) 1164 | ("M-s c" . helm-mu-contacts) 1165 | :map mu4e-main-mode-map 1166 | ("s" . helm-mu) 1167 | :map mu4e-headers-mode-map 1168 | ("s" . helm-mu) 1169 | :map mu4e-view-mode-map 1170 | ("s" . helm-mu))) 1171 | 1172 | (use-package helm-pass 1173 | ;; Set up helm to easily find passwords, this relies on having pass set 1174 | ;; up (with password-store package) 1175 | :if (executable-find "pass") 1176 | :bind ("M-s p" . helm-pass)) 1177 | 1178 | (use-package helm-projectile 1179 | :after (helm projectile) 1180 | :config 1181 | (helm-projectile-on)) 1182 | 1183 | (use-package help 1184 | ;; Emacs has an amazing help system built in. C-h v, C-h f, and C-h k are 1185 | ;; bound to describe-variable, describe-function, and describe-key 1186 | ;; respectively. 1187 | :no-require t 1188 | :bind 1189 | (:map help-mode-map 1190 | ;; shortcuts for searching from *Help* buffers 1191 | ("v" . describe-variable) 1192 | ("f" . describe-function) 1193 | ("k" . describe-key)) 1194 | :custom 1195 | ;; This makes emacs switch focus to help windows: 1196 | (help-window-select t)) 1197 | 1198 | (use-package hippie-exp 1199 | :bind 1200 | (("M-SPC" . hippie-expand) 1201 | ([remap dabbrev-expand] . hippie-expand)) 1202 | :custom 1203 | (hippie-expand-try-functions-list 1204 | '(;; try yasnippet: 1205 | yas-hippie-try-expand 1206 | ;; Try to expand word "dynamically", searching the current buffer. 1207 | try-expand-dabbrev 1208 | ;; Try to expand word "dynamically", searching all other buffers. 1209 | try-expand-dabbrev-all-buffers 1210 | ;; Try to complete text as a file name, as many characters as unique. 1211 | try-complete-file-name-partially 1212 | ;; Try to complete text as a file name. 1213 | try-complete-file-name 1214 | ;; Try to expand word "dynamically", searching the kill ring. 1215 | try-expand-dabbrev-from-kill 1216 | ;; Try to complete the current line to an entire line in the buffer. 1217 | try-expand-list 1218 | ;; Try to complete the current line to an entire line in the buffer. 1219 | try-expand-line)) 1220 | (hippie-expand-verbose nil)) 1221 | 1222 | (use-package holidays 1223 | :defer t 1224 | :init 1225 | ;; Emacs knows about holidays, but there are lots that don't affect me. 1226 | ;; Let's hide them 1227 | (setq holiday-bahai-holidays nil 1228 | holiday-hebrew-holidays nil 1229 | holiday-islamic-holidays nil 1230 | holiday-oriental-holidays nil 1231 | holiday-christian-holidays nil)) 1232 | 1233 | (use-package hydra 1234 | ;; Hydra is a nice package that lets you set up menus for related (or not) 1235 | ;; commands. 1236 | :bind 1237 | ("C-v" . my/scrolling-up/body) 1238 | ("M-v" . my/scrolling-down/body) 1239 | :config 1240 | ;; the defaults C-v and M-v scroll a full page, which is too much. 1241 | ;; rebind to a half page: 1242 | (defun my/scroll-down () 1243 | "Scroll a half page up." 1244 | (interactive) 1245 | (let ((count (/ (1- (window-height)) 2))) 1246 | (progn 1247 | (scroll-down count)))) 1248 | (defun my/scroll-up () 1249 | "Scroll a half page up." 1250 | (interactive) 1251 | (let ((count (/ (1- (window-height)) 2))) 1252 | (progn 1253 | (scroll-up count)))) 1254 | (defhydra my/scrolling-down (:body-pre my/scroll-down) 1255 | "Scroll without needing to hold C" 1256 | ("v" my/scroll-up "up") 1257 | ("C-v" my/scroll-up "up") 1258 | ("M-v" my/scroll-down "down")) 1259 | (defhydra my/scrolling-up (:body-pre my/scroll-up) 1260 | "Scroll without needing to hold C" 1261 | ("v" my/scroll-up "up") 1262 | ("C-v" my/scroll-up "up") 1263 | ("M-v" my/scroll-down "down"))) 1264 | 1265 | (progn ; `isearch' 1266 | ;; isearch is the package that provides Emacs's forward and reverse 1267 | ;; searching. These are bound to =C-s= and =C-r= by default. If you've 1268 | ;; already started a search with =C-s=, then backspace sometimes doesn't 1269 | ;; delete characters; it goes back to the previous match. I prefer 1270 | ;; backspace to always delete characters; I can just =C-r= to get to the 1271 | ;; previous match. 1272 | (bind-key "" #'isearch-del-char isearch-mode-map) 1273 | ;; Use regex searches by default: 1274 | (setq search-default-mode t)) 1275 | 1276 | (use-package ledger-mode 1277 | ;; ledger is a program that I use to keep track of finances. Emacs, of course, 1278 | ;; can handle it quite nicely. 1279 | :if (executable-find "ledger") 1280 | :hook 1281 | (ledger-mode . ledger-flymake-enable) 1282 | :bind 1283 | (:map ledger-mode-map 1284 | ("C-c r" . ledger-reconcile) 1285 | ("C-c u" . my/ledger-navigate-next-uncleared) 1286 | ("C-c U" . my/ledger-navigate-previous-uncleared) 1287 | :map my/map 1288 | ("l" . my/ledger-file) 1289 | :map ledger-report-mode-map 1290 | ("n" . next-line) 1291 | ("p" . previous-line)) 1292 | :custom 1293 | (ledger-default-date-format "%Y-%m-%d" "ISO dates.") 1294 | (ledger-flymake-be-explicit t "Warn about account typos.") 1295 | (ledger-flymake-be-pedantic t "Warn about account typos.") 1296 | (ledger-post-amount-alignment-at :decimal "Align at decimal place.") 1297 | (ledger-post-amount-alignment-column 70 "Align at column 70") 1298 | (ledger-report-resize-window nil "Don't resize windows.") 1299 | (ledger-report-use-header-line t "Write info in the `header-line', leaving buffer for reports.") 1300 | (ledger-mode-should-check-version nil "Assume ledger is up-to-date.") 1301 | (ledger-reports 1302 | '(("on-hand" "%(binary) -f %(ledger-file) bal assets liabilities -X $ --current") 1303 | ("account" "%(binary) -f %(ledger-file) reg %(account)") 1304 | ("expenses (monthly)" "%(binary) -f %(ledger-file) reg expenses -X $ -M ") 1305 | ("expenses (yearly)" "%(binary) -f %(ledger-file) reg expenses -X $ -Y ") 1306 | ("cash-flow-monthly" "%(binary) -f %(ledger-file) -X $ --invert -b \"this month\" bal income expenses") 1307 | ("cash-flow-YTD" "%(binary) -f %(ledger-file) -X $ --invert -b \"this year\" bal income expenses") 1308 | ("budget (this month)" "%(binary) -f %(ledger-file) budget ^exp -X $ -b \"this month\" --flat") 1309 | ("budget (YTD)" "%(binary) -f %(ledger-file) budget ^exp -X $ -b \"this year\" --flat"))) 1310 | :init 1311 | (defvar my/ledger-file 1312 | (expand-file-name "~/Sync/Finances/finances.ledger") 1313 | "Where the ledger journal is kept.") 1314 | (defun my/ledger-file () 1315 | "Find ledger journal file." 1316 | (interactive) 1317 | (find-file my/ledger-file)) 1318 | :config 1319 | (defun my/ledger-report--header-function () 1320 | "Use in place of `ledger-report--header-function'." 1321 | ;; TODO: Remove the file name from ledger-report-cmd before reporting 1322 | (format "Ledger Report: %s" 1323 | (propertize ledger-report-cmd 'face 'font-lock-comment-face))) 1324 | (setq ledger-report-header-line-fn #'my/ledger-report--header-function) 1325 | (setq ledger-account-name-or-directive-regex ledger-account-directive-regex) 1326 | (defun my/ledger-navigate-next-uncleared () 1327 | "Move point to the next uncleared transaction." 1328 | (interactive) 1329 | (when (looking-at ledger-payee-uncleared-regex) 1330 | (forward-line)) 1331 | (re-search-forward ledger-payee-uncleared-regex nil t) 1332 | (beginning-of-line) 1333 | (point)) 1334 | (defun my/ledger-navigate-previous-uncleared () 1335 | "Move point to the previous uncleared transaction." 1336 | (interactive) 1337 | (when (equal (car (ledger-context-at-point)) 'acct-transaction) 1338 | (ledger-navigate-beginning-of-xact)) 1339 | (re-search-backward ledger-payee-uncleared-regex nil t) 1340 | (beginning-of-line) 1341 | (point))) 1342 | 1343 | (use-package magit 1344 | ;; magit is magical git 1345 | :bind 1346 | (("C-x g" . magit-status) 1347 | ("C-x M-g b" . magit-blame) 1348 | :map dired-mode-map 1349 | ("h" . magit-dired-log)) 1350 | :custom 1351 | (magit-log-section-commit-count 0 "Don't show recent commits in magit-status.") 1352 | (magit-diff-refine-hunk 'all "Get highlighted word diffs.") 1353 | (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1) 1354 | :config 1355 | (global-magit-file-mode -1) 1356 | (magit-add-section-hook 'magit-status-sections-hook 1357 | 'magit-insert-modules 1358 | 'magit-insert-stashes 1359 | 'append)) 1360 | 1361 | (use-package markdown-mode 1362 | ;; Markdown mode for Markdown editing! 1363 | :commands (markdown-mode gfm-mode) 1364 | :mode (("README\\.md\\'" . gfm-mode) 1365 | ("\\.md\\'" . markdown-mode) 1366 | ("\\.Rmd\\'" . markdown-mode) 1367 | ("\\.markdown\\'" . markdown-mode)) 1368 | :bind 1369 | (:map markdown-mode-map 1370 | ("M-p" . markdown-previous-visible-heading) 1371 | ("M-n" . markdown-next-visible-heading)) 1372 | :custom 1373 | (markdown-enable-math t)) 1374 | 1375 | (use-package minibuffer 1376 | :defer t 1377 | :custom 1378 | (read-file-name-completion-ignore-case t "Ignore file case when trying to find stuff:")) 1379 | 1380 | (use-package minions 1381 | ;; Set up how minor modes are displayed in the mode-line 1382 | :custom 1383 | (minions-direct '(flymake-mode) "I always want flymake-mode visible because it shows counts of errors/warnings.") 1384 | (minions-mode-line-lighter "…" "Don't wink at me.") 1385 | :hook 1386 | (after-init . minions-mode)) 1387 | 1388 | (use-package mixed-pitch 1389 | ;; Emacs was an editor originally designed for code, so it defaults to a 1390 | ;; fixed-width font for most things. It's perfectly capable of handling 1391 | ;; variable-pitch fonts, though. The built-in command 1392 | ;; variable-pitch-mode can do that for any buffer. However, I oftentimes 1393 | ;; work in a buffer that mixes things that I'd prefer to be fixed-width 1394 | ;; (e.g. code) and variable width (text). You can convince Emacs to use 1395 | ;; fixed-width for some faces and variable-width fonts for others, but 1396 | ;; you have to specify what faces should be what. Luckily, 1397 | ;; [[https://ogbe.net/emacsconfig.html][someone]] has already figured 1398 | ;; this out. I took their code, modified it to work more like what I 1399 | ;; want, and packaged it up. 1400 | :bind 1401 | (:map my/map 1402 | ("f" . mixed-pitch-mode)) 1403 | :config 1404 | (set-face-attribute 'variable-pitch nil :family "Linux Libertine" :height 160)) 1405 | 1406 | (use-package moody 1407 | ;; Set up the `mode-line' 1408 | :demand 1409 | :after spacemacs-dark-theme 1410 | :custom 1411 | (moody-mode-line-height (if (string= (system-name) "mars") 22 40)) 1412 | (x-underline-at-descent-line t) 1413 | :config 1414 | (defvar my/exwm-and-winum-modeline 1415 | '(:eval (let ((e (when (bound-and-true-p exwm-workspace-current-index) 1416 | (propertize (number-to-string exwm-workspace-current-index) 1417 | 'face 'font-lock-keyword-face))) 1418 | (w (when winum-mode (winum-get-number-string)))) 1419 | (format (concat " " e "|" w " "))))) 1420 | (put 'my/exwm-and-winum-modeline 'risky-local-variable t) 1421 | (make-variable-buffer-local 'my/exwm-and-winum-modeline) 1422 | (moody-replace-element 'mode-line-front-space 'my/exwm-and-winum-modeline) 1423 | (moody-replace-mode-line-buffer-identification) 1424 | (moody-replace-vc-mode)) 1425 | 1426 | (use-package mouse 1427 | :defer t 1428 | :bind 1429 | ;; We can use shift-mouse for selecting from point: 1430 | ("" . mouse-save-then-kill) 1431 | :custom 1432 | (mouse-yank-at-point t )) 1433 | 1434 | (use-package mu4e 1435 | :if (executable-find "mu") 1436 | :defer 10 1437 | :commands (mu4e) 1438 | :hook 1439 | ;; Wrap lines at `fill-column' when viewing emails: 1440 | (mu4e-compose-mode . autofill-off-visual-on) 1441 | (mu4e-headers-mode . my/setup-mu4e-headers) 1442 | :bind 1443 | (("C-x m" . mu4e-compose-new) 1444 | ("" . my/work-inbox) 1445 | ("" . my/personal-inbox) 1446 | :map mu4e-headers-mode-map 1447 | ("d" . mu4e-headers-mark-for-delete) 1448 | ("q" . mu4e-quit-session) 1449 | ("c" . my/org-mu4e-store-and-capture) 1450 | :map mu4e-view-mode-map 1451 | ("d" . mu4e-view-mark-for-delete) 1452 | ("" . shr-next-link) 1453 | ("" . shr-previous-link) 1454 | ("c" . my/org-mu4e-store-and-capture) 1455 | :map mu4e-main-mode-map 1456 | ("q" . mu4e-quit-session) 1457 | :map my/map 1458 | ("m" . my-mu4e-start)) 1459 | :custom 1460 | (mu4e-maildir "~/.mail") 1461 | (mu4e-context-policy 'pick-first) 1462 | (mu4e-maildir-shortcuts '(("/utexas/INBOX" . ?u) 1463 | ("/gmail/INBOX" . ?g))) 1464 | (mu4e-save-multiple-attachments-without-asking t "Save all attachments in same dir.") 1465 | (mu4e-confirm-quit nil "Don't ask me to quit, just quit.") 1466 | (mail-user-agent 'mu4e-user-agent) 1467 | (mu4e-sent-messages-behavior 'delete "Don't save message to Sent Messages, Gmail/IMAP takes care of this.") 1468 | (mu4e-get-mail-command "mbsync -a") 1469 | (mu4e-update-interval 60 "In seconds.") 1470 | (mu4e-change-filenames-when-moving t "For mbsync") 1471 | (mu4e-user-mail-address-list '("branham@utexas.edu" 1472 | "alex.branham@gmail.com" 1473 | "james.alexander.branham@gu.se")) 1474 | (mu4e-compose-dont-reply-to-self t "Don't reply to self.") 1475 | (mu4e-compose-complete-only-personal t) 1476 | (mu4e-compose-complete-only-after "2015-01-01") 1477 | (mu4e-view-show-addresses t) 1478 | (mu4e-hide-index-messages t) 1479 | (mu4e-view-show-images t) 1480 | (message-kill-buffer-on-exit t) 1481 | (mu4e-use-fancy-chars t) 1482 | (mu4e-headers-auto-update nil) 1483 | (mu4e-headers-skip-duplicates t) 1484 | (mu4e-headers-include-related nil "Don't include related messages, as threads can be quite long.") 1485 | (mu4e-attachment-dir "~/Downloads") 1486 | (mu4e-completing-read-function 'completing-read) 1487 | (mu4e-headers-date-format "%F" "ISO dates.") 1488 | (mu4e-headers-fields '((:human-date . 11) 1489 | (:flags . 6) 1490 | (:mailing-list . 10) 1491 | (:from-or-to . 22) 1492 | (:subject . nil))) 1493 | ;; next two are from: 1494 | ;; http://pragmaticemacs.com/emacs/customise-the-reply-quote-string-in-mu4e/ : 1495 | ;; customize the reply-quote-string 1496 | (message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n") 1497 | ;; choose to use the formatted string 1498 | (message-citation-line-function #'message-insert-formatted-citation-line) 1499 | :config 1500 | (defun my-mu4e-start () 1501 | (interactive) 1502 | (window-configuration-to-register :mu4e-fullscreen) 1503 | (mu4e) 1504 | (delete-other-windows)) 1505 | ;; Restore previous window configuration 1506 | (defun mu4e-quit-session () 1507 | "Restores the previous window configuration and kills the mu4e buffer" 1508 | (interactive) 1509 | (kill-buffer) 1510 | (jump-to-register :mu4e-fullscreen)) 1511 | (defun my/work-inbox () 1512 | "Jump to work email" 1513 | (interactive) 1514 | (window-configuration-to-register :mu4e-fullscreen) 1515 | (mu4e~headers-jump-to-maildir "/utexas/INBOX") 1516 | (delete-other-windows)) 1517 | (defun my/personal-inbox () 1518 | "Jump to personal email" 1519 | (interactive) 1520 | (window-configuration-to-register :mu4e-fullscreen) 1521 | (mu4e~headers-jump-to-maildir "/gmail/INBOX") 1522 | (delete-other-windows)) 1523 | (defun my/setup-mu4e-headers () 1524 | "Set up mu4e headers." 1525 | ;; Don't wrap long lines, let me scroll a single line horizontally 1526 | (visual-line-mode -1) 1527 | (setq-local auto-hscroll-mode 'current-line) 1528 | (toggle-truncate-lines 1)) 1529 | (defun my/org-mu4e-store-and-capture () 1530 | "Similar to `org-mu4e-store-and-capture', but use \"r\" capture template and then mark the email for deletion." 1531 | (interactive) 1532 | (org-mu4e-store-link) 1533 | (org-capture :keys "r") 1534 | (if (eq major-mode 'mu4e-headers-mode) 1535 | (mu4e-headers-mark-for-delete) 1536 | (mu4e-view-mark-for-delete))) 1537 | (setq mu4e-contexts 1538 | `( ,(make-mu4e-context 1539 | :name "utexas" 1540 | :enter-func (lambda () (mu4e-message "Switch to utexas context")) 1541 | ;; leave-func not defined 1542 | :match-func (lambda (msg) 1543 | (when msg 1544 | (string-prefix-p "/utexas" (mu4e-message-field msg :maildir)))) 1545 | :vars '((mu4e-drafts-folder . "/utexas/[Gmail]/.Drafts") 1546 | (mu4e-sent-folder . "/utexas/[Gmail]/.Sent Mail") 1547 | (mu4e-trash-folder . "/utexas/[Gmail]/.Trash") 1548 | (user-mail-address . "branham@utexas.edu") 1549 | (user-full-name . "Alex Branham") 1550 | (smtpmail-smtp-user . "branham@utexas.edu") 1551 | (smtpmail-default-smtp-server . "smtp.gmail.com") 1552 | (smtpmail-smtp-server . "smtp.gmail.com") 1553 | (smtpmail-smtp-service . 587) 1554 | (smtpmail-stream-type . starttls) 1555 | (mu4e-compose-signature-auto-include . t) 1556 | (mu4e-compose-signature . (concat 1557 | "J. Alexander Branham\n" 1558 | "PhD Candidate\n" 1559 | "Department of Government\n" 1560 | "University of Texas at Austin\n" 1561 | "https://www.jabranham.com" 1562 | "\n")))) 1563 | ,(make-mu4e-context 1564 | :name "gu" 1565 | :enter-func (lambda () (mu4e-message "Switch to gu context")) 1566 | ;; leave-func not defined 1567 | :match-func (lambda (msg) 1568 | (when msg 1569 | (string-prefix-p "/gu" (mu4e-message-field msg :maildir)))) 1570 | :vars '((mu4e-drafts-folder . "/gu/Drafts") 1571 | (mu4e-sent-folder . "/gu/Sent") 1572 | (mu4e-refile-folder . "/gu/Archive") 1573 | (mu4e-trash-folder . "/gu/Trash") 1574 | (user-mail-address . "james.alexander.branham@gu.se") 1575 | (user-full-name . "Alex Branham") 1576 | (smtpmail-smtp-user . "james.alexander.branham@gu.se") 1577 | (smtpmail-smtp-server . "localhost"); using davmail to access the Exchange server 1578 | (smtpmail-default-smtp-server . "localhost") 1579 | (smtpmail-stream-type . plain) 1580 | (smtpmail-smtp-service . 1025) 1581 | (mu4e-compose-signature-auto-include . t) 1582 | (mu4e-compose-signature . (concat 1583 | "J. Alexander Branham\n" 1584 | "Research Associate\n" 1585 | "Department of Political Science\n" 1586 | "Göteborgs Universitet\n" 1587 | "https://www.jabranham.com" 1588 | "\n")))) 1589 | ,(make-mu4e-context 1590 | :name "personal" 1591 | :enter-func (lambda () (mu4e-message "Switch to personal context")) 1592 | ;; leave-func not defined 1593 | :match-func (lambda (msg) 1594 | (when msg 1595 | (string-prefix-p "/gmail" (mu4e-message-field msg :maildir)))) 1596 | :vars '((user-mail-address . "alex.branham@gmail.com") 1597 | (user-full-name . "Alex Branham") 1598 | (smtpmail-smtp-user . "alex.branham@gmail.com") 1599 | (smtpmail-default-smtp-server . "smtp.gmail.com") 1600 | (smtpmail-smtp-server . "smtp.gmail.com") 1601 | (smtpmail-smtp-service . 587) 1602 | (smtpmail-stream-type . starttls) 1603 | (mu4e-compose-signature-auto-include . nil) 1604 | (mu4e-drafts-folder . "/gmail/[Gmail]/.Drafts") 1605 | (mu4e-sent-folder . "/gmail/[Gmail]/.Sent Mail") 1606 | (mu4e-trash-folder . "/gmail/[Gmail]/.Trash"))))) 1607 | ;; turn off autofill mode in mu4e compose 1608 | (defun autofill-off-visual-on () 1609 | "Turn off auto-fill-mode and turn on visual-mode" 1610 | (auto-fill-mode -1) 1611 | (visual-line-mode)) 1612 | ;; use aV to open message in browser 1613 | (add-to-list 'mu4e-view-actions 1614 | '("ViewInBrowser" . mu4e-action-view-in-browser) t) 1615 | (use-package gnus-dired 1616 | :hook 1617 | (dired-mode . turn-on-gnus-dired-mode) 1618 | ;; make the `gnus-dired-mail-buffers' function also work on 1619 | ;; message-mode derived modes, such as mu4e-compose-mode 1620 | :config 1621 | (defun gnus-dired-mail-buffers () 1622 | "Return a list of active message buffers." 1623 | (let (buffers) 1624 | (save-current-buffer 1625 | (dolist (buffer (buffer-list t)) 1626 | (set-buffer buffer) 1627 | (when (and (derived-mode-p 'message-mode) 1628 | (null message-sent-message-via)) 1629 | (push (buffer-name buffer) buffers)))) 1630 | (nreverse buffers))) 1631 | (setq gnus-dired-mail-mode 'mu4e-user-agent)) 1632 | ;; configure orgmode support in mu4e 1633 | (use-package org-mu4e 1634 | ;; when mail is sent, automatically convert org body to HTML 1635 | :config 1636 | (setq org-mu4e-convert-to-html t)) 1637 | ;; Here we define a function that cleans up contacts. Stolen from: 1638 | ;; https://martinralbrecht.wordpress.com/2016/05/30/handling-email-with-emacs/ 1639 | (defun malb/canonicalise-contact-name (name) 1640 | (let ((case-fold-search nil)) 1641 | (setq name (or name "")) 1642 | (if (string-match-p "^[^ ]+@[^ ]+\.[^ ]" name) 1643 | "" 1644 | (progn 1645 | ;; drop email address 1646 | (setq name 1647 | (replace-regexp-in-string 1648 | "^\\(.*\\) [^ ]+@[^ ]+\.[^ ]" "\\1" name)) 1649 | ;; strip quotes 1650 | (setq name 1651 | (replace-regexp-in-string "^\"\\(.*\\)\"" "\\1" name)) 1652 | ;; deal with YELL’d last names 1653 | (setq name 1654 | (replace-regexp-in-string 1655 | "^\\(\\<[[:upper:]]+\\>\\) \\(.*\\)" "\\2 \\1" name)) 1656 | ;; Foo, Bar becomes Bar Foo 1657 | (setq name 1658 | (replace-regexp-in-string 1659 | "^\\(.*\\), \\([^ ]+\\).*" "\\2 \\1" name)))))) 1660 | (defun malb/mu4e-contact-rewrite-function (contact) 1661 | (let* ((name (or (plist-get contact :name) "")) 1662 | (case-fold-search nil)) 1663 | (plist-put contact :name (malb/canonicalise-contact-name name)) 1664 | contact)) 1665 | (setq mu4e-contact-rewrite-function #'malb/mu4e-contact-rewrite-function) 1666 | 1667 | ;; function to return first name of email recipients 1668 | ;; used by yasnippet 1669 | ;; inspired by 1670 | ;;http://blog.binchen.org/posts/how-to-use-yasnippets-to-produce-email-templates-in-emacs.html 1671 | (defun bjm/mu4e-get-names-for-yasnippet () 1672 | "Return comma separated string of names for an email" 1673 | (interactive) 1674 | (let ((email-name "") str email-string email-list email-name2 tmpname) 1675 | (save-excursion 1676 | (goto-char (point-min)) 1677 | ;; first line in email could be some hidden line containing NO to 1678 | ;; field 1679 | (setq str (buffer-substring-no-properties (point-min) (point-max)))) 1680 | ;; take name from TO field - match series of names 1681 | (when (string-match "^To: \"?\\(.+\\)" str) 1682 | (setq email-string (match-string 1 str))) 1683 | ;; split to list by comma 1684 | (setq email-list (split-string email-string " *, *")) 1685 | ;; loop over emails 1686 | (dolist (tmpstr email-list) 1687 | ;;get first word of email string 1688 | (setq tmpname (car (split-string tmpstr " "))) 1689 | ;;remove whitespace or "" 1690 | (setq tmpname (replace-regexp-in-string "[ \"]" "" tmpname)) 1691 | ;;join to string 1692 | (setq email-name 1693 | (concat email-name ", " tmpname))) 1694 | ;; remove initial comma 1695 | (setq email-name (replace-regexp-in-string "^, " "" email-name)) 1696 | ;; see if we want to use the name in the FROM field get name in FROM 1697 | ;; field if available, but only if there is only one name in TO field 1698 | (if (< (length email-list) 2) 1699 | (when (string-match "^On.+, \\([^ ,\n]+\\).+wrote:$" str) 1700 | (progn 1701 | (setq email-name2 (match-string 1 str)) 1702 | ;;prefer name in FROM field if TO field has "@" 1703 | (when (string-match "@" email-name) 1704 | (setq email-name email-name2)) 1705 | ))) 1706 | email-name)) 1707 | 1708 | ;; starts mu4e silently when emacs starts 1709 | (mu4e t)) 1710 | 1711 | (use-package mu4e-alert 1712 | :if (executable-find "mu") 1713 | :defer 10 1714 | :after mu4e 1715 | :custom 1716 | (mu4e-alert-email-notification-types '(subjects)) 1717 | (mu4e-alert-set-window-urgency nil) 1718 | (mu4e-alert-interesting-mail-query (concat 1719 | "flag:unread AND maildir:\"/utexas/INBOX\"" 1720 | " OR flag:unread AND maildir:\"/gmail/INBOX\"" 1721 | " OR flag:unread AND maildir:\"/gu/INBOX\"")) 1722 | :config 1723 | (mu4e-alert-enable-mode-line-display) 1724 | (mu4e-alert-enable-notifications)) 1725 | 1726 | (use-package multiple-cursors 1727 | ;; Emacs can support multiple cursors. I don't use this much, but it's 1728 | ;; super handy when I do need it: 1729 | :bind ("C-c m c" . my/mc-hydra/body) 1730 | :commands (mc/edit-lines mc/mark-all-like-this) 1731 | :config 1732 | (defhydra my/mc-hydra (:hint nil) 1733 | " 1734 | ^Up^ ^Down^ ^Other^ 1735 | ---------------------------------------------- 1736 | [_p_] Next [_n_] Next [_l_] Edit lines 1737 | [_P_] Skip [_N_] Skip [_a_] Mark all 1738 | [_M-p_] Unmark [_M-n_] Unmark [_r_] Mark by regexp 1739 | ^ ^ ^ ^ [_q_] Quit 1740 | " 1741 | ("l" mc/edit-lines :exit t) 1742 | ("a" mc/mark-all-like-this :exit t) 1743 | ("n" mc/mark-next-like-this) 1744 | ("N" mc/skip-to-next-like-this) 1745 | ("M-n" mc/unmark-next-like-this) 1746 | ("p" mc/mark-previous-like-this) 1747 | ("P" mc/skip-to-previous-like-this) 1748 | ("M-p" mc/unmark-previous-like-this) 1749 | ("r" mc/mark-all-in-region-regexp :exit t) 1750 | ("q" nil))) 1751 | 1752 | (use-package mwheel 1753 | :defer t 1754 | :custom 1755 | (mouse-wheel-scroll-amount '(1 ((shift) . 1)) "One line at a time.") 1756 | (mouse-wheel-progressive-speed nil "Don't accelerate scrolling.") 1757 | (mouse-wheel-follow-mouse 't "Scroll window under mouse.")) 1758 | 1759 | (use-package ob-core 1760 | ;; ob is org-babel, which lets org know about code and code blocks 1761 | :defer t 1762 | :custom 1763 | ;; I know what I'm getting myself into. 1764 | (org-confirm-babel-evaluate nil "Don't ask to confirm evaluation.")) 1765 | 1766 | (use-package org 1767 | ;; Org mode is a great thing. I use it for writing academic papers, 1768 | ;; managing my schedule, managing my references and notes, writing 1769 | ;; presentations, writing lecture slides, and pretty much anything 1770 | ;; else. 1771 | :bind 1772 | (("C-c l" . org-store-link) 1773 | ("C-'" . org-cycle-agenda-files) ; quickly access agenda files 1774 | :map org-mode-map 1775 | ;; I rebind C-c C-r to look at my reference list globally (see org-ref 1776 | ;; below), which overrides the default binding of org-reveal. However, 1777 | ;; that command is quite useful, so let's bind it to C-c r: 1778 | ("C-c r" . org-reveal) 1779 | ;; Bind M-p and M-n to navigate heading more easily (these are bound to 1780 | ;; C-c C-p/n by default): 1781 | ("M-p" . org-previous-visible-heading) 1782 | ("M-n" . org-next-visible-heading) 1783 | ;; C-c C-t is bound to `org-todo' by default, but I want it 1784 | ;; bound to C-c t as well: 1785 | ("C-c t" . org-todo)) 1786 | :hook 1787 | (org-mode . my/setup-org-mode) 1788 | :custom 1789 | (org-pretty-entities t "UTF8 all the things!") 1790 | (org-support-shift-select t "Holding shift and moving point should select things.") 1791 | (org-fontify-quote-and-verse-blocks t "Provide a special face for quote and verse blocks.") 1792 | (org-M-RET-may-split-line nil "M-RET may never split a line.") 1793 | (org-enforce-todo-dependencies t "Can't finish parent before children.") 1794 | (org-enforce-todo-checkbox-dependencies t "Can't finish parent before children.") 1795 | (org-hide-emphasis-markers t "Make words italic or bold, hide / and *.") 1796 | (org-catch-invisible-edits 'show-and-error "Don't let me edit things I can't see.") 1797 | (org-special-ctrl-a/e t "Make C-a and C-e work more like how I want:.") 1798 | (org-preview-latex-default-process 'imagemagick "Let org's preview mechanism use imagemagick instead of dvipng.") 1799 | (org-imenu-depth 6 "Imenu can go deep into menu structure since I use helm.") 1800 | (org-image-actual-width '(300)) 1801 | (org-blank-before-new-entry '((heading . nil) 1802 | (plain-list-item . nil))) 1803 | ;; For whatever reason, I have to explicitely tell org how to open pdf 1804 | ;; links. I use pdf-tools. If pdf-tools isn't installed, it will use 1805 | ;; doc-view (shipped with Emacs) instead. 1806 | (org-file-apps 1807 | '((auto-mode . emacs) 1808 | ("\\.mm\\'" . default) 1809 | ("\\.x?html?\\'" . default) 1810 | ("\\.pdf\\'" . emacs))) 1811 | (org-highlight-latex-and-related '(latex entities) "set up fontlocking for latex") 1812 | (org-startup-with-inline-images t "Show inline images.") 1813 | (org-log-done 'time) 1814 | (org-goto-interface 'outline-path-completion) 1815 | (org-ellipsis "⬎") 1816 | (org-tag-persistent-alist '(("jobs" . ?j) 1817 | (:startgroup . nil) 1818 | ("@work" . ?w) 1819 | ("@home" . ?h) 1820 | (:endgroup . nil))) 1821 | ;; I keep my recipes in an org file and tag them based on what kind of 1822 | ;; dish they are. The level one headings are names, and each gets two 1823 | ;; level two headings --- ingredients and directions. To easily search via 1824 | ;; tag, I can restrict org-agenda to that buffer using < then hit m to 1825 | ;; match based on a tag. 1826 | (org-tags-exclude-from-inheritance 1827 | '("BREAKFAST" "DINNER" "DESSERT" "SIDE" "CHICKEN" "PORK" "SEAFOOD" 1828 | "BEEF" "PASTA" "SOUP" "SNACK" "DRINK" "LAMB")) 1829 | ;; Org-refile lets me quickly move around headings in org files. It 1830 | ;; plays nicely with org-capture, which I use to turn emails into TODOs 1831 | ;; easily (among other things, of course) 1832 | (org-outline-path-complete-in-steps nil) 1833 | (org-refile-allow-creating-parent-nodes 'confirm) 1834 | (org-refile-use-outline-path 'file) 1835 | (org-refile-targets '((org-default-notes-file . (:maxlevel . 6)) 1836 | (my/org-scheduled . (:level . 1)))) 1837 | :config 1838 | ;; These are the programming languages org should teach itself: 1839 | (org-babel-do-load-languages 1840 | 'org-babel-load-languages 1841 | '((emacs-lisp . t) 1842 | (latex . t) 1843 | (python . t) 1844 | (R . t) 1845 | (shell . t))) 1846 | ;; remove C-c [ from adding org file to front of agenda 1847 | (unbind-key "C-c [" org-mode-map) 1848 | (defun my/setup-org-mode () 1849 | "Setup org-mode." 1850 | ;; An alist of symbols to prettify, see `prettify-symbols-alist'. 1851 | ;; Whether the symbol actually gets prettified is controlled by 1852 | ;; `org-pretty-compose-p', which see. 1853 | (setq-local prettify-symbols-unprettify-at-point nil) 1854 | (setq-local prettify-symbols-alist '(("*" . ?•))) 1855 | (setq-local prettify-symbols-compose-predicate #'my/org-pretty-compose-p)) 1856 | (defun my/org-pretty-compose-p (start end match) 1857 | "Return t if the symbol should be prettified. 1858 | START and END are the start and end points, MATCH is the string 1859 | match. See also `prettify-symbols-compose-predicate'." 1860 | (if (string= match "*") 1861 | ;; prettify asterisks in headings 1862 | (and (org-match-line org-outline-regexp-bol) 1863 | (< end (match-end 0))) 1864 | ;; else rely on the default function 1865 | (funcall #'prettify-symbols-default-compose-p start end match)))) 1866 | 1867 | (use-package org-agenda 1868 | ;; Here's where I set which files are added to org-agenda, which controls 1869 | ;; org's global todo list, scheduling, and agenda features. I use 1870 | ;; Syncthing to keep these files in sync across computers. 1871 | :bind 1872 | (("C-c a" . org-agenda) 1873 | ("" . org-agenda) 1874 | :map org-agenda-mode-map 1875 | ;; overrides org-agenda-redo, which I use "g" for anyway 1876 | ("r" . org-agenda-refile) 1877 | ;; overrides saving all org buffers, also bound to C-x C-s 1878 | ("s" . org-agenda-schedule) 1879 | ;; overrides org-exit 1880 | ("x" . my/org-agenda-mark-done)) 1881 | :custom 1882 | (org-directory "~/org/" "Kept in sync with syncthing.") 1883 | (org-default-notes-file (concat org-directory "todo.org")) 1884 | (org-agenda-skip-deadline-if-done t "Remove done deadlines from agenda.") 1885 | (org-agenda-skip-scheduled-if-done t "Remove done scheduled from agenda.") 1886 | (org-agenda-skip-timestamp-if-done t "Don't show timestamped things in agenda if they're done.") 1887 | (org-agenda-skip-scheduled-if-deadline-is-shown 'not-today "Don't show scheduled if the deadline is visible unless it's also scheduled for today.") 1888 | (org-agenda-skip-deadline-prewarning-if-scheduled 'pre-scheduled "Skip deadline warnings if it is scheduled.") 1889 | (org-deadline-warning-days 3 "warn me 3 days before a deadline") 1890 | (org-agenda-tags-todo-honor-ignore-options t "Ignore scheduled items in tags todo searches.") 1891 | (org-agenda-tags-column 'auto) 1892 | (org-agenda-window-setup 'only-window "Use current window for agenda.") 1893 | (org-agenda-restore-windows-after-quit t "Restore previous config after I'm done.") 1894 | (org-agenda-span 'day) ; just show today. I can "vw" to view the week 1895 | (org-agenda-time-grid 1896 | '((daily today remove-match) (800 1000 1200 1400 1600 1800 2000) 1897 | "" "") "By default, the time grid has a lot of ugly '-----' lines. Remove those.") 1898 | (org-agenda-scheduled-leaders '("" "%2dx ") "I don't need to know that something is scheduled. That's why it's appearing on the agenda in the first place.") 1899 | (org-agenda-block-separator ?— "Use nice unicode character instead of ugly = to separate agendas:") 1900 | (org-agenda-deadline-leaders '("Deadline: " "In %d days: " "OVERDUE %d day: ") "Make deadlines, especially overdue ones, stand out more:") 1901 | (org-agenda-current-time-string "⸻ NOW ⸻") 1902 | ;; The agenda is ugly by default. It doesn't properly align items and it 1903 | ;; includes weird punctuation. Fix it: 1904 | (org-agenda-prefix-format '((agenda . "%-12c%-14t%s") 1905 | (todo . " %i %-12:c") 1906 | (tags . " %i %-12:c") 1907 | (search . " %i %-12:c"))) 1908 | (org-agenda-custom-commands 1909 | '( 1910 | ("h" "Home Agenda" 1911 | ((agenda "" nil) 1912 | (tags "@home" 1913 | ((org-agenda-overriding-header "Tasks to do at home"))) 1914 | (tags "CATEGORY=\"inbox\"+LEVEL=2" 1915 | ((org-agenda-overriding-header "Refile"))))) 1916 | ("w" "Work Agenda" 1917 | ((agenda "" nil) 1918 | (tags "@work" 1919 | ((org-agenda-overriding-header "Tasks to do at work"))) 1920 | (tags "+CATEGORY=\"inbox\"+LEVEL=2" 1921 | ((org-agenda-overriding-header "Refile"))))) 1922 | ("d" "deadlines" 1923 | ((agenda "" 1924 | ((org-agenda-entry-types '(:deadline)) 1925 | (org-agenda-span 'fortnight) 1926 | (org-agenda-time-grid nil) 1927 | (org-deadline-warning-days 0) 1928 | (org-agenda-skip-deadline-prewarning-if-scheduled nil) 1929 | (org-agenda-skip-deadline-if-done nil))))) 1930 | ("b" "bibliography" 1931 | ((tags "CATEGORY=\"bib\"+LEVEL=2" 1932 | ((org-agenda-overriding-header "You've got a lot of reading to do..."))))) 1933 | ("u" "unscheduled" 1934 | ((todo "TODO" 1935 | ((org-agenda-overriding-header "Unscheduled tasks") 1936 | (org-agenda-todo-ignore-with-date t))))))) 1937 | :hook 1938 | (org-agenda-mode . hl-line-mode) 1939 | :init 1940 | (defvar my/org-notes (expand-file-name "notes.org" org-directory) 1941 | "Long-term storage for notes.") 1942 | (defvar my/org-scheduled (expand-file-name "scheduled.org" org-directory) 1943 | "Scheduled tasks.") 1944 | ;; set up org agenda files for the agenda 1945 | (setq org-agenda-files `(,org-default-notes-file 1946 | ,my/org-scheduled)) 1947 | (setq org-agenda-text-search-extra-files `(,my/org-notes)) 1948 | :config 1949 | (defun my/org-agenda-mark-done (&optional _arg) 1950 | "Mark current TODO as DONE. 1951 | See `org-agenda-todo' for more details." 1952 | (interactive "P") 1953 | (org-agenda-todo "DONE"))) 1954 | 1955 | (use-package org-capture 1956 | ;; I use org-capture to create short notes about all kinds of things. I 1957 | ;; can capture emails to remember for later, quick thoughts for later, 1958 | ;; RSS feeds, really anything. 1959 | :bind* 1960 | ("C-c c" . org-capture) 1961 | :bind 1962 | (:map org-capture-mode-map 1963 | ("C-c C-j" . my/org-capture-refile-and-jump)) 1964 | :custom 1965 | ;; And now for the capture templates themselves. It's a bit complicated, 1966 | ;; but the manual does a great job explaining. 1967 | (org-capture-templates 1968 | `(("s" "store" entry (file+headline org-default-notes-file "Inbox") 1969 | "* TODO %?\n %a \n %i") 1970 | ("t" "task" entry (file+headline org-default-notes-file "Inbox") 1971 | "* TODO %? \n %i") 1972 | ("n" "note" entry (file ,my/org-notes) 1973 | "* %?\n %i") 1974 | ("b" "bib" entry (file+headline org-default-notes-file "Bibliography") 1975 | "* TODO %a :@work:\n \n %i") 1976 | ("r" "refile+schedule" entry (file+headline org-default-notes-file "Inbox") 1977 | "* TODO %a %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+1d 9am\") t)" 1978 | :immediate-finish t)))) 1979 | 1980 | (use-package org-eww 1981 | ;; Org-eww lets me capture eww webpages with org-mode 1982 | :after eww) 1983 | 1984 | (use-package org-indent 1985 | ;; org-indent-mode nicely aligns text with the outline level 1986 | :hook 1987 | (org-mode . org-indent-mode)) 1988 | 1989 | (use-package org-ref 1990 | :defer 15 1991 | ;; I use org-ref to manage my references. 1992 | :bind* 1993 | (("C-c C-r" . org-ref-helm-insert-cite-link) 1994 | :map bibtex-mode-map 1995 | ("C-c C-c" . org-ref-clean-bibtex-entry) 1996 | :map my/map 1997 | ("r d" . doi-add-bibtex-entry) 1998 | ("r i" . isbn-to-bibtex)) 1999 | :custom 2000 | (org-ref-completion-library 'org-ref-helm-bibtex) 2001 | (org-ref-notes-function #'org-ref-notes-function-many-files) 2002 | (org-ref-notes-directory "~/Sync/bibliography/notes") 2003 | (org-ref-default-bibliography '("~/Sync/bibliography/references.bib")) 2004 | (org-ref-pdf-directory "~/Sync/bibliography/bibtex-pdfs") 2005 | (org-ref-default-ref-type "autoref") 2006 | (org-ref-default-citation-link "autocite") 2007 | ;; Set this to nil; it slows down org a LOT. Agenda generation takes under a 2008 | ;; second when it is nil and over 7 seconds when t: 2009 | (org-ref-show-broken-links nil) 2010 | :config 2011 | ;; TODO: I can't use use-package's :hook keyword to add these two hooks 2012 | ;; because org-ref-clean-bibtex-entry-hook then gets defined before the 2013 | ;; defcustom, which means the other functions don't get added to it. 2014 | 2015 | ;; Cleanup nil entries from articles. 2016 | (add-hook 'org-ref-clean-bibtex-entry-hook #'orcb-clean-nil-opinionated) 2017 | ;; Fix journal names in bibtex entries 2018 | (add-hook 'org-ref-clean-bibtex-entry-hook #'my/fix-journal-name) 2019 | 2020 | 2021 | (defvar my/notes-template 2022 | "* TODO %y - %t\n :PROPERTIES:\n :Custom_ID: %k\n :AUTHOR: %9a\n :JOURNAL: %j\n :YEAR: %y\n :VOLUME: %v\n :PAGES: %p\n :DOI: %D\n :URL: %U\n :END:\n") 2023 | (setq org-ref-note-title-format my/notes-template) 2024 | ;; Org-ref-bibtex is a package that helps me manage my bib file(s). I add the 2025 | ;; my/fix-journal-name function to always put in the full name of the journal. 2026 | ;; I also add it to the cleaning hook so that it's taken care of for me more 2027 | ;; or less automatically. 2028 | (defun my/add-to-journal-list (element) 2029 | "Add ELEMENT to `org-ref-bibtex-journal-abbreviations'" 2030 | (push element org-ref-bibtex-journal-abbreviations)) 2031 | 2032 | (mapc #'my/add-to-journal-list 2033 | '(("AJPS" "American Journal of Political Science" "Am Jour Polit Sci") 2034 | ("AJPS" "American Journal of Political Science" "Am J Political Science") 2035 | ("APR" "American Politics Research" "Amer. Pol. Res.") 2036 | ("APSR" "American Political Science Review" "Am Polit Sci Rev") 2037 | ("APSR" "American Political Science Review" "The American Political Science Review") 2038 | ("ARPS" "Annual Review of Political Science" "Ann. Rev. Poli. Sci.") 2039 | ("BJPS" "British Journal of Political Science" "Brit J of Pol Sci") 2040 | ("CP" "Comparative Politics" "Comp. Pol.") 2041 | ("CPS" "Comparative Political Studies" "Comp. Pol. Stud.") 2042 | ("EPSR" "European Political Science Review" "Eur. Pol. Sci. Rev.") 2043 | ("EJPR" "European Journal of Political Research" "Eur. Jour. Pol. Res.") 2044 | ("ES" "Electoral Studies" "Elec. Stud.") 2045 | ("EUP" "European Union Politics" "Eur. Unio. Pol.") 2046 | ("IJPOR" "International Journal of Public Opinion Research" "Intl J Pub Opin Res") 2047 | ("IO" "International Organization" "Intl Org") 2048 | ("JEPOP" "Journal of Elections, Public Opinion, and Policy" "Jour Elec PO and Pol") 2049 | ("JEPP" "Journal of European Public Policy" "Jour. Eur. Pub. Pol.") 2050 | ("JEPS" "Journal of Experimental Political Science" "J Exp Poli Sci") 2051 | ("JOD" "Journal of Democracy" "J of Dem") 2052 | ("JOP" "Journal of Politics" "The Journal of Politics") 2053 | ("JOP" "Journal of Politics" "J of Pol") 2054 | ("jop" "Journal of Politics" "J of Pol") 2055 | ("JoC" "Journal of Communication" "J Communication") 2056 | ("LSQ" "Legislative Studies Quarterly" "Leg. Stud. Quar.") 2057 | ("PA" "Political Analysis" "Pol. Analy.") 2058 | ("PB" "Political Behavior" "Pol Behavior") 2059 | ("PC" "Political Communication" "Pol Comm") 2060 | ("PoP" "Perspectives on Politics" "Perspect. polit.") 2061 | ("POQ" "Public Opinion Quarterly" "Pub. Opin. Quar.") 2062 | ("PP" "Party Politics" "Par Pol") 2063 | ("PRQ" "Political Research Quarterly" "Pol. Res. Quar.") 2064 | ("PSJ" "Policy Studies Journal" "Pol Stu Jour") 2065 | ("PSQ" "Presidential Studies Quarterly" "Pres Stud Quar") 2066 | ("PSRM" "Political Science Research and Methods" "Pol. Sci. Res. Meth.") 2067 | ("QJPS" "Quarterly Journal of Political Science" "Quar. Joun. Poli. Sci.") 2068 | ("R\&P" "Research \\& Politics" "Res. and Pol.") 2069 | ("SPPQ" "State Politics \\& Policy Quarterly" "Stat. Pol. Pol. Quar.") 2070 | ("SS" "Statistical Science" "Stat. Sci.") 2071 | ("WEP" "West European Politics" "West Eur. Pol.") 2072 | ("WP" "World Politics" "Wor Pol"))) 2073 | 2074 | (defun my/fix-journal-name (&optional _key _start _end) 2075 | "Replace journal name in a bibtex entry with the full name. 2076 | The strings are defined in 2077 | `org-ref-bibtex-journal-abbreviations'. The optional arguments 2078 | KEY, START and END allow you to use this with 2079 | `bibtex-map-entries'" 2080 | (interactive) 2081 | (bibtex-beginning-of-entry) 2082 | (when 2083 | (string= "article" 2084 | (downcase 2085 | (cdr (assoc "=type=" (bibtex-parse-entry))))) 2086 | (let* ((initial-names (mapcar 2087 | (lambda (row) 2088 | (cons (nth 0 row) (nth 1 row))) 2089 | org-ref-bibtex-journal-abbreviations)) 2090 | (abbrev-names (mapcar 2091 | (lambda (row) 2092 | (cons (nth 2 row) (nth 1 row))) 2093 | org-ref-bibtex-journal-abbreviations)) 2094 | (journal (s-trim (bibtex-autokey-get-field "journal"))) 2095 | (bstring (or 2096 | (cdr (assoc journal initial-names)) 2097 | (cdr (assoc journal abbrev-names))))) 2098 | (when bstring 2099 | (bibtex-set-field "journal" bstring) 2100 | (bibtex-fill-entry))))) 2101 | (use-package doi-utils 2102 | :config 2103 | (setq doi-utils-open-pdf-after-download t)) 2104 | (use-package org-ref-isbn 2105 | :custom 2106 | (org-ref-isbn-exclude-fields '("form" "lang" "lccn" "oclcnum"))) 2107 | (use-package org-ref-latex)) 2108 | 2109 | (use-package org-src 2110 | ;; org source code examples 2111 | :defer t 2112 | :custom 2113 | (org-src-tab-acts-natively t "This will make the tab key act like you want it to inside code blocks.") 2114 | (org-src-window-setup 'current-window "Set up src windows in their current window rather than another one.")) 2115 | 2116 | (use-package outline 2117 | :defer t 2118 | :bind 2119 | (:map outline-mode-map 2120 | ("M-p" . outline-previous-visible-heading) 2121 | ("M-n" . outline-next-visible-heading))) 2122 | 2123 | (use-package ox 2124 | ;; ox is org's export engine 2125 | :defer t 2126 | :custom 2127 | (org-export-with-smart-quotes t) 2128 | (org-export-with-toc nil "Don't include a table of contents when exporting.") 2129 | ;; This lets me override all the export variables with a =#+BIND:= statement 2130 | ;; at the beginning of org-mode files for export: 2131 | (org-export-allow-bind-keywords t)) 2132 | 2133 | (use-package ox-html 2134 | :defer t 2135 | :config 2136 | (setq org-html-validation-link nil)) 2137 | 2138 | (use-package ox-latex 2139 | ;; org's latex/pdf exporting engine 2140 | :defer t 2141 | :custom 2142 | (org-latex-pdf-process '("latexmk -xelatex %f")) 2143 | :config 2144 | ;; add support for coloring code output. Use minted if pygments is 2145 | ;; installed, otherwise fall back to the listings package, which doesn't 2146 | ;; require anything other than latex. 2147 | (if (executable-find "pygments") 2148 | ;; use minted 2149 | (progn 2150 | (setq org-latex-listings 'minted) 2151 | (add-to-list 'org-latex-packages-alist '("newfloat" "minted")) 2152 | ;; also need to figure out how to add -shell-escape option to `org-latex-pdf-process' 2153 | ) 2154 | ;; else use listings 2155 | (progn 2156 | (setq org-latex-listings t) 2157 | (add-to-list 'org-latex-packages-alist '("" "listings")) 2158 | (add-to-list 'org-latex-packages-alist '("" "color")))) 2159 | 2160 | ;; Add support for writing letters: 2161 | (add-to-list 'org-latex-classes 2162 | '("letter" 2163 | "\\documentclass[11pt]{letter} 2164 | \\signature{J. Alexander Branham} 2165 | \\address{}" 2166 | ("\\section{%s}" . "\\section*{%s}") 2167 | ("\\subsection{%s}" . "\\subsection*{%s}") 2168 | ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))) 2169 | 2170 | (progn ; `paragraphs.el' 2171 | ;; I end sentences with a single space. 2172 | (setq sentence-end-double-space nil)) 2173 | 2174 | (use-package paren 2175 | :custom 2176 | (show-paren-when-point-inside-paren t) 2177 | (show-paren-delay 0) 2178 | (show-paren-mode t)) 2179 | 2180 | (use-package password-cache 2181 | :defer 2182 | :custom 2183 | (password-cache-expiry 60 "Cache passwords for a minute.")) 2184 | 2185 | (use-package password-store 2186 | ;; I use pass to manage all my passwords and login info --- 2187 | ;; https://www.passwordstore.org/ 2188 | :if (executable-find "pass") 2189 | :mode ("\\.password-store/.*\\.gpg\\'" . text-mode) 2190 | :custom 2191 | (password-store-password-length 20 "Set longer default password length.")) 2192 | 2193 | (use-package pdf-tools 2194 | ;; I like emacs, so why not view PDFs in it? The built-in docview mode 2195 | ;; can do so, but pdf-tools is better in all sorts of ways. 2196 | 2197 | ;; NOTE: ~pdf-tools~ only officially supports gnu/linux operating 2198 | ;; systems. I think that it will work on macs as well, but you may have 2199 | ;; to finagle it a bit. Regardless, I tell emacs to only use it if the OS 2200 | ;; is linux based. 2201 | :if (eq system-type 'gnu/linux) 2202 | :magic ("%PDF" . pdf-view-mode) 2203 | :defer 7 2204 | :custom 2205 | (pdf-sync-forward-display-pdf-key "" "Use C-RET in latex mode to jump to location in pdf file") 2206 | (pdf-view-display-size 'fit-page "Show full pages by default instead of fitting page width.") 2207 | (TeX-view-program-selection '((output-pdf "pdf-tools")) "Use pdf-tools to display pdfs from latex runs.") 2208 | (TeX-view-program-list '(("pdf-tools" ("TeX-pdf-tools-sync-view") nil))) 2209 | :config 2210 | ;; The t says to install the server without asking me --- this may take a 2211 | ;; second 2212 | (pdf-tools-install t)) 2213 | 2214 | (use-package prog-mode 2215 | ;; Prettify-symbols-mode will replace some symbols (like "lambda") with 2216 | ;; their prettier cousins (like λ), but smartly as it's configured by 2217 | ;; major modes themselves. 2218 | :defer t 2219 | :custom 2220 | (prettify-symbols-unprettify-at-point 'right-edge) 2221 | :config 2222 | (global-prettify-symbols-mode)) 2223 | 2224 | (use-package projectile 2225 | ;; Projectile makes using projects easier in emacs. It also plays well 2226 | ;; with helm, so let's set that up. 2227 | :defer 1 2228 | :config 2229 | (setq projectile-completion-system 'helm) 2230 | (setq projectile-require-project-root nil) 2231 | (projectile-mode) 2232 | (projectile-cleanup-known-projects)) 2233 | 2234 | (use-package python 2235 | ;; The package is called python, the mode is python-mode. Confusingly, there's 2236 | ;; also python-mode.el but I don't use that. 2237 | :defer t 2238 | :bind 2239 | (:map python-mode-map 2240 | ("C-" . python-shell-send-region-or-statement-and-step)) 2241 | :custom 2242 | ;; Use flake8 for flymake: 2243 | (python-flymake-command '("flake8" "-")) 2244 | (python-indent-guess-indent-offset-verbose nil) 2245 | (python-indent-offset 4) 2246 | :config 2247 | (defun python-shell-send-region-or-statement () 2248 | "Send the current region to the inferior python process if there is an active one, otherwise the current line." 2249 | (interactive) 2250 | (if (use-region-p) 2251 | (python-shell-send-region (region-beginning) (region-end)) 2252 | (python-shell-send-statement))) 2253 | (defun python-shell-send-statement () 2254 | "Send the current line to the inferior python process for evaluation." 2255 | (interactive) 2256 | (save-excursion 2257 | (let ((end (python-nav-end-of-statement)) 2258 | (beginning (python-nav-beginning-of-statement))) 2259 | (python-shell-send-region beginning end)))) 2260 | (defun python-shell-send-region-or-statement-and-step () 2261 | "Call `python-shell-send-region-or-statement' and then `python-nav-forward-statement'." 2262 | (interactive) 2263 | (python-shell-send-region-or-statement) 2264 | (python-nav-forward-statement)) 2265 | (define-minor-mode python-use-ipython-mode 2266 | ;; I don't really get the allure of ipython, but here's something that 2267 | ;; lets me switch back and forth: 2268 | "Make python mode use the ipython interpreter." 2269 | :lighter (" iPy") 2270 | (unless (executable-find "ipython") 2271 | (error "Could not find ipython executable")) 2272 | (if python-use-ipython-mode 2273 | ;; activate ipython stuff 2274 | (setq python-shell-buffer-name "Ipython" 2275 | python-shell-interpreter "ipython" 2276 | ;; https://emacs.stackexchange.com/q/24453/115 2277 | ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25306 2278 | python-shell-interpreter-args "--simple-prompt -i") 2279 | ;; else, deactivate everything 2280 | (setq python-shell-buffer-name "Python" 2281 | python-shell-interpreter "python" 2282 | python-shell-interpreter-args "-i")))) 2283 | 2284 | (use-package reftex 2285 | ;; I use helm-bibtex to manage my references, but ReFTeX is still great 2286 | ;; to have around for cross-references in latex files. 2287 | :hook 2288 | (LaTeX-mode . turn-on-reftex) 2289 | :custom 2290 | (reftex-cite-format 2291 | '((?\C-m . "\\cite[]{%l}") 2292 | (?t . "\\citet{%l}") 2293 | (?p . "\\citep[]{%l}") 2294 | (?a . "\\autocite{%l}") 2295 | (?A . "\\textcite{%l}") 2296 | (?P . "[@%l]") 2297 | (?T . "@%l [p. ]") 2298 | (?x . "[]{%l}") 2299 | (?X . "{%l}"))) 2300 | (reftex-default-bibliography '("~/Sync/bibliography/references.bib")) 2301 | (reftex-extra-bindings t)) 2302 | 2303 | (use-package saveplace 2304 | ;; Yes, please save my place when opening/closing files: 2305 | :config 2306 | (save-place-mode)) 2307 | 2308 | (use-package sendmail 2309 | :defer t 2310 | :custom 2311 | (send-mail-function #'smtpmail-send-it)) 2312 | 2313 | (use-package server 2314 | :if window-system 2315 | :config 2316 | ;; Start the server if not already running: 2317 | (unless (server-running-p) 2318 | (add-hook 'after-init-hook #'server-start t))) 2319 | 2320 | (use-package sh-script 2321 | :defer t 2322 | :mode 2323 | ("/PKGBUILD$" . sh-mode)) 2324 | 2325 | (use-package shell 2326 | :hook 2327 | ;; Make urls clickable 2328 | (shell-mode . goto-address-mode) 2329 | :config 2330 | (setenv "PAGER" "cat")) 2331 | 2332 | (use-package simple 2333 | :defer t 2334 | :commands (my/toggle-window-split) 2335 | :hook 2336 | ;; Turn on visual line mode for nice line wrapping 2337 | (after-init . global-visual-line-mode) 2338 | :bind 2339 | ("M-/" . cycle-spacing) 2340 | ("C-z" . undo) 2341 | ;; The -dwim versions of these three commands are new in Emacs 26 and 2342 | ;; better than their non-dwim counterparts, so override those default 2343 | ;; bindings: 2344 | ("M-l" . downcase-dwim) 2345 | ("M-c" . capitalize-dwim) 2346 | ("M-u" . upcase-dwim) 2347 | ;; Super useful for "merging" lines together, overrides the much less 2348 | ;; useful tab-to-tab-stop: 2349 | ("M-i" . delete-indentation) 2350 | (:prefix-map my/transpose-map 2351 | :prefix "C-t" 2352 | ("f" . my/toggle-window-split) 2353 | ("c" . transpose-chars) 2354 | ("w" . transpose-words) ;also M-t by default 2355 | ("l" . transpose-lines) 2356 | ("p" . transpose-paragraphs) 2357 | ("s" . transpose-sentences) 2358 | ("x" . transpose-sexps)) 2359 | :custom 2360 | (column-number-mode t "Turn on column numbers in mode-line.") 2361 | (delete-active-region 'kill "Single char delete commands kill active regions.") 2362 | (save-interprogram-paste-before-kill t "Save system clipboard before overwriting it.") 2363 | (set-mark-command-repeat-pop t) 2364 | (shell-command-dont-erase-buffer 'end-last-out "Don't erase output in shell buffers since it's so easy to navigate around.") 2365 | (async-shell-command-display-buffer nil "Only show a shell buffer if there's something to show.") 2366 | (kill-ring-max 500) 2367 | :config 2368 | (defun my/toggle-window-split (&optional arg) 2369 | "Switch between 2 windows split horizontally or vertically. 2370 | With ARG, swap them instead." 2371 | (interactive "P") 2372 | (unless (= (count-windows) 2) 2373 | (user-error "Not two windows")) 2374 | ;; Swap two windows 2375 | (if arg 2376 | (let ((this-win-buffer (window-buffer)) 2377 | (next-win-buffer (window-buffer (next-window)))) 2378 | (set-window-buffer (selected-window) next-win-buffer) 2379 | (set-window-buffer (next-window) this-win-buffer)) 2380 | ;; Swap between horizontal and vertical splits 2381 | (let* ((this-win-buffer (window-buffer)) 2382 | (next-win-buffer (window-buffer (next-window))) 2383 | (this-win-edges (window-edges (selected-window))) 2384 | (next-win-edges (window-edges (next-window))) 2385 | (this-win-2nd (not (and (<= (car this-win-edges) 2386 | (car next-win-edges)) 2387 | (<= (cadr this-win-edges) 2388 | (cadr next-win-edges))))) 2389 | (splitter 2390 | (if (= (car this-win-edges) 2391 | (car (window-edges (next-window)))) 2392 | 'split-window-horizontally 2393 | 'split-window-vertically))) 2394 | (delete-other-windows) 2395 | (let ((first-win (selected-window))) 2396 | (funcall splitter) 2397 | (if this-win-2nd (other-window 1)) 2398 | (set-window-buffer (selected-window) this-win-buffer) 2399 | (set-window-buffer (next-window) next-win-buffer) 2400 | (select-window first-win) 2401 | (if this-win-2nd (other-window 1)))))) 2402 | (defun my/extract-pdf-pages (infile frompg topg) 2403 | "Extracts pages from a pdf file. 2404 | 2405 | Extract pages from INFILE from FROMPG to TOPG using ghostscript. 2406 | Output file will be named by appending _pXX-pYY to INFILE." 2407 | (interactive "ffile: \nnfrom: \nnto: ") 2408 | (async-shell-command 2409 | (concat "gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER" 2410 | " -dFirstPage=" (number-to-string frompg) 2411 | " -dLastPage=" (number-to-string topg) 2412 | " -SOutputFile=" (concat 2413 | (file-name-sans-extension infile) 2414 | "_p" (number-to-string frompg) 2415 | "-p" (number-to-string topg) 2416 | ".pdf ") 2417 | infile))) 2418 | ) ; end use-package simple 2419 | 2420 | (use-package smtpmail 2421 | :hook 2422 | (message-send . mbork/message-warn-if-no-attachments) 2423 | :config 2424 | ;; warn if no attachments 2425 | (defun mbork/message-attachment-present-p () 2426 | "Return t if an attachment is found in the current message." 2427 | (save-excursion 2428 | (save-restriction 2429 | (widen) 2430 | (goto-char (point-min)) 2431 | (when (search-forward "<#part" nil t) t)))) 2432 | 2433 | (defvar mbork/message-attachment-intent-re 2434 | (regexp-opt '("I attach" 2435 | "I have attached" 2436 | "I've attached" 2437 | "I have included" 2438 | "I've included" 2439 | "see the attached" 2440 | "see the attachment" 2441 | "attached file")) 2442 | "A regex which - if found in the message, and if there is no 2443 | attachment - should launch the no-attachment warning.") 2444 | 2445 | (defvar mbork/message-attachment-reminder 2446 | "Are you sure you want to send this message without any attachment? " 2447 | "The default question asked when trying to send a message 2448 | containing `mbork/message-attachment-intent-re' without an 2449 | actual attachment.") 2450 | 2451 | (defun mbork/message-warn-if-no-attachments () 2452 | "Ask the user if s?he wants to send the message even though 2453 | there are no attachments." 2454 | (when (and (save-excursion 2455 | (save-restriction 2456 | (widen) 2457 | (goto-char (point-min)) 2458 | (re-search-forward 2459 | mbork/message-attachment-intent-re nil t))) 2460 | (not (mbork/message-attachment-present-p))) 2461 | (unless (y-or-n-p mbork/message-attachment-reminder) 2462 | (keyboard-quit))))) 2463 | 2464 | (use-package spacemacs-common 2465 | ;; By default, emacs starts with a blindingly white theme. Let's get rid 2466 | ;; of that pronto. 2467 | :custom 2468 | (spacemacs-theme-underline-parens nil) 2469 | (spacemacs-theme-comment-italic t) 2470 | :custom-face 2471 | ;; spacemacs-dark conflicts with moody.el, so override here: 2472 | (mode-line ((t (:box nil :background "#5d4d7a" :underline "#5d4d7a" :overline "#5d4d7a")))) 2473 | (mode-line-inactive ((t (:box nil :underline "#5d4d7a" :overline "#5d4d7a")))) 2474 | (winum-face ((t (:foreground "yellow")))) 2475 | :config 2476 | (defun my/setup-frame-theme (&optional frame) 2477 | "Setup theme for FRAME." 2478 | (when frame (select-frame frame)) 2479 | (if (window-system frame) 2480 | (ignore-errors 2481 | (load-theme 'spacemacs-dark t)))) 2482 | ;; If running as a daemon, wait to load the theme: 2483 | (if (daemonp) 2484 | (add-hook 'after-make-frame-functions #'my/setup-frame-theme) 2485 | (my/setup-frame-theme))) 2486 | 2487 | (use-package stan-mode 2488 | ;; stan is a language to write Bayesian models in 2489 | :defer t 2490 | :mode ("\\.stan\\'" . stan-mode)) 2491 | 2492 | (progn ; `subr' 2493 | ;; Narrowing 2494 | ;; Emacs has a great system to "narrow" a buffer to just a smaller bit. This is useful in a whole bunch of unexpected ways. For example, if a function will do something to a whole buffer but you only want to apply it to part, you can just narrow to that bit of the buffer. Or narrow just to one org subtree when you have a massive org document. The narrow commands are a bit confusing by default. This cleans them up a bit and makes it more intuitive to use. I got this from [[http://endlessparentheses.com/emacs-narrow-or-widen-dwim.html][this post]] (modified a bit). 2495 | 2496 | (defun narrow-or-widen-dwim (p) 2497 | "Widen if buffer is narrowed, narrow-dwim otherwise. 2498 | Dwim means: region, org-src-block, org-subtree, or 2499 | defun, whichever applies first. 2500 | 2501 | With prefix P, don't widen, just narrow even if buffer 2502 | is already narrowed." 2503 | (interactive "P") 2504 | (declare (interactive-only)) 2505 | (cond ((and (buffer-narrowed-p) (not p)) (widen)) 2506 | ((region-active-p) 2507 | (narrow-to-region (region-beginning) 2508 | (region-end))) 2509 | ((derived-mode-p 'org-mode) 2510 | (cond ((ignore-errors (org-narrow-to-block) t)) 2511 | (t (org-narrow-to-subtree)))) 2512 | ((derived-mode-p 'latex-mode) 2513 | (LaTeX-narrow-to-environment)) 2514 | (t (narrow-to-defun)))) 2515 | 2516 | ;; This line actually replaces Emacs' entire narrowing 2517 | ;; keymap, that's how much I like this command. Only 2518 | ;; copy it if that's what you want. 2519 | (bind-key* "C-x n" #'narrow-or-widen-dwim)) 2520 | 2521 | (use-package system-packages 2522 | ;; This is a collection of functions I wrote to help me manage installed 2523 | ;; system packages with emacs. You can find the package on github: 2524 | ;; https://github.com/jabranham/system-packages 2525 | :bind 2526 | (:prefix-map my/system-packages-map 2527 | :prefix "" 2528 | ("i" . system-packages-install) 2529 | ("s" . system-packages-search) 2530 | ("U" . system-packages-uninstall) 2531 | ("D" . system-packages-list-dependencies-of) 2532 | ("I" . system-packages-get-info) 2533 | ("P" . system-packages-list-files-provided-by) 2534 | ("u" . system-packages-update) 2535 | ("O" . system-packages-remove-orphaned) 2536 | ("l" . system-packages-list-installed-packages) 2537 | ("C" . system-packages-clean-cache) 2538 | ("L" . system-packages-log) 2539 | ("v" . system-packages-verify-all-packages) 2540 | ("V" . system-packages-verify-all-dependencies))) 2541 | 2542 | (use-package text-mode 2543 | :hook 2544 | (text-mode . my/dubcaps-mode) 2545 | :commands (my/dubcaps-mode) 2546 | :init 2547 | (defun dcaps-to-scaps () 2548 | "Convert word in DOuble CApitals to Single Capitals." 2549 | (interactive) 2550 | (and (= ?w (char-syntax (char-before))) 2551 | (save-excursion 2552 | (and (if (called-interactively-p 'any) 2553 | (skip-syntax-backward "w") 2554 | (= -3 (skip-syntax-backward "w"))) 2555 | (let (case-fold-search) 2556 | (looking-at "\\b[[:upper:]]\\{2\\}[[:lower:]]")) 2557 | (capitalize-word 1))))) 2558 | (define-minor-mode my/dubcaps-mode 2559 | "Toggle `my/dubcaps-mode'. 2560 | 2561 | Converts words in DOuble CApitals to Single Capitals as you 2562 | type." 2563 | :init-value nil 2564 | :lighter (" DC") 2565 | (if my/dubcaps-mode 2566 | (add-hook 'post-self-insert-hook #'dcaps-to-scaps nil 'local) 2567 | (remove-hook 'post-self-insert-hook #'dcaps-to-scaps 'local)))) 2568 | 2569 | (use-package tooltip 2570 | :defer t 2571 | :config 2572 | ;; If the mouse goes over a divider between windows, Emacs helpfully 2573 | ;; tells you what pressing the mouse buttons will do. This is a little 2574 | ;; annoying, though, so let's disable it: 2575 | (tooltip-mode -1)) 2576 | 2577 | (use-package tramp 2578 | ;; TRAMP allows me to visit remote files in my local Emacs instance. It's 2579 | ;; pretty sweet. 2580 | :defer t 2581 | :custom 2582 | (tramp-histfile-override t "Don't leave histfiles everywhere.") 2583 | (tramp-default-method "ssh" "Use ssh by default.")) 2584 | 2585 | (use-package unfill 2586 | ;; fill-paragraph is nice, but emacs weirdly lacks a convenient way to 2587 | ;; unfill paragraphs once they're filled. This package adds that 2588 | ;; functionality. 2589 | :bind 2590 | ([remap fill-paragraph] . unfill-toggle)) 2591 | 2592 | (use-package vc-git 2593 | :defer t 2594 | :config 2595 | ;; Also, we can substitute the code fork icon from font awesome (which 2596 | ;; you'll need to have installed) to have a pretty symbol instead of 2597 | ;; "git:branch" 2598 | (defun my-vc-git-mode-line-string (orig-fn &rest args) 2599 | "Replace Git in modeline with font-awesome git icon via ORIG-FN and ARGS." 2600 | (let ((str (apply orig-fn args))) 2601 | (concat [#xF126] " " (substring-no-properties str 4)))) 2602 | 2603 | (advice-add #'vc-git-mode-line-string :around #'my-vc-git-mode-line-string) 2604 | ) 2605 | 2606 | (use-package vc-hooks 2607 | :defer t 2608 | :custom 2609 | (vc-follow-symlinks t "Don't ask to follow symlinks.") 2610 | (vc-make-backup-files t "Always make backup files. Of everything. Always.")) 2611 | 2612 | (use-package which-key 2613 | ;; Which key shows key bindings for incomplete commands (prefixes) in a 2614 | ;; neat popup. 2615 | :defer 7 2616 | :commands which-key-mode 2617 | :config 2618 | (which-key-mode)) 2619 | 2620 | (progn ; `window.el' 2621 | ;; start maximized 2622 | (add-to-list 'default-frame-alist '(fullscreen . maximized)) 2623 | ;; Don't split windows vertically 2624 | (setq split-height-threshold nil) 2625 | ;; resize windows: 2626 | (bind-keys ("S-C-" . shrink-window-horizontally) 2627 | ("S-C-" . enlarge-window-horizontally) 2628 | ("S-C-" . shrink-window) 2629 | ("S-C-" . enlarge-window)) 2630 | ;; These functions make splitting windows behave more like I want it to. 2631 | ;; This way, calling C-x 2 or C-x 3 both splits the window *and* shows 2632 | ;; the last buffer. 2633 | (defun my/vsplit-last-buffer (prefix) 2634 | "Split the window vertically and display the previous buffer." 2635 | (interactive "p") 2636 | (split-window-vertically) 2637 | (other-window 1 nil) 2638 | (if (= prefix 1) 2639 | (switch-to-next-buffer))) 2640 | (defun my/hsplit-last-buffer (prefix) 2641 | "Split the window horizontally and display the previous buffer." 2642 | (interactive "p") 2643 | (split-window-horizontally) 2644 | (other-window 1 nil) 2645 | (if (= prefix 1) (switch-to-next-buffer))) 2646 | (bind-keys ("C-x 2" . my/vsplit-last-buffer) 2647 | ("C-x 3" . my/hsplit-last-buffer)) 2648 | ;; Rebind C-x 1 to be able to restore window layout 2649 | 2650 | ;; By default, C-x 1 deletes all windows except the currently focused 2651 | ;; one. I set it up here so that it stores the layout before deleting 2652 | ;; the windows so that I can restore the layout by hitting C-x 1 again. 2653 | ;; Stolen from 2654 | ;; https://github.com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-windows-buffers.el 2655 | (defvar my/toggle-one-window--buffer-name nil 2656 | "Variable to store the name of the buffer for which the `my/toggle-one-window' 2657 | function is called.") 2658 | (defvar my/toggle-one-window--window-configuration nil 2659 | "Variable to store the window configuration before `my/toggle-one-window' 2660 | function was called.") 2661 | (defun my/toggle-one-window (&optional force-one-window) 2662 | "Toggles the frame state between deleting all windows other than 2663 | the current window and the windows state prior to that." 2664 | (interactive "P") 2665 | (if (or (not (one-window-p)) 2666 | force-one-window) 2667 | (progn 2668 | (setq my/toggle-one-window--buffer-name (buffer-name)) 2669 | (setq my/toggle-one-window--window-configuration (current-window-configuration)) 2670 | (delete-other-windows)) 2671 | (progn 2672 | (when my/toggle-one-window--buffer-name 2673 | (set-window-configuration my/toggle-one-window--window-configuration) 2674 | (switch-to-buffer my/toggle-one-window--buffer-name))))) 2675 | 2676 | (bind-key "C-x 1" #'my/toggle-one-window) 2677 | ;; To quickly access scratch press my/map f1: 2678 | (defun my/get-scratch () 2679 | "Switch to scratch buffer." 2680 | (interactive) 2681 | (switch-to-buffer "*scratch*")) 2682 | (bind-key "" #'my/get-scratch my/map)) 2683 | 2684 | (use-package winum 2685 | :defer 1 2686 | ;; I can use winum to quickly jump from window to window. 2687 | :bind* 2688 | ("M-0" . winum-select-window-0-or-10) 2689 | ("M-1" . winum-select-window-1) 2690 | ("M-2" . winum-select-window-2) 2691 | ("M-3" . winum-select-window-3) 2692 | ("M-4" . winum-select-window-4) 2693 | ("M-5" . winum-select-window-5) 2694 | ("M-6" . winum-select-window-6) 2695 | ("M-7" . winum-select-window-7) 2696 | ("M-8" . winum-select-window-8) 2697 | ("M-9" . winum-select-window-9) 2698 | :config 2699 | (setq winum-scope 'frame-local) 2700 | (setq winum-auto-setup-mode-line nil) 2701 | (winum-mode)) 2702 | 2703 | (use-package with-editor 2704 | ;; Use Emacs as the $EDITOR environmental variable: 2705 | :hook 2706 | ((shell-mode eshell-mode) . with-editor-export-editor) 2707 | :config 2708 | (shell-command-with-editor-mode)) 2709 | 2710 | (use-package ws-butler 2711 | ;; Whitespace is evil. Let's get rid of as much as possible. But we 2712 | ;; don't want to do this with files that already had whitespace (from 2713 | ;; someone else's project, for example). This mode will call 2714 | ;; `whitespace-cleanup' before buffers are saved (but smartly)! 2715 | :hook 2716 | ((prog-mode ledger-mode gitconfig-mode) . ws-butler-mode) 2717 | :custom 2718 | (ws-butler-keep-whitespace-before-point nil)) 2719 | 2720 | (use-package yasnippet 2721 | ;; Yasnippet allows you to type an abbreviation and then expand it into a 2722 | ;; template. We can look at yasnippet's documentation on github: 2723 | ;; https://github.com/capitaomorte/yasnippet. 2724 | 2725 | ;; If I want to make my own, I can put them in `yas-snippet-dirs' 2726 | 2727 | ;; I integrate yasnippet with hippie-expand so using `hippie-expand' 2728 | ;; expands a snippet if I have one, and then otherwise tries the 2729 | ;; `hippie-expand' functions. 2730 | :after hippie-exp 2731 | :defer 1 2732 | :custom 2733 | (yas-wrap-around-region t) 2734 | (yas-prompt-functions '(yas-completing-prompt) "If competing snippets, use completing-read (helm) to select:") 2735 | ;; (yas-alias-to-yas/prefix-p nil "Don't make old style yas/ symbols.") 2736 | :bind 2737 | ("M-`" . yas-insert-snippet) 2738 | :init 2739 | ;; disable yas minor mode map 2740 | ;; use hippie-expand instead 2741 | (setq yas-minor-mode-map (make-sparse-keymap)) 2742 | :config 2743 | (add-hook 'term-mode-hook (lambda () (yas-minor-mode -1))) 2744 | (unbind-key "C-c &" yas-minor-mode-map) 2745 | (yas-global-mode)) 2746 | 2747 | ;; Restore gc threshold 2748 | (run-with-idle-timer 5 nil 2749 | (lambda () (setq gc-cons-threshold 800000))) 2750 | 2751 | ;; Local Variables: 2752 | ;; indent-tabs-mode: nil 2753 | ;; fill-column: 75 2754 | ;; sentence-end-double-space: t 2755 | ;; no-byte-compile: t 2756 | ;; End: 2757 | 2758 | ;;; init.el ends here 2759 | --------------------------------------------------------------------------------