You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

266 lines
11 KiB

;;--------------------------------------------------------------------------------------
;; Enable MELPA
;;--------------------------------------------------------------------------------------
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl
(warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
;; This will force any out of date packages to update automatically
(when (not package-archive-contents)
(package-refresh-contents))
;; Load the package.el file
(load-file "~/.emacs.d/package.el")
;;--------------------------------------------------------------------------------------
;; Turn off the startup screen
;;--------------------------------------------------------------------------------------
(setq inhibit-startup-screen t)
;;--------------------------------------------------------------------------------------
;; Display battery life in modeline
;;--------------------------------------------------------------------------------------
(display-battery-mode 1)
;;--------------------------------------------------------------------------------------
;; Always follow symbolic links to version controlled files
;;
;; I prefer this option because I generally only get this message when I edit
;; a dotfile under version control, and repeatedly typing "yes" is annoying.
;;--------------------------------------------------------------------------------------
(setq vc-follow-symlinks t)
;;--------------------------------------------------------------------------------------
;; Enable Org-mode and set agenda files
;;--------------------------------------------------------------------------------------
(require 'org)
;; Stuff all of the org files you want under ~/org and they will be loaded automatically
;; and have their TODO items accessible by typing C-c a t
(setq org-agenda-files '("~/org"))
(setq org-log-done t)
;;--------------------------------------------------------------------------------------
;; Prefer unix style line endings
;;--------------------------------------------------------------------------------------
(set-buffer-file-coding-system 'unix)
;;--------------------------------------------------------------------------------------
;; Enable auto-refresh to keep buffers up to date when git or another program
;; modifies them
;;--------------------------------------------------------------------------------------
(global-auto-revert-mode t)
;;--------------------------------------------------------------------------------------
;; IBuffer configurations (C-x C-b)
;;--------------------------------------------------------------------------------------
(setq ibuffer-saved-filter-groups
'(("default"
("Emacs Configuration" (or (filename . ".emacs.d")
(filename . "init.el")
(filename . "package.el")
(filename . "private.el")
(filename . "emacs.d")))
("Org" (or (mode . org-mode)
(filename . "OrgMode")))
7 years ago
("Magit" (name . "magit"))
("Help" (or (name . "\*Help\*")
(name . "\*Apropos\*")
(name . "\*info\*")))
("Dired" (mode . dired-mode))
;; Dev has groups for all languages you program in
("Dev" (or (mode . cc-mode)
7 years ago
(filename . ".c")
7 years ago
(filename . ".cpp")
(filename . ".hpp")
7 years ago
(filename . ".h")
(filename . ".java")
(filename . ".py")
(filename . ".lisp")
(filename . ".properties")
(filename . ".gradle")
7 years ago
(filename . ".am")
(mode . yaml-mode))
)
("Text" (or (filename . ".csv")
(filename . ".tsv")
(filename . ".txt")
(filename . ".log")
(filename . ".json")))
("Emacs" (or (name . "^\\*scratch\\*$")
(name . "^\\*Messages\\*$")))
("Gnus" (or (mode . message-mode)
(mode . bbdb-mode)
(mode . mail-mode)
(mode . gnus-group-mode)
(mode . gnus-summary-mode)
(mode . gnus-article-mode)
(name . "^\\.bbdb$")
(name . "^\\.newsrc-dribble")))
)))
;; Automatically keep buffers up to date and load the filter
(add-hook 'ibuffer-mode-hook
'(lambda ()
(ibuffer-auto-mode 1)
(ibuffer-switch-to-saved-filter-groups "default")))
;; Disable eager line numbering
(add-hook 'ibuffer-mode-hook 'nolinum)
(setq ibuffer-expert t)
(setq ibuffer-show-empty-filter-groups nil)
;;--------------------------------------------------------------------------------------
;; Default modes
;;--------------------------------------------------------------------------------------
(ivy-mode 1)
;; Enable column numbers
(column-number-mode 1)
;; Enable paredit for lisp
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
(add-hook 'ielm-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
(add-hook 'scheme-mode-hook #'enable-paredit-mode)
(add-hook 'c-mode-hook 'counsel-gtags-mode)
(add-hook 'c++-mode-hook 'counsel-gtags-mode)
(require 'rainbow-delimiters)
(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode)
(add-hook 'lisp-mode-hook 'rainbow-delimiters-mode)
(add-hook 'scheme-mode-hook 'rainbow-delimiters-mode)
(add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode)
;; Only enable aggressive indent on lisp-likes
(add-hook 'emacs-lisp-mode-hook #'aggressive-indent-mode)
(add-hook 'lisp-mode-hook #'aggressive-indent-mode)
(add-hook 'scheme-mode-hook #'aggressive-indent-mode)
(add-hook 'clojure-mode-hook #'aggressive-indent-mode)
5 years ago
;; Slime - requires SBCL to be installed in /usr/local/bin/ (default for the install.sh
;; script)
5 years ago
(setq inferior-lisp-program "sbcl")
5 years ago
(setq slime-contribs '(slime-fancy))
;; Enable semantic for language-aware editing commands
(setq semantic-mode 't)
5 years ago
;;--------------------------------------------------------------------------------------
;; Save hooks
;;--------------------------------------------------------------------------------------
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;;--------------------------------------------------------------------------------------
;; Keybinds
;;--------------------------------------------------------------------------------------
;; <f1> is a mode bind for compile/eval based on language
(global-unset-key (kbd "<f1>"))
(global-unset-key (kbd "<f2>"))
;; Load up swiper search with C-s
(global-set-key "\C-s" 'swiper)
;; Switch windows with M-o
(global-set-key (kbd "M-o") 'other-window)
;; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Lisp Binds ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;; Note: SLIME bindings require slime to be running.
;; Press <f1> in lisp mode to evaluate the buffer in SLIME
(define-key lisp-mode-map (kbd "<f1>") 'slime-eval-buffer)
;; Press <f2> in lisp mode to evaluate the current defun in SLIME.
(define-key lisp-mode-map (kbd "<f2>") 'slime-eval-defun)
;; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(with-eval-after-load 'counsel-gtags
(define-key counsel-gtags-mode-map (kbd "M-t") 'counsel-gtags-find-definition)
(define-key counsel-gtags-mode-map (kbd "M-r") 'counsel-gtags-find-reference)
(define-key counsel-gtags-mode-map (kbd "M-s") 'counsel-gtags-find-symbol)
(define-key counsel-gtags-mode-map (kbd "M-,") 'counsel-gtags-go-backward))
;;--------------------------------------------------------------------------------------
;; Install and load Packages
;;--------------------------------------------------------------------------------------
(load-file "~/.emacs.d/package.el")
(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.
5 years ago
'(lisp-indent-function (quote common-lisp-indent-function))
'(package-selected-packages
(quote
5 years ago
(projectile smex grizzl flycheck-pos-tip flycheck material-theme expand-region wrap-region rainbow-delimiters powerline linum-relative golden-ratio fill-column-indicator autopair exec-path-from-shell ws-butler yaml-mode python-mode protobuf-mode paredit nasm-mode meson-mode markdown-mode magit gradle-mode gitignore-mode feature-mode counsel company-jedi jedi-core company-emacs-eclim company-irony company ag))))
(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.
)
;; Autoload the indent function
(autoload 'common-lisp-indent-function "cl-indent" "Common Lisp indent.")
;;--------------------------------------------------------------------------------------
;; Theming
;;--------------------------------------------------------------------------------------
(load-theme 'material t)
;;--------------------------------------------------------------------------------------
;; SLIME Quicklisp Integration
;;--------------------------------------------------------------------------------------
(when (file-exists-p "~/quicklisp/slime-helper.el")
(load (expand-file-name "~/quicklisp/slime-helper.el"))
(setq inferior-lisp-program "sbcl"))