Skip to content

Instantly share code, notes, and snippets.

Created Oct 28, 2019
What would you like to do?
;;; init.el --- user-init-file -*- lexical-binding: t; -*-
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
;; (package-initialize)
(setq-default lexical-binding t)
(progn ; `startup'
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'display-time-mode) (display-time-mode 1))
;; Save backups, lots, in a different dir.
(setq backup-directory-alist '(("." . "~/.emacs.d/data/backups")))
(setq delete-old-versions -1)
(setq version-control t)
(setq vc-make-backup-files t)
(setq auto-save-file-name-transforms '((".*" "~/.emacs.d/auto-save-list/" t)))
;; History, rememeber much.
(setq savehist-file "~/.emacs.d/data/savehist")
(savehist-mode 1)
(setq history-length t)
(setq history-delete-duplicates t)
(setq savehist-save-minibuffer-history 1)
(setq savehist-additional-variables
;; Yes/No/Maybe.
(fset 'yes-or-no-p 'y-or-n-p)
;; (setq visible-bell t)
(setq ring-bell-function 'ignore)
;;; Language environment
(set-language-environment 'UTF-8)
;;; Truncate lines
(set-default 'truncate-lines t)
;;; Outline mode
;; Collapse subnodes when opening outline file
(add-hook 'outline-mode-hook '(lambda ()
(hide-sublevels 1)))
(defconst emacs-start-time (current-time))
(defvar file-name-handler-alist-old file-name-handler-alist)
(setq file-name-handler-alist nil
message-log-max 16384
gc-cons-threshold 402653184
gc-cons-percentage 0.6
auto-window-vscroll nil)
(add-hook 'after-init-hook
`(lambda ()
(setq file-name-handler-alist file-name-handler-alist-old
gc-cons-threshold 800000
gc-cons-percentage 0.1)
(garbage-collect)) t)
(setq-default indent-tabs-mode nil)
(setq-default show-trailing-whitespace t)
;; Skip the default splash screen.
(setq inhibit-startup-message t)
;; Figure out the current hostname.
(setq hostname (replace-regexp-in-string "\\(^[[:space:]\n]*\\|[[:space:]\n]*$\\)" "" (with-output-to-string (call-process "hostname" nil standard-output))))
;; Set default font
(set-face-attribute 'default nil
:family "Source Code Pro"
:height 110
:weight 'normal
:width 'normal)
;; Goodies manager.
(setq package-enable-at-startup nil)
(setq load-prefer-newer t)
;; Make all commands of the “package” module present.
(require 'package)
;; Speef up start up by not loading any packages at startup.
;; (setq package-enable-at-startup nil)
;; Look at the *Messages* buffer before setting this to nil, then after.
;; Internet repositories for new packages.
(setq package-archives '(("org" . "")
("gnu" . "")
("melpa" . "")
("melpa-stable" . "")
;; Maintainer is AWOL.
;; ("marmalade" . "")
(require 'cask "/usr/share/cask/cask.el")
(require 'use-package)
;; Delight
(use-package delight
:ensure t)
;; Which Key binding help.
(use-package which-key
:demand t
(setq which-key-idle-delay 0.5)))
;; Theme.
(use-package dracula-theme
:load-path "themes"
(load-theme 'dracula t))
;; (use-package ample-theme
;; :init (progn (load-theme 'ample t t)
;; (load-theme 'ample-flat t t)
;; (load-theme 'ample-light t t)
;; (enable-theme 'ample))
;; :defer t
;; :ensure t)
;; Smart modeline
(use-package smart-mode-line
:ensure t
(setq sml/no-confirm-load-theme t)
(setq sml/theme 'dark))
;; Eldoc.
(use-package eldoc
:delight eldoc-mode
(dolist (hook '(emacs-lisp-mode-hook
(add-hook hook 'eldoc-mode)))
;; Lua
(use-package lua-mode
:ensure t
:mode (("\\.lua\\'" . lua-mode)))
;; Haskell
(use-package haskell-mode
:hook (haskell-mode . turn-on-haskell-unicode-input-method)
:hook (haskell-mode . haskell-auto-insert-module-template)
:hook (haskell-mode . turn-on-haskell-doc-mode)
(haskell-indentation-mode nil)
(setq haskell-stylish-on-save t)
(setq haskell-indentation-mode nil)
(define-key haskell-mode-map (kbd "C-c C-c") 'haskell-compile)
(define-key haskell-cabal-mode-map (kbd "C-c C-c") 'haskell-compile)
(setq haskell-compile-cabal-build-command "stack build"))
(use-package haskell-interactive-mode)
(use-package haskell-process)
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
'(haskell-process-suggest-remove-import-lines t)
'(haskell-process-auto-import-loaded-modules t)
'(haskell-process-log t)
'(haskell-tags-on-save t)
'(haskell-process-suggest-remove-import-lines t)
'(haskell-process-suggest-hoogle-imports t)
'(haskell-interactive-types-for-show-ambiguous nil))
(define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload)
(define-key haskell-mode-map (kbd "C-`") 'haskell-interactive-bring)
(define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
(define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
(define-key haskell-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build)
(define-key haskell-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear)
(define-key haskell-mode-map (kbd "C-c c") 'haskell-process-cabal)
(define-key haskell-mode-map (kbd "M-.") 'haskell-mode-jump-to-def)
(define-key haskell-mode-map (kbd "M-.") 'haskell-mode-tag-find)
(use-package intero
:hook (haskell-mode . intero-mode))
;; Lua Mode
(use-package lua-mode)
;; Python Mode
;; (use-package python-mode)
;; Projectile: Manage projects.
(use-package projectile
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(projectile-mode +1)
(setq projectile-project-search-path '("~/Sandbox/"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment