Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
1187 lines (1170 sloc) 36.6 KB

use-package

Use-package is an amazing resource to clean up my init file and have it play nice on both my desktop and laptop.

(eval-when-compile
  (require 'use-package))
(require 'diminish)  ; to omit lines from the mode-line
(require 'bind-key)  ; for easy keybindings

dirvar

define dirvars ‘org-in-file’, ‘org-gtd-file’, etc.

(load "~/.emacs.d/dirvars.el")

interface and appearance

turn off UI elements and small tweaks

(autoload 'ibuffer "ibuffer")
(setq inhibit-splash-screen t)
(scroll-bar-mode -1)   ; turn off the scroll bar
(tool-bar-mode -1)     ; turn off the tool bar
(menu-bar-mode -1)     ; turn off the menu
(setq visible-bell 1)  ; turn off beeps, make them flash!
(setq-default fill-column 79)
(setq sentence-end-double-space nil)

 ;; 20MB of memory before calling garbage collection
(setq gc-cons-threshold 20000000)

;; typed text will replace highlighted region
(delete-selection-mode 1)

;; backspace deletes one character instead of one column
(global-set-key (kbd "DEL") 'backward-delete-char)

;; enable `downcase-region' and `upcase-region'
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(defalias 'yes-or-no-p 'y-or-n-p)

;; always follow symlinks w/o asking
(require 'vc-hooks)
(setq vc-follow-symlinks t)

;; remove trailing whitespace before save
(add-hook 'before-save-hook 'delete-trailing-whitespace)

;; prefer utf-8
(prefer-coding-system 'utf-8-unix)

don’t make a mess of my folders

(setq
 auto-save-default nil
 backup-inhibited t
 confirm-nonexistent-file-or-buffer nil
 create-lockfiles nil
 mouse-wheel-progressive-speed nil)

play nice with parentheses

(electric-pair-mode 1) ; auto-insert matching bracket
(show-paren-mode 1)    ; turn on paren match highlighting

rainbow-delimiters

matching parenthesis are highlighted with rainbow colours.

(use-package rainbow-delimiters
  :ensure t
  :config
  :hook ((prog-mode LaTeX-mode) . rainbow-delimiters-mode))

set the theme

monokai

(use-package monokai-theme
  :ensure t
  :init
  (load-theme 'monokai t))

toggle transparency

(add-to-list 'default-frame-alist '(alpha . (85 . 50)))
(add-hook 'pdf-view-mode-hook 'toggle-transparency)
(defun toggle-transparency ()
  (interactive)
  (let ((alpha (frame-parameter nil 'alpha)))
    (set-frame-parameter
     nil 'alpha
     (if (eql (cond ((numberp alpha) alpha)
                    ((numberp (cdr alpha)) (cdr alpha))
                    ;; Also handle undocumented (<active> <inactive>) form.
                    ((numberp (cadr alpha)) (cadr alpha)))
              100)
         '(85 . 50) '(100 . 100)))))
(global-set-key (kbd "C-c T") 'toggle-transparency)

default font

(set-face-attribute 'default nil
                    :family "Source Code Pro" :height 130)

beacon

Highlight the current line when scrolling

(use-package beacon
  :ensure t
  :init (beacon-mode 1)
  :diminish beacon-mode
  :config
  (setq beacon-size 80)
  (setq beacon-color "#ffcccc"))
(global-hl-line-mode t)

rainbow-mode

Highlight hex colours!

(use-package rainbow-mode
  :ensure t)

evil

evil

vim emulator

(use-package evil
  :ensure t
  :init
  (setq evil-want-integration nil)
  (setq evil-cross-lines t)
  (setq evil-want-C-u-scroll t) ; C-u scrolls up half page
  :config
  (evil-mode 1)
  :bind (:map evil-normal-state-map
		("C-h" . evil-window-left)
		("C-j" . evil-window-down)
		("C-k" . evil-window-up)
		("C-l" . evil-window-right)))

evil-collection

(use-package evil-collection
  :after evil
  :ensure t
  :init
  (evil-collection-init))

evil-org

https://github.com/Somelauw/evil-org-mode evil keymap for org-mode

(use-package evil-org
  :ensure t
  :after org
  :hook ((org-mode . evil-org-mode)
	   (evil-org-mode . (lambda ()
			      (evil-org-set-key-theme
			       '(navigation insert return textobjects additional shift todo heading calendar))))
	   (org-capture-mode . evil-insert-state))
  :config
  (require 'evil-org-agenda)
  (evil-org-agenda-set-keys))

evil-escape

https://github.com/syl20bnr/evil-escape escape from everything using jk

(use-package evil-escape
  :ensure t
  :diminish evil-escape-mode
  :config
  (evil-escape-mode 1)
  (setq-default evil-escape-key-sequence "jk"))

evil-easymotion

https://github.com/PythonNut/evil-easymotion/

(use-package evil-easymotion
  :ensure t
  :config
  (evilem-default-keybindings "SPC"))

evil-snipe

https://github.com/hlissner/evil-snipe

(use-package evil-snipe
  :ensure t
  :config
  (evil-snipe-mode 1)
  (evil-snipe-override-mode 1))

evil-commentary

https://github.com/linktohack/evil-commentary comment/uncomment with gc

(use-package evil-commentary
  :ensure t
  :config
  (evil-commentary-mode))

evil-indent-plus

https://github.com/TheBB/evil-indent-plus operate on indentation regions, mainly with ii

(use-package evil-indent-plus
  :ensure t
  :config
  (evil-indent-plus-default-bindings))

evil-magit

evil keybindings for magit

(use-package evil-magit
  :ensure t)

telephone-line

very nice powerline-based status line

(use-package telephone-line
  :ensure t
  :init
  (setq telephone-line-lhs
	  '((evil   . (telephone-line-evil-tag-segment))
	    (accent . (telephone-line-vc-segment
		       telephone-line-erc-modified-channels-segment
		       telephone-line-process-segment))
	    (nil    . (telephone-line-minor-mode-segment
		       telephone-line-buffer-segment))))
  (setq telephone-line-rhs
	  '((nil    . (telephone-line-misc-info-segment))
	    (accent . (telephone-line-major-mode-segment))
	  (evil   . (telephone-line-airline-position-segment))))
  :config
  (require 'telephone-line-config)
  (telephone-line-evil-config))

org-mode

my gtd and inbox files finding functions

no longer need this now that I discovered “C-‘” shortcut org-in-file and org-gtd-file are defined in emacsdirs.el (private file).

;; TODO: figure out how to do this in a less stupid way
(defun open-gtd-file ()
  "Open the GTD file."
  (interactive)
  (find-file org-gtd-file))
(defun open-inbox-file ()
  "Open the inbox file."
  (interactive)
  (find-file org-in-file))
(defun open-clumped-file ()
   "Open the clumped file."
   (interactive)
   (find-file org-clumped-file))

setup

;; get latest org-mode from other repo than elpa
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
(use-package org
  :pin org
  :ensure org-plus-contrib

keybindings

:bind
(("C-c l" . org-store-link)
 ("C-c a" . org-agenda)
 ("C-c c" . org-capture)
 ("C-c g" . open-gtd-file)
 ("C-c i" . open-inbox-file)
 ("C-c t" . open-clumped-file)
 ("C-c !" . org-time-stamp-inactive))

basics

:config
(setq org-return-follows-link t)
(setf org-special-ctrl-a/e t)
(setq org-fast-tag-selection-single-key t)
;; folded drawers no longer ruin new entries
(setq org-M-RET-may-split-line '((default . nil)))

theming

(setq org-startup-indented t)
;(setq org-hide-leading-stars t)
(setf org-tags-column -65)
(setq org-fontify-emphasized-text t)
(setq org-fontify-done-headline t)
(setq org-pretty-entities t)
(setq org-ellipsis "") ;▼ … ◦

file associations

(setq org-file-apps
      '((auto-mode . emacs)
        ("\\.x?html?\\'" . "xdg-open %s")
        ("\\.pdf\\'" . (lambda (file link)
                         (org-pdfview-open link)))
        ("\\.mp4\\'" . "xdg-open %s")
        ("\\.webm\\'" . "xdg-open %s")
        ("\\.mkv\\'" . "xdg-open %s")
        ("\\.pdf.xoj\\'" . "xournal %s")))

org-agenda

;; (setq org-agenda-files (list "<file1.org> etc."))
(setq calendar-week-start-day 1) ; 0:Sunday, 1:Monday
(setq org-deadline-warning-days 14)
;; exclude scheduled items from all todo's in list
(setq org-agenda-todo-ignore-scheduled t)
;; (setq org-agenda-todo-ignore-deadlines t)
(setq org-agenda-todo-ignore-timestamp t)
(setq org-agenda-todo-ignore-with-date t)
(setq org-agenda-prefix-format "  %-17:c%?-12t% s")
(setq org-agenda-include-all-todo nil)
(setq org-log-done 'time)

agenda files

all the org-files in my org-directory

(setq org-directory "~/Dropbox/Apps/orgzly/")
(setq org-agenda-files (directory-files-recursively org-directory "\\.org$"))

refile targets

swyper makes refiling amazing!

;; TODO: refile without the annoying ^ regex
(setq org-refile-targets (quote ((nil :maxlevel . 9)  ;; current file
                                 (org-gtd-file :maxlevel . 3)
                                 (org-tickler-file :maxlevel . 2)
                                 (org-lists-file :maxlevel . 2)
                                 (org-someday-file :maxlevel . 2)
                                 (org-clumped-file :maxlevel . 4))))
(setq org-outline-path-complete-in-steps nil)   ;; Refile in a single go
(setq org-refile-use-outline-path t)            ;; Show full paths for refiling

agenda filters

Filter tasks by context (sorted by todo state)

(setq org-agenda-sorting-strategy '(todo-state-up))
(setq org-agenda-custom-commands
      '(("i" "Inbox" tags-todo "in")
        ;; ("w" "FancyWork" ((agenda "" (org-agenda-span 1))
        ;; 		  ((tags-todo "Work")
        ;;                    (todo "NEXT")
        ;;                    (org-agenda-sorting-strategy '((tags)))))
        ("g" . "GTD contexts")
        ("gh" "Home" tags-todo "@home")
        ("gu" "University" tags-todo "@uni")
        ("ge" "Errands" tags-todo "@errands")
        ("gl" "Laboratory" tags-todo "@lab")
        ("gp" "Phone" tags-todo "@phone")
        ("gm" "e-mail" tags-todo "@email")
        ("gs" "Slack" tags-todo "@slack")
        ("gc" "Computer" tags-todo "@computer")
        ("gb" "Bank" tags-todo "@bank")
        ("ga" "Agenda" tags-todo "@agenda")
        ("gw" "Write" tags-todo "@write")
        ("gr" "Research" tags-todo "@research")
        ("E" . "Energy")
        ("E1" "Morning" tags-todo "morning")
        ("E2" "Afternoon" tags-todo "afternoon")
        ("E3" "Evening" tags-todo "evening")
        ("p" . "People")
        ("pM" "Martin" tags-todo "Martin")
        ("pA" "Anne" tags-todo "Anne")
        ("pI" "Inigo" tags-todo "Inigo")
        ("pR" "Robin" tags-todo "Robin")
        ("pV" "RobinV" tags-todo "RobinV")
        ("pC" "Margot" tags-todo "Margot")
        ("pS" "Appy" tags-todo "Appy")
        ("pZ" "Richard" tags-todo "Richard")
        ("pL" "Lucas" tags-todo "Lucas")
        ("pN" "Nele" tags-todo "Nele")
        ("pH" "Holger" tags-todo "Holger")
        ("W" "Work" tags-todo "Work")
        ("P" "Personal" tags-todo "Personal")))

gapture templates

customize capture templates, variables are defined in a private file.

(setq org-capture-templates
      '(("a" "Appointment" entry (file org-in-file)
         "* %?\n  %^T\n")
        ("t" "Todo" entry (file org-in-file)
         "* %?\n:PROPERTIES:\n:CREATED: %u\n:END:\n %i\n %a\n")
        ("T" "Todo-nolink-tag" entry (file org-in-file)
         "* %? %^G\n:PROPERTIES:\n:CREATED: %u\n:END:\n %i\n")
        ("m" "Email" entry (file org-in-file)
         "* %? :@email:\n:PROPERTIES:\n:CREATED: %u\n:END:\n %i\n %a\n")
        ("w" "Website" entry (file org-in-file)
         "* %?\nEntered on %U\n %i\n %a")
        ("j" "Journal" entry (file+olp+datetree org-journal-file)
         "* %?\nEntered on %U\n %i\n %a")))

states

(setq org-todo-keywords
      '((sequence "TICK(t)" "NEXT(n)" "WAIT(w!/!)" "SOME(s!/!)" "PROJ(p)" "|"
                  "DONE(d)" "CANC(c)")))
;; prettify the todo keywords
(setq org-todo-keyword-faces
      '(("TICK" . (:background "light slate blue"))
        ("NEXT" . (:foreground "light goldenrod yellow" :background "red" :weight bold))
        ("WAIT" . (:foreground "dim gray" :background "yellow"))
        ("SOME" . (:foreground "ghost white"  :background "deep sky blue"))
        ("DONE" . (:foreground "green4"       :background "pale green"))
        ("CANC" . (:foreground "dim gray"     :background "gray"))
        ("PROJ" . (:foreground "navajo white" :background "saddle brown"))))

effort estimates

(add-to-list 'org-global-properties
             '("Effort_ALL". "0:05 0:15 0:30 1:00 2:00 3:00 4:00"))

context tags

(setq org-tag-alist '((:startgroup . nil)
                      ("@home" . ?h)
                      ("@uni" . ?u)
                      ("@errands" . ?e)
                      ("@lab" . ?l)
                      ("@phone" . ?p)
                      ("@email" . ?m)
                      ("@slack". ?s)
                      ("@computer" . ?c)
                      ("@bank" . ?b)
                      (:endgroup . nil)
                      (:startgroup . nil)
                      ("@agenda" . ?a) ("@write" . ?w) ("@research" . ?r)
                      (:endgroup . nil)
                      (:startgroup . nil)
                      ("morning" . ?1) ("afternoon" .?2) ("evening" .?3)
                      (:endgroup . nil)
                      (:startgroup . nil)
                      ("Work" . ?W) ("Personal" . ?P)
                      (:endgroup . nil)
                      ("Martin". ?M) ("Anne" . ?A) ("Inigo". ?I)
                      ("Robin" . ?R) ("RobinV" . ?V) ("Margot" . ?C)
                      ("Appy" . ?S) ("Richard" . ?Z) ("Lucas" . ?L)
                      ("Nele". ?N) ("Holger". ?H)))

org-babel languages

(org-babel-do-load-languages
 'org-babel-load-languages
 '((stan . t)
   (R . t)))

org-export odt

(require 'ob-org)

ox-extra

org-export ignore headlines with :ignore: tag

(require 'ox-extra)
(ox-extras-activate '(latex-header-blocks ignore-headlines))

org-latex export settings

basic latex settings

(setq org-highlight-latex-and-related '(latex script entities))
(setq org-latex-create-formula-image-program 'dvipng)
(setq org-latex-default-figure-position 'htbp)
(setq org-latex-pdf-process
      (list "latexmk -pdflatex='pdflatex -shell-escape -interaction nonstopmode -output-directory %o' -f -pdf %f"))
(setq org-latex-prefer-user-labels t)
;; disable the ang preview entity, because it conflicts with \ang from siunitx
(with-eval-after-load 'org-entities
  (setq org-entities
        (cl-remove-if (lambda (x)
                        (and (listp x) (equal (car x) "ang"))) org-entities)))

latex class ijkarticle

(add-to-list 'org-latex-classes
       '("ijkarticle"
	 "\\documentclass{article}
\\usepackage[citestyle=authoryear,bibstyle=authoryear,hyperref=true,maxcitenames=3,url=true,backend=biber,natbib=true]{biblatex}
\\usepackage[version=4]{mhchem} % for chemical equations with `\ce{}'
\\usepackage{siunitx} % for SI units
%% \\usepackage[Symbol]{upgreek} % to allow for upright delta symbol
\\sisetup{
  separate-uncertainty = true,
  multi-part-units = single,
  list-units = single,
  range-units = single
}%
%% new units
\\DeclareSIUnit\\permil{\\text{\\textperthousand}} % per mille
\\DeclareSIUnit\\pmVPDB{\\permil~\\text{VPDB}}     % Vienna Pee Dee Belumnite
\\DeclareSIUnit\\annus{\\text{a}}                 % /annum, latin for one year
\\DeclareSIUnit\\Ma{\\mega\\annus}                 % million years ago
\\DeclareSIUnit\\ka{\\kilo\\annus}                 % thousand years ago
\\DeclareSIUnit\\year{\\text{yr}}                 % unit for duration
\\DeclareSIUnit\\Myr{\\mega\\year}                 % million year
\\DeclareSIUnit\\kyr{\\kilo\\year}                 % thousand year
\\DeclareSIUnit\\ppmv{\\text{ppmv}}               % parts per million volume
\\DeclareSIUnit\\mbsf{\\metre\\text{bsf}}          % metre below sea floor

%% aliases for clearer document
\\newcommand{\\appr}{\\raise.17ex\\hbox{$\\scriptstyle\\sim$}} % approximately symbol
"
		 ("\\section{%s}" . "\\section*{%s}")
		 ("\\subsection{%s}" . "\\subsection*{%s}")
		 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
		 ("\\paragraph{%s}" . "\\paragraph*{%s}")
		 ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

mathjax

an attempt at getting siunitx and mhchem working in html

(setq org-html-mathjax-options
      '((path "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML")
        (scale "100")
        (align "center")
        (indent "2em")
        (mathml t)))
(setq org-html-mathjax-template
"
 <script type=\"text/x-mathjax-config\">
    MathJax.Ajax.config.path[\"mhchem\"] =
      \"https://cdnjs.cloudflare.com/ajax/libs/mathjax-mhchem/3.2.0\";
    MathJax.Ajax.config.path[\"siunitx\"] =
      \"https://cdn.rawgit.com/burnpanck/MathJax-siunitx/f0f03a29\";
    MathJax.Hub.Config({
      extensions: [\"[mhchem]/mhchem.js\", \"[siunitx]/siunitx.js\"],
      jax: [\"input/TeX\", \"output/HTML-CSS\"],
      TeX: {
        extensions: [\"[mhchem]/mhchem.js\",\"[siunitx]/siunitx.js\"]
      },
      tex2jax: {
        inlineMath: [ ['$','$'], [\"\\(\",\"\\)\"] ],
        displayMath: [ ['$$','$$'], [\"\\[\",\"\\]\"] ],
        processEscapes: true
      },
      \"HTML-CSS\": { availableFonts: [\"TeX\"] }
    });
  </script>
  <script type=\"text/javascript\" async
          src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML\">
</script>
")

close use-package org

)

org-bullets

prettify org mode

(use-package org-bullets
  :ensure t
  :after org
  :hook
  (org-mode . (lambda () (org-bullets-mode 1)))
  :config
  (setq org-bullets-bullet-list
        '("" "" "" "" "" "" "")))

org-gcal

synchronize google calendar with org

(use-package org-gcal
  :after org
  :ensure t
  ;;:bind
  ;;(:map org-agenda-mode ("U" . org-gcal-fetch))  ;; same key as mu4e!
  :config
  (setq org-gcal-client-id "<your-client-id>"
        org-gcal-client-secret "<your-client-secret>"
        org-gcal-file-alist '(("<link>@group.calendar.google.com>" . "<link-to-org-file>"))))

org-pdfview

(use-package org-pdfview
  :after org
  :ensure t)

org-beamer

(use-package ox-latex
  :after org
  :config
  (add-to-list 'org-latex-classes
               '("beamer"
                 "\\documentclass\[presentation\]\{beamer\}"
                 ("\\section\{%s\}" . "\\section*\{%s\}")
                 ("\\subsection\{%s\}" . "\\subsection*\{%s\}")
                 ("\\subsubsection\{%s\}" . "\\subsubsection*\{%s\}"))))

org-ref

(use-package org-ref
  :ensure t
  :after org
  :init
  (setq org-ref-completion-library 'org-ref-ivy-cite))

org-clock-query-out

I keep forgetting to clock out, this should help me prevent that.

(defun org-clock-query-out ()
  "Check if any clocks are running, jump to the clock and ask to clock it out"
  (if (org-clocking-p)
      (progn
        (org-clock-jump-to-current-clock)
        (if (yes-or-no-p "This clock is still running, want to clock out?")
            (org-clock-out)
          (if (yes-or-no-p "Would you like to edit the clock?")
              nil
            (progn (switch-to-prev-buffer) t))
          t))
    t))
;; run this everytime I kill emacs
(add-hook 'kill-emacs-query-functions 'org-clock-query-out)

general packages and functions

easy symbol insertion

By default C-x 8 o = ° and C-x 8 m = µ. So:

(global-set-key (kbd "C-x 8 a") (lambda () (interactive) (insert "α")))
(global-set-key (kbd "C-x 8 b") (lambda () (interactive) (insert "β")))
(global-set-key (kbd "C-x 8 d") (lambda () (interactive) (insert "δ")))
(global-set-key (kbd "C-x 8 D") (lambda () (interactive) (insert "Δ")))

revert buffer

(global-set-key (kbd "<f5>") 'revert-buffer)

eshell

open an eshell here

(defun eshell-here ()
  "Opens up a new shell in the directory associated with the
current buffer's file. The eshell is renamed to match that
directory to make multiple eshell windows easier."
  (interactive)
  (let* ((parent (if (buffer-file-name)
                     (file-name-directory (buffer-file-name))
                   default-directory))
         (height (/ (window-total-height) 3))
         (name   (car (last (split-string parent "/" t)))))
    (split-window-vertically (- height))
    (other-window 1)
    (eshell "new")
    (rename-buffer (concat "*eshell: " name "*"))

    (insert (concat "ls"))
    (eshell-send-input)))
(global-set-key (kbd "C-!") 'eshell-here)

close current eshell

(defun eshell/x ()
  (insert "exit")
  (eshell-send-input)
  (delete-window))

C-l clears the eshell buffer

(defun eshell-clear-buffer ()
  "Clear terminal"
  (interactive)
  (let ((inhibit-read-only t))
    (erase-buffer)
    (eshell-send-input)))
(add-hook 'eshell-mode-hook
	   '(lambda()
	      (local-set-key (kbd "C-l") 'eshell-clear-buffer)))

ranger

(use-package ranger
  :ensure t
  :bind
  ("C-c r" . ranger)
  :config
  (setq ranger-show-hidden nil)
  (setq ranger-show-literal nil)
  (setq ranger-show-preview t)
  (setq ranger-width-preview 0.55)
  (ranger-override-dired-mode t))

pdf-tools

install from AUR emacs-pdf-tools-git

(use-package pdf-tools
  :pin manual
  :magic ("%PDF" . pdf-view-mode)
  :config
  (pdf-tools-install)
  (setq-default pdf-view-display-size 'fit-width)
  :bind
  ;; swiper doesn't play nice with pdf-tools, so I disable it.
  (:map pdf-view-mode-map ("C-s" . isearch-forward)))

swiper

very nice search replacement

(use-package swiper
  :init (ivy-mode 1)
  :ensure t
  :config
  (setq ivy-use-virtual-buffers t)
  (define-key read-expression-map (kbd "C-r") 'counsel-expression-history)
  (setq ivy-count-format "(%d/%d) ")
  :bind
  ("\C-s" . swiper)
  ("C-c C-r" . ivy-resume)
  ("C-c v" . ivy-push-view)
  ("C-c V" . ivy-pop-view))

counsel

(use-package counsel
  :init (counsel-mode 1)
  :ensure t
  :bind
  ("M-x" . counsel-M-x)
  ("C-c s" . counsel-rg))

ace-window

Move to other buffers

(use-package ace-window
  :ensure t
  :bind ([remap other-window] . ace-window)
  :custom-face
  (aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 2.0)))))

magit

git management

(use-package magit
  :ensure t
  :bind
  ("M-g" . magit-status))

projectile

(use-package projectile
  :ensure t
  :config
  (projectile-mode))

auto-complete

auto complete everything

(use-package auto-complete
  :ensure t
  :init
  (ac-config-default)
  (global-auto-complete-mode t))

file extension modes

(use-package conf-mode
  :mode ("i3config" "i3status" ".*rc\\'" "\\.inp\\'"))

flycheck

(use-package flycheck
  :ensure t
  :init
  (global-flycheck-mode t))

web dictionary

(use-package define-word
  :ensure t
  :bind ("C-c d" . define-word))

firefox as default browser

 (setq browse-url-browser-function 'browse-url-generic
	browse-url-generic-program "firefox")

emacs-pkgbuild-mode

Install it with Pacman

sudo pacman -S emacs-pkgbuild-mode

Then load it into emacs when opening a PKGBUILD file

(use-package pkgbuild-mode
   :load-path "/usr/share/emacs/site-lisp/"
   :mode "/PKGBUILD$")

systemd

(use-package systemd
  :ensure t)

erc

I use weechat on command line now

(use-package erc
  :config
  (setq erc-hide-list '("JOIN" "PART" "QUIT"))
  (setq erc-track-exclude-types '("JOIN" "MODE"
    "NICK" "PART" "QUIT" "305" "306" "324" "329" "332" "333" "353" "477")))

email

smtp

(use-package smtpmail
  :config
  (setq message-send-mail-function 'smtpmail-send-it
	send-mail-function 'smtpmail-send-it
	user-mail-address "<your-email-address>"
	smtpmail-default-smtp-server "<your-smtp-server>"
	smtpmail-smtp-server "<your-smtp-server>"
	smtpmail-smtp-service 587
	smtp-stream-type 'starttls
	smtpmail-smtp-user "<your-user-id>"
	smtpmail-starttls-credentials
	'(("<your-smtp-server>" 587 "<possiblly-domain>/<your-user-id>" nil))
	starttls-use-gnutls t
	starttls-gnutls-program "gnutls-cli"
	starttls-extra-args nil))

mu4e

install it with pacman mu

(use-package mu4e
  :load-path "/usr/share/emacs/site-lisp/mu4e/"
  :commands mu4e
  :bind (("C-c m" . mu4e)
         :map mu4e-headers-mode-map
         ("C-c c" . org-mu4e-store-and-capture)
         :map mu4e-view-mode-map
         ("C-c c" . org-mu4e-store-and-capture))
  :init
  (setq mu4e-drafts-folder "/Drafts"
        mu4e-sent-folder "/Sent Items"
        mu4e-trash-folder "/Deleted Items")
  ;;(setq mu4e-compose-format-flowed t)  ; plain-text nice to read on phone
  (setq mu4e-maildir-shortcuts
        '(("/inbox" . ?i)
          ("/NEXT" . ?n)
          ("/Waiting" . ?w)
          ("/Deferred" . ?d)
          ("/news" . ?m)
          ("/Important backlog" . ?l)
          ("/Sent Items" . ?s)
          ("/archive" . ?r)))
  (setq mu4e-change-filenames-when-moving t) ; important for isync
  (setq mu4e-headers-date-format "%Y-%m-%d %H:%M")
  (setq mu4e-headers-fields
        '((:date          .  17)
          (:flags         .   5)
          (:from          .  22)
          (:subject       .  nil)))
  (setq mu4e-get-mail-command "mbsync -a")
  (setq mu4e-headers-include-related t)
  (setq mu4e-confirm-quit nil)
  (setq mu4e-view-show-images t)
  (require 'org-mu4e)
  (setq org-mu4e-link-query-in-headers-mode nil))

mu4e notifications

(use-package mu4e-alert
  :ensure t
  :after mu4e
  :config
  (mu4e-alert-set-default-style 'libnotify)
  :hook (after-init . mu4e-alert-enable-notifications))

Science packages

ess

emacs speaks statistics, work with R etc. installed from AUR emacs-ess

(use-package ess-site
  :load-path "/usr/share/emacs/site-lisp/ess/"
  :init (require 'ess-site)  ;; I don't know how else to get this working...
  :commands R
  :config
  (defun my-org-confirm-babel-evaluate (lang body)
    (not (string= lang "R")))  ; don't ask for R
  (setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
  (setq ess-default-style 'RStudio-))

polymode

for working with .Rmd files etc.

(use-package polymode
  :ensure t
  :mode
    ;; R modes
    ("\\.Snw" . poly-noweb+r-mode)
    ("\\.Rnw" . poly-noweb+r-mode)
    ("\\.Rmd" . poly-markdown+r-mode))

matlab

if I’m ever required to work in non-open-source

(use-package matlab
  :init (autoload 'matlab-mode "matlab" "Matlab Editing Mode" t)
  :mode ("\\.m\\'" . matlab-mode)
  :interpreter "matlab"
  :config
  (setq matlab-indent-function t)
  (setq matlab-indent-function "matlab"))

markdown-mode

markdown mode for writing

(use-package markdown-mode
  :ensure t)

pandoc-mode

exporting markdown

(use-package pandoc-mode
  :hook (markdown-mode . pandoc-mode))

LaTeX (AUCTeX, RefTeX)

for working with \LaTeX installed with pacman auctex

;(load "auctex.el" nil t t)
;(load "preview-latex.el" nil t t)
(use-package tex
  :load-path "/usr/share/emacs/site-lisp/auctex/"
  :hook
  (LaTeX-mode . turn-on-reftex)
  (LaTeX-mode . turn-on-auto-fill)
  (LaTeX-mode . prettify-symbols-mode)
  :init
  (setq TeX-auto-save t)
  (setq TeX-parse-self t)
  (setq-default TeX-master nil)
  (setq reftex-plug-into-AUCTeX t))

ispell: spell-checking

(use-package ispell
  :config
  (setq ispell-dictionary "british-ize-w_accents"))

hl-todo

(use-package hl-todo
  :ensure t
  :bind (:map hl-todo-mode-map
              ("C-c k" . hl-todo-previous)
              ("C-c j" . hl-todo-next))
  :hook
  ((LaTeX-mode ess-mode) . hl-todo-mode))

bibtex/ivy-bibtex

reference manager I use it in conjunction with zotero, which generates the .bib files, and org-ref, to insert citations in org files.

(use-package ivy-bibtex
  :ensure t
  :config
  (autoload 'ivy-bibtex "ivy-bibtex" "" t)
  (setq bibtex-completion-pdf-field "file"))

org-ref

(use-package org-ref
  :config
  (setq bibtex-completion-bibliography '("~/Documents/References/PhD.bib")
        bibtex-completion-pdf-field "file"
        bibtex-completion-notes-path "~/Dropbox/Apps/orgzly/referencenotes.org")
  (setq org-ref-default-bibliography '("~/Documents/References/PhD.bib")))

secret directories

These are all the settings that require secret directories, such as my org agenda files and google calendar. They overwrite the settings with “<…>” syntax above.

;; (use-package emacsdirs)
(load "~/.emacs.d/secretdirs.el" t)