2019-02-26 10:12:57 +00:00
|
|
|
|
;;; init.el --- Summary
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;; Initialization
|
2019-02-20 21:45:17 +00:00
|
|
|
|
;;; Code:
|
2019-02-26 10:12:57 +00:00
|
|
|
|
(require 'package)
|
2019-02-14 19:58:51 +00:00
|
|
|
|
(add-to-list 'package-archives
|
|
|
|
|
'("MELPA" . "https://melpa.org/packages/") t)
|
2018-08-23 19:41:28 +00:00
|
|
|
|
|
|
|
|
|
(package-initialize)
|
|
|
|
|
|
|
|
|
|
|
2019-02-26 10:25:08 +00:00
|
|
|
|
;;; Custom
|
2018-08-23 19:41:28 +00:00
|
|
|
|
|
|
|
|
|
(custom-set-variables
|
|
|
|
|
;; custom-set-variables was added by Custom.
|
|
|
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
|
|
|
;; Your init file should contain only one such instance.
|
|
|
|
|
;; If there is more than one, they won't work right.
|
|
|
|
|
'(agda2-program-args nil)
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(auth-sources (quote ("~/.authinfo.gpg" "~/.authinfo" "~/.netrc")))
|
2018-08-23 19:41:28 +00:00
|
|
|
|
'(blink-cursor-mode nil)
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(column-number-mode t)
|
2019-04-07 12:30:21 +00:00
|
|
|
|
'(company-tooltip-minimum-width 35)
|
2019-05-14 21:56:08 +00:00
|
|
|
|
'(css-indent-offset 2)
|
2019-04-07 12:30:21 +00:00
|
|
|
|
'(custom-safe-themes
|
|
|
|
|
(quote
|
2019-05-15 00:02:42 +00:00
|
|
|
|
("aa81baddda211ffab84a5dc68750ac519d4841be63907a6b5de0cd72e631b172" "c91a5bf65b3f79ab28ab350b1d16c24d8b8bc1201e9c6c2106a60f98bceae754" default)))
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(delete-selection-mode t)
|
|
|
|
|
'(dired-isearch-filenames t)
|
|
|
|
|
'(display-buffer-alist
|
|
|
|
|
(quote
|
2019-04-30 07:10:44 +00:00
|
|
|
|
(("*Man*" display-buffer-same-window)
|
|
|
|
|
("*Buffer List*" display-buffer-same-window))))
|
2018-12-02 20:58:20 +00:00
|
|
|
|
'(echo-keystrokes 1e-10)
|
2019-03-26 16:06:20 +00:00
|
|
|
|
'(erc-autojoin-channels-alist (quote (("irc.freenode.net" "#haskell" "#data.coop"))))
|
|
|
|
|
'(erc-autojoin-mode t)
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(erc-nick "fredefox")
|
2019-03-26 16:06:20 +00:00
|
|
|
|
'(erc-port 6667)
|
|
|
|
|
'(erc-prompt-for-password nil)
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(erc-server "irc.freenode.net")
|
2019-04-07 12:30:21 +00:00
|
|
|
|
'(exec-path-from-shell-check-startup-files nil)
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(flycheck-emacs-lisp-load-path (quote inherit))
|
2019-05-14 21:56:08 +00:00
|
|
|
|
'(flycheck-ghc-language-extensions haskell-language-extensions)
|
|
|
|
|
'(flycheck-hlint-language-extensions haskell-language-extensions)
|
2019-04-07 12:30:21 +00:00
|
|
|
|
'(global-company-mode t)
|
2019-02-02 12:27:42 +00:00
|
|
|
|
'(haskell-indentation-where-post-offset 0)
|
|
|
|
|
'(haskell-indentation-where-pre-offset 0)
|
2019-05-14 21:56:08 +00:00
|
|
|
|
'(haskell-language-extensions
|
|
|
|
|
(quote
|
|
|
|
|
("UnicodeSyntax" "TypeApplications" "OverloadedStrings" "LambdaCase" "StandaloneDeriving" "DerivingStrategies" "DeriveGeneric" "DeriveAnyClass" "KindSignatures" "DerivingVia" "ConstraintKinds" "FlexibleContexts" "GeneralizedNewtypeDeriving")))
|
2019-02-14 19:58:51 +00:00
|
|
|
|
'(haskell-tags-on-save t)
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(indent-tabs-mode nil)
|
2019-02-16 19:06:45 +00:00
|
|
|
|
'(initial-scratch-message nil)
|
2019-02-02 12:27:42 +00:00
|
|
|
|
'(js-indent-level 2)
|
2019-05-14 21:56:08 +00:00
|
|
|
|
'(js2-basic-offset 2)
|
2019-02-14 19:58:51 +00:00
|
|
|
|
'(line-move-visual nil)
|
2019-02-26 10:25:08 +00:00
|
|
|
|
'(magit-display-buffer-function (quote magit-display-buffer-same-window-except-diff-v1))
|
|
|
|
|
'(magit-popup-display-buffer-action nil)
|
2019-02-02 12:27:42 +00:00
|
|
|
|
'(markdown-command "pandoc -t html")
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(menu-bar-mode nil)
|
|
|
|
|
'(message-send-mail-function (quote smtpmail-send-it))
|
2019-02-26 10:25:08 +00:00
|
|
|
|
'(org-agenda-files "~/.config/orgmode/agenda_files")
|
2018-08-23 19:41:28 +00:00
|
|
|
|
'(package-selected-packages
|
|
|
|
|
(quote
|
2019-05-14 21:56:08 +00:00
|
|
|
|
(prettier-js quelpa typescript-mode visual-fill-column ag ripgrep fill-column-indicator rjsx-mode image+ company org-jira which-key flycheck es-mode lsp-haskell forge projectile exec-path-from-shell lsp-ui lsp-mode editorconfig purescript-mode markdown-mode+ ssh-agency dash yaml-mode restart-emacs markdown-mode magit helm haskell-mode haml-mode form-feed dashboard)))
|
2019-04-07 12:30:21 +00:00
|
|
|
|
'(projectile-globally-ignored-directories
|
|
|
|
|
(quote
|
|
|
|
|
(".idea" ".ensime_cache" ".eunit" ".git" ".hg" ".fslckout" "_FOSSIL_" ".bzr" "_darcs" ".tox" ".svn" ".stack-work" "node_modules")))
|
|
|
|
|
'(projectile-globally-ignored-files (quote ("/TAGS" "/vendor" "/.bundle" "/node_modules")))
|
2019-02-14 19:58:51 +00:00
|
|
|
|
'(projectile-mode t nil (projectile))
|
2019-05-08 07:05:23 +00:00
|
|
|
|
'(projectile-project-search-path (quote ("~/git")))
|
2019-03-27 15:12:50 +00:00
|
|
|
|
'(purescript-mode-hook (quote (turn-on-purescript-indentation)))
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(recentf-max-menu-items 255)
|
|
|
|
|
'(recentf-mode t)
|
2019-05-08 07:05:23 +00:00
|
|
|
|
'(ruby-align-chained-calls t)
|
2019-05-14 21:56:08 +00:00
|
|
|
|
'(ruby-align-to-stmt-keywords t)
|
|
|
|
|
'(ruby-chained-calls t)
|
2019-03-27 15:12:50 +00:00
|
|
|
|
'(ruby-insert-encoding-magic-comment nil)
|
2019-04-30 07:10:44 +00:00
|
|
|
|
'(safe-local-variable-values
|
|
|
|
|
(quote
|
|
|
|
|
((git-commit-major-mode . git-commit-elisp-text-mode))))
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(scroll-bar-mode nil)
|
|
|
|
|
'(scroll-conservatively 101)
|
2019-03-26 16:06:20 +00:00
|
|
|
|
'(scroll-margin 0)
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(select-enable-clipboard t)
|
|
|
|
|
'(send-mail-function (quote smtpmail-send-it))
|
2019-03-27 08:26:33 +00:00
|
|
|
|
'(set-mark-command-repeat-pop t)
|
2019-03-27 15:12:50 +00:00
|
|
|
|
'(sgml-basic-offset 2)
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(show-paren-mode t)
|
2019-02-16 19:06:45 +00:00
|
|
|
|
'(shr-width 80)
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(split-window-keep-point nil)
|
2019-03-27 15:12:50 +00:00
|
|
|
|
'(tags-add-tables t)
|
2019-02-14 19:58:51 +00:00
|
|
|
|
'(temp-buffer-resize-mode nil)
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(tool-bar-mode nil)
|
2019-02-14 19:58:51 +00:00
|
|
|
|
'(vc-follow-symlinks nil)
|
2019-02-20 21:45:17 +00:00
|
|
|
|
'(window-combination-resize t)
|
|
|
|
|
'(window-resize-pixelwise t))
|
2018-08-23 19:41:28 +00:00
|
|
|
|
|
2019-05-14 21:56:08 +00:00
|
|
|
|
|
|
|
|
|
;;;; MAC setup
|
|
|
|
|
|
|
|
|
|
(defun set-xdg-variables ()
|
|
|
|
|
"Set the XDG base directory variables to sane defaults."
|
|
|
|
|
(setenv "XDG_CONFIG_HOME" (substitute-in-file-name "$HOME/.config"))
|
|
|
|
|
(setenv "XDG_DATA_HOME" (substitute-in-file-name "$HOME/.local/share"))
|
|
|
|
|
(setenv "XDG_CACHE_HOME" (substitute-in-file-name "$HOME/.cache")))
|
|
|
|
|
|
2019-05-14 23:06:58 +00:00
|
|
|
|
(defun load-monokai ()
|
|
|
|
|
"Load the monokai dark theme."
|
|
|
|
|
(add-to-list 'custom-theme-load-path
|
|
|
|
|
(substitute-in-file-name
|
|
|
|
|
"$XDG_CONFIG_HOME/emacs/lisp/monokai-dark-theme/"))
|
|
|
|
|
(load-theme 'monokai-dark))
|
|
|
|
|
|
2019-05-14 21:56:08 +00:00
|
|
|
|
(defun x11-shim ()
|
|
|
|
|
"Replace some behaviour otherwise handled by other system services."
|
|
|
|
|
;; (load-theme 'monokai-dark)
|
|
|
|
|
;; TODO Why is this not handled by the magic with the load-path above?
|
|
|
|
|
(set-xdg-variables)
|
2019-05-14 23:06:58 +00:00
|
|
|
|
(load-monokai))
|
2019-05-14 21:56:08 +00:00
|
|
|
|
|
|
|
|
|
;;; Needed on MAC because we're not using Xresources :(
|
|
|
|
|
(if (not (eq window-system 'x))
|
|
|
|
|
(x11-shim))
|
|
|
|
|
|
2019-02-26 10:25:08 +00:00
|
|
|
|
|
2019-02-20 21:45:17 +00:00
|
|
|
|
;;;; Additional packages
|
2019-04-30 07:10:44 +00:00
|
|
|
|
;;;; Maybe we should use qelpa to mangage these.
|
2019-05-15 00:02:42 +00:00
|
|
|
|
(defvar extra-libs-root (substitute-in-file-name "$XDG_CONFIG_HOME/emacs/lisp/"))
|
2019-02-20 21:45:17 +00:00
|
|
|
|
|
|
|
|
|
(defvar additional-packages
|
2019-05-15 00:02:42 +00:00
|
|
|
|
'((agda2-mode . "agda-mode/")
|
|
|
|
|
(psc-ide . "psc-ide-emacs/")
|
|
|
|
|
;; (org-jira . "org-jira/")
|
|
|
|
|
(jira . "jira/")
|
|
|
|
|
(spark . "spark/")
|
|
|
|
|
(chruby . "chruby/")))
|
|
|
|
|
|
|
|
|
|
(defun load-additional-packages ()
|
|
|
|
|
"Load the additional packages as specified by additional-packages."
|
|
|
|
|
(dolist (spec additional-packages)
|
|
|
|
|
(let* ((package (car spec))
|
|
|
|
|
(package-path (cdr spec))
|
|
|
|
|
(path (concat extra-libs-root package-path)))
|
|
|
|
|
(add-to-list 'load-path path)
|
|
|
|
|
(require package))))
|
|
|
|
|
|
|
|
|
|
(load-additional-packages)
|
|
|
|
|
|
|
|
|
|
(defun load-additional-themes ()
|
|
|
|
|
"Load additional themes."
|
2019-05-23 18:16:30 +00:00
|
|
|
|
(add-to-list 'custom-theme-load-path (concat extra-libs-root "inheritance-theme/"))
|
2019-05-15 00:02:42 +00:00
|
|
|
|
(load-theme 'inheritance))
|
|
|
|
|
|
|
|
|
|
(load-additional-themes)
|
2018-08-23 19:41:28 +00:00
|
|
|
|
|
2019-02-16 19:06:45 +00:00
|
|
|
|
;; (require 'lsp)
|
|
|
|
|
;; Shame! `lsp-ui` is emitting:
|
|
|
|
|
;; Eager macro-expansion failure: (wrong-type-argument listp kind)
|
|
|
|
|
;; (require 'lsp-ui)
|
|
|
|
|
;; (require 'lsp-haskell)
|
|
|
|
|
;; (add-hook 'lsp-mode-hook 'lsp-ui-mode)
|
|
|
|
|
;; (add-hook 'haskell-mode-hook #'lsp)
|
|
|
|
|
|
2019-05-08 07:28:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;; Faces
|
|
|
|
|
|
|
|
|
|
(custom-set-faces
|
|
|
|
|
;; custom-set-faces was added by Custom.
|
|
|
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
|
|
|
;; Your init file should contain only one such instance.
|
|
|
|
|
;; If there is more than one, they won't work right.
|
2019-05-14 21:56:08 +00:00
|
|
|
|
'(font-lock-comment-face ((t (:foreground "chocolate1"))))
|
|
|
|
|
'(region ((t (:background "#285b89"))))
|
|
|
|
|
'(success ((t (:foreground "Green3" :weight bold)))))
|
2019-05-08 07:28:28 +00:00
|
|
|
|
|
2018-08-23 19:41:28 +00:00
|
|
|
|
|
|
|
|
|
;;;; Captain Hook
|
|
|
|
|
|
2019-02-20 21:45:17 +00:00
|
|
|
|
(global-set-key (kbd "C-x C-r") 'recentf-open-files)
|
2019-04-07 12:30:21 +00:00
|
|
|
|
(global-unset-key (kbd "s-q"))
|
|
|
|
|
|
2019-03-26 16:06:20 +00:00
|
|
|
|
(global-set-key (kbd "C-x r v") 'revert-buffer)
|
2019-02-20 21:45:17 +00:00
|
|
|
|
|
|
|
|
|
(add-hook 'text-mode-hook
|
2019-03-27 15:12:50 +00:00
|
|
|
|
(lambda ()
|
2019-05-08 07:05:23 +00:00
|
|
|
|
(toggle-word-wrap t)
|
2019-03-27 15:12:50 +00:00
|
|
|
|
(recentf-mode)
|
|
|
|
|
(flyspell-mode)))
|
2019-02-20 21:45:17 +00:00
|
|
|
|
|
2019-05-08 07:05:23 +00:00
|
|
|
|
(add-hook 'html-mode-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(flyspell-mode -1)))
|
|
|
|
|
|
2019-02-20 21:45:17 +00:00
|
|
|
|
(add-hook 'prog-mode-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(form-feed-mode)
|
|
|
|
|
(flycheck-mode)))
|
2018-08-23 19:41:28 +00:00
|
|
|
|
;; I think this breaks e.g. the color-picker
|
|
|
|
|
; (add-hook 'text-mode-hook 'form-feed-mode)
|
2019-05-08 07:05:23 +00:00
|
|
|
|
(add-hook 'haskell-mode-hook (lambda ()
|
|
|
|
|
(subword-mode t)
|
|
|
|
|
(interactive-haskell-mode t)))
|
|
|
|
|
(add-hook 'ruby-mode-hook (lambda () (subword-mode t)))
|
2018-08-23 19:41:28 +00:00
|
|
|
|
;; global-company-mode keeps recentering the point on the screen for
|
|
|
|
|
;; some reason
|
|
|
|
|
; (add-hook 'after-init-hook 'global-company-mode)
|
|
|
|
|
;; (add-hook 'after-init-hook 'flycheck-mode)
|
|
|
|
|
|
|
|
|
|
;; ;; (require 'haskell-unicode-input-method)
|
|
|
|
|
|
2019-05-14 21:56:08 +00:00
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
|
|
|
|
|
|
2018-08-23 19:41:28 +00:00
|
|
|
|
|
2019-02-20 21:45:17 +00:00
|
|
|
|
;;;; Projectile
|
2019-02-26 10:12:57 +00:00
|
|
|
|
(require 'projectile)
|
2018-08-23 19:41:28 +00:00
|
|
|
|
|
2019-02-20 21:45:17 +00:00
|
|
|
|
(projectile-mode +1)
|
2019-02-14 19:58:51 +00:00
|
|
|
|
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
|
2018-08-23 19:41:28 +00:00
|
|
|
|
|
2019-02-26 10:12:57 +00:00
|
|
|
|
|
2018-08-23 19:41:28 +00:00
|
|
|
|
;;;; Dashboard
|
|
|
|
|
|
2019-02-20 21:45:17 +00:00
|
|
|
|
(require 'dashboard)
|
2018-08-23 19:41:28 +00:00
|
|
|
|
(dashboard-setup-startup-hook)
|
2019-05-08 07:05:23 +00:00
|
|
|
|
(setq dashboard-startup-banner (substitute-in-file-name "$XDG_DATA_HOME/emacs/banner.png"))
|
2019-02-20 21:45:17 +00:00
|
|
|
|
(setq dashboard-items '((recents . 40)))
|
|
|
|
|
|
|
|
|
|
;;;; Miscelaneous
|
2019-02-26 10:12:57 +00:00
|
|
|
|
(setq-default indent-tabs-mode nil)
|
2018-08-23 19:41:28 +00:00
|
|
|
|
|
|
|
|
|
(setq ring-bell-function
|
|
|
|
|
(lambda ()
|
2019-02-20 21:45:17 +00:00
|
|
|
|
(let ((orig-bg (face-background 'mode-line)))
|
|
|
|
|
(set-face-background 'mode-line (face-attribute 'error :foreground))
|
2018-08-23 19:41:28 +00:00
|
|
|
|
(run-with-idle-timer 0.1 nil
|
2019-02-20 21:45:17 +00:00
|
|
|
|
(lambda (bg)
|
|
|
|
|
(set-face-background 'mode-line bg)) orig-bg))))
|
2018-08-23 19:41:28 +00:00
|
|
|
|
|
|
|
|
|
(global-unset-key (kbd "C-z"))
|
2018-12-02 20:58:20 +00:00
|
|
|
|
|
2019-02-20 21:45:17 +00:00
|
|
|
|
;;;; Magit
|
2019-04-30 07:10:44 +00:00
|
|
|
|
(require 'magit)
|
2019-05-08 07:05:23 +00:00
|
|
|
|
(global-magit-file-mode t)
|
2019-04-30 07:10:44 +00:00
|
|
|
|
(global-set-key (kbd "C-c g g") 'magit-dispatch)
|
|
|
|
|
(global-set-key (kbd "C-c g s") 'magit-status)
|
|
|
|
|
(global-set-key (kbd "C-c g f") 'magit-file-dispatch)
|
|
|
|
|
(global-set-key (kbd "C-c g b") 'magit-blame)
|
2018-08-23 19:41:28 +00:00
|
|
|
|
|
2019-04-07 21:25:37 +00:00
|
|
|
|
(require 'haskell)
|
2019-02-26 10:12:57 +00:00
|
|
|
|
|
2019-03-27 15:12:50 +00:00
|
|
|
|
;;;; Ruby
|
|
|
|
|
(require 'ruby-mode)
|
|
|
|
|
|
2019-04-07 12:30:21 +00:00
|
|
|
|
;; I'm confused about the less worse option here. I think the best
|
|
|
|
|
;; option is to use smie (the default).
|
2019-05-08 07:05:23 +00:00
|
|
|
|
(setq ruby-use-smie t)
|
2019-04-07 12:30:21 +00:00
|
|
|
|
|
2019-03-27 15:12:50 +00:00
|
|
|
|
(setq ruby-deep-indent-paren nil)
|
|
|
|
|
(setq ruby-align-to-stmt-keywords t)
|
|
|
|
|
|
|
|
|
|
(setq select-enable-clipboard t)
|
|
|
|
|
|
|
|
|
|
(add-hook 'ruby-mode-hook '(lambda ()
|
|
|
|
|
(global-set-key (kbd "C-c C-M-n") 'ruby-forward-sexp)
|
|
|
|
|
(global-set-key (kbd "C-c C-M-p") 'ruby-backward-sexp)))
|
|
|
|
|
|
2019-05-14 23:06:58 +00:00
|
|
|
|
(defun sql-beautify-region (beg end)
|
|
|
|
|
"Beautify SQL in region between BEG and END.
|
2019-03-27 15:12:50 +00:00
|
|
|
|
Dependency:
|
|
|
|
|
npm i -g sql-formatter-cli"
|
2019-05-14 23:06:58 +00:00
|
|
|
|
(interactive "r")
|
|
|
|
|
(save-excursion
|
|
|
|
|
(shell-command-on-region beg end "sql-formatter-cli" nil t)))
|
|
|
|
|
|
|
|
|
|
(defun sql-beautify-buffer ()
|
2019-03-27 15:12:50 +00:00
|
|
|
|
"Beautify SQL in buffer."
|
|
|
|
|
(interactive)
|
|
|
|
|
(sql-beautify-region (point-min) (point-max)))
|
2019-05-14 23:06:58 +00:00
|
|
|
|
|
|
|
|
|
(add-hook 'sql-mode-hook '(lambda ()
|
|
|
|
|
;; beautify region or buffer
|
|
|
|
|
(local-set-key (kbd "C-c t") 'sql-beautify-region)))
|
2019-03-27 15:12:50 +00:00
|
|
|
|
(put 'dired-find-alternate-file 'disabled nil)
|
2019-02-26 10:12:57 +00:00
|
|
|
|
|
|
|
|
|
;; org-jira [https://github.com/ahungry/org-jira]
|
2019-05-14 23:06:58 +00:00
|
|
|
|
;; (require 'org-jira)
|
|
|
|
|
;; (setq jiralib-url "https://zendesk.atlassian.net")
|
2019-02-26 10:12:57 +00:00
|
|
|
|
|
2019-03-27 15:12:50 +00:00
|
|
|
|
;;; Jira
|
2019-05-14 23:06:58 +00:00
|
|
|
|
;; (require 'jira)
|
2019-04-30 07:10:44 +00:00
|
|
|
|
(global-set-key (kbd "C-c j") 'jira)
|
2019-02-26 10:12:57 +00:00
|
|
|
|
|
2019-03-27 15:12:50 +00:00
|
|
|
|
(put 'upcase-region 'disabled nil)
|
|
|
|
|
(put 'downcase-region 'disabled nil)
|
2019-04-07 12:30:21 +00:00
|
|
|
|
(put 'set-goal-column 'disabled nil)
|
2019-05-14 23:06:58 +00:00
|
|
|
|
(when (memq window-system '(mac))
|
2019-03-27 15:12:50 +00:00
|
|
|
|
(exec-path-from-shell-initialize))
|
|
|
|
|
|
2019-02-20 21:45:17 +00:00
|
|
|
|
;;; init.el ends here
|