dotfiles/.emacs.d/init.el

164 lines
5.5 KiB
EmacsLisp

;; Environmental setup
(add-to-list 'exec-path (expand-file-name "~/bin"))
(add-to-list 'exec-path (expand-file-name "~/.cargo/bin"))
(add-to-list 'exec-path (expand-file-name "/usr/local/bin"))
(add-to-list 'exec-path (expand-file-name "~/lib/go/bin"))
(add-to-list 'exec-path (expand-file-name "/opt/brew/bin"))
(add-to-list 'exec-path (expand-file-name "~/sandbox/apps/golang/bin"))
(setenv "PATH" (concat (getenv "PATH") ":" (expand-file-name "/usr/local/bin")))
(setenv "PATH" (concat (getenv "PATH") ":" (expand-file-name "~/.cargo/bin")))
(setenv "PATH" (concat (getenv "PATH") ":" (expand-file-name "~/lib/go/bin")))
(setenv "PATH" (concat (getenv "PATH") ":" (expand-file-name "~/sandbox/apps/golang/bin")))
;; Code Paths
(add-to-list 'load-path (expand-file-name "~/.emacs.d/site-lisp/"))
;(load "folding" 'nomessage 'noerror)
;(folding-mode-add-find-file-hook)
; Autocomplete setup
; TODO(jwall): get rid of that annoying check out question
; TODO(jwall): I might already need to enforce order of load for this
; stuff. (that was quick)
; Modularized config stuff
(defvar jaw:config-dir (expand-file-name "~/.emacs.d/conf.d")
"My config parts directory location.")
(defun jaw:load-confs ()
"Load Jeremy's config file parts"
(let ((files (sort (directory-files jaw:config-dir) 'string<)))
(while files
(setq file (car files)
files (cdr files))
(cond ((string-match ".*\.#[^/]+\.el$" file)
nil)
((string-match ".*\.elc?$" file)
(condition-case nil
(load-file (concat jaw:config-dir "/" file))
(error nil)))))))
(defun jwall:clean-backups ()
(interactive)
(message "Deleting old backup files...")
(let ((week (* 60 60 24 7))
(current (float-time (current-time))))
(dolist (file (directory-files temporary-file-directory t))
(when
(> (- current (float-time (fifth (file-attributes file))))
week)
(message file)
(delete-file file)))))
;(jwall:clean-backups)
(require 'package)
(package-initialize)
(add-hook 'after-init-hook
(lambda ()
(message "Finishing initialization")
(jaw:load-confs)
;(set-frame-font "Hack")
;(require 'smex)
;(smex-initialize)
(set-face-attribute 'default nil :height 120)
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
; TODO(jwall): move this to ido file
(require 'ido)
(setq ido-enable-flex-matching t)
(ido-mode t)
(defvar jwall:ido-flex-fuzzy-limit (* 2000 5))
(defadvice ido-set-matches-1 (around my-ido-set-matches-1 activate)
(let ((ido-enable-flex-matching
(< (* (length (ad-get-arg 0)) (length ido-text))
jwall:ido-flex-fuzzy-limit)))
ad-do-it))
(setq vc-handled-backends nil)
; These have to be at the end so they override everything else
; global editing settings
(global-set-key (kbd "RET") 'newline-and-indent)
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil)
;(global-auto-revert-mode t)
(setq shell-prompt-pattern
"^[^$\n]*$ *$")
;(setq tramp-debug-buffer t)
(global-set-key [(meta r)] 'smex)
(global-set-key (kbd "M-R") 'smex-major-mode-commands)
(global-set-key [(alt r)] 'smex)
(global-set-key (kbd "A-R") 'smex-major-mode-commands)
(require 'whitespace)
(setq whitespace-line-column 80)
(setq whitespace-style '(face empty tabs lines-tail trailing))
;(global-whitespace-mode t)
(setenv "PAGER" "/bin/cat")
; conditional server start when emacs is started.
(condition-case nil
(if server-process
(message "Server already started"))
(error (server-start)))
))
(tool-bar-mode 0)
(scroll-bar-mode 0)
;; scroll one line at a time (less "jumpy" than defaults)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(setq scroll-step 1) ;; keyboard scroll one line at a time
(setq inhibit-startup-screen t)
(defun jwall:prog-mode-hook ()
(hs-minor-mode))
;; Set up some default minor modes.
(add-hook 'prog-mode-hook #'jwall:prog-mode-hook)
;; use LaTeX syntax for intering unicode codepoints.
(setq-default default-input-method "TeX")
;; Show column numbers
(setq-default column-number-mode t)
; Prevent graphical dialogs
(setq-default use-dialog-box nil)
(add-to-list `auto-mode-alist '("\\.bzl\\'" . python-mode))
(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.
'(org-agenda-files (quote ("~/Dropbox/Notes/personal.org")))
'(package-selected-packages
(quote
(lua-mode lsp-rust lsp-mode hcl-mode typescript javap-mode tex-math-preview swank-clojure melpa json highlight-80+ flymake clojure-test-mode yaml-mode unfill slime-repl scad-mode racer paredit paradox org-bullets omnisharp nix-mode neotree multi-web-mode monky markdown-mode+ magit log4j-mode jtags js2-mode helm go-rename go-eldoc flycheck-rust evil ess company-go color-theme clojure-mode-extra-font-locking cl-lib-highlight cl-generic)))
'(paradox-github-token t))
(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.
)