Configuration_Files/misc/init.el

237 lines
6.4 KiB
EmacsLisp
Raw Normal View History

2021-11-15 22:53:48 +00:00
;;;; package --- Summary
2021-11-15 22:53:48 +00:00
;;;; Commentary:
2021-11-15 22:53:48 +00:00
;;;; Index:
2021-11-15 22:53:48 +00:00
;;; Section One - Packageless Configurations
;;; Subsection 1.1 - GUI
;;; Subsection 1.2 - Functions and Bindings
;;; Subsection 1.3 - Backend
;;;
;;; Section Two - Package-required Configurations
;;; Subsection 2.1 - GUI
;;; Subsection 2.2 - Functions and Bindings
;;; Subsection 2.3 - Backend
;;;; Code:
;; Section One
;; Subsection 1.1
;; Default theme.
;(load-theme `solarized-light t)
;; Fonts and faces.
;;(set-frame-font "Iosevka-13")
(custom-set-faces
'(default ((t (:family "Iosevka" :foundry "UKWN" :slant normal :weight normal :height 120 :width normal)))))
;(set-frame-font "Iosevka Regular-13" nil t)
2021-11-15 22:53:48 +00:00
;; y or n is fine
(fset 'yes-or-no-p 'y-or-n-p)
;; Inhibit the GNU information startup dialog.
(setq inhibit-startup-message t)
;; Set the default geometry of the frame in GUI mode.
(setq default-frame-alist
'((top . 200) (left . 400)
(width . 80) (height . 25)))
2021-11-15 22:53:48 +00:00
;; Hide the toolbar in GUI mode.
(tool-bar-mode 0)
2021-11-15 22:53:48 +00:00
;; Hide the scrollbar.
(scroll-bar-mode 0)
2021-11-15 22:53:48 +00:00
;; Set fringe style.
(set-fringe-mode '(0 . 0))
2021-11-15 22:53:48 +00:00
;; Enable frame dividers.
(setq window-divider-default-places t)
(window-divider-mode 1)
;; Subsection 1.2
;; Allow for multiple Wowsers.
(defun xah-rename-eww-hook ()
"Rename eww buffers on the fly."
(rename-buffer "eww" t))
(add-hook 'eww-mode-hook #' xah-rename-eww-hook)
;; Kill the current buffer.
(global-set-key (kbd "C-x k") 'kill-this-buffer)
;; Subsection 1.3
;; Set the Web Wowser as the default in-Emacs browser.
(eval-after-load "eww"
`(setq
browse-url-browser-function 'eww-browse-url
shr-use-fonts nil
shr-use-colors nil
shr-indentation 2
eww-search-prefix "https://duckduckgo.com/lite"))
;; Byte-compile ELisp when saving.
(auto-compile-on-save-mode t)
;; Increase the garbage collectors threshold.
(setq gc-cons-threshold 100000000)
(setq large-file-warning-threshold 1000000000)
2021-11-15 22:53:48 +00:00
;; Store temporary files in a backup directory.
(setq temporary-file-directory "~/.config/emacs/.backup/temp/")
(progn (defvar auto-save-directory) (setq auto-save-directory "~/.config/emacs/.backup/autosave/"))
(setq tramp-auto-save-directory "~/.config/emacs/.backup/autosave/")
(make-directory temporary-file-directory t)
(make-directory auto-save-directory t)
(setq auto-save-file-name-transforms
2021-11-15 22:53:48 +00:00
`(("\\(?:[^/]*/\\)*\\(.*\\)" ,(concat auto-save-directory "\\1") t)))
2021-11-15 22:53:48 +00:00
;; Automatically reload files as needed.
(global-auto-revert-mode t)
2021-11-15 22:53:48 +00:00
;; Remove unneeded whitespace when exiting.
(add-hook 'before-save-hook 'whitespace-cleanup)
2021-11-15 22:53:48 +00:00
;; Subsection 2.1
2021-11-15 22:53:48 +00:00
;; Golden Ratio resizes the current buffer according to the golden ratio.
(use-package golden-ratio
:config
(golden-ratio-mode 1))
2021-11-15 22:53:48 +00:00
;; Powerline allows for modeline tweaks.
(use-package powerline
:demand
:config
(powerline-nano-theme))
2021-11-15 22:53:48 +00:00
;; Popwin forces informational, educational, fantasticational buffers into a temporary window. Thank god.
(use-package popwin
:demand
:config
;; Meta commands
(setq anything-samewindow nil)
(push `("*anything*" :height 20) popwin:special-display-config)
(push `("*Completions*" :height 20) popwin:special-display-config)
(push `("*Messages*" :height 20) popwin:special-display-config)
(push `("*compilation*" :height 20) popwin:special-display-config)
(push `("*Help*" :height 20) popwin:special-display-config)
(push `("*Warnings*" :height 20) popwin:special-display-config)
(push `("*Backtrace*" :height 20) popwin:special-display-config)
(push `("*Buffer List*" :height 20) popwin:special-display-config)
; SLIME commands
(push "*slime-apropos*" popwin:special-display-config)
(push "*slime-macroexpansion*" popwin:special-display-config)
(push "*slime-description*" popwin:special-display-config)
(push '("*slime-compilation*" :noselect t)
popwin:special-display-config)
(push "*slime-xref*" popwin:special-display-config)
(push '(sldb-mode :stick t) popwin:special-display-config)
(push 'slime-repl-mode popwin:special-display-config)
(push 'slime-connection-list-mode popwin:special-display-config)
(popwin-mode 1))
2021-11-15 22:53:48 +00:00
;; Subsection 2.2
2021-11-15 22:53:48 +00:00
;; Allow us to easily get around using the Ace packages.
(use-package ace-window
:demand
:config
2021-11-15 22:53:48 +00:00
(global-set-key (kbd "M-o") `ace-window))
2021-11-15 22:53:48 +00:00
(use-package ace-jump-mode
:demand
:config
2021-11-15 22:53:48 +00:00
(global-set-key (kbd "C-c SPC") 'ace-jump-mode))
2021-11-15 22:53:48 +00:00
(use-package ace-link
:demand
:config
(eval-after-load "eww"
`(define-key eww-mode-map (kbd "f") 'ace-link)))
2021-11-15 22:53:48 +00:00
;; Add SLY, a Lisp REPL.
(use-package sly
:config
(setq inferior-lisp-program "sbcl"))
;; Configure the fuzzy-pattern matching engine, Helm
(use-package helm
2021-11-15 22:53:48 +00:00
:demand
:ensure t
:bind
:config
(require 'helm-config)
(helm-mode 1)
(setq helm-split-window-inside-p t
2021-11-15 22:53:48 +00:00
helm-move-to-line-cycle-in-source t)
(setq helm-autoresize-max-height 0)
(setq helm-autoresize-min-height 20)
(helm-autoresize-mode 1)
(define-key helm-map (kbd "<tab>")
`helm-execute-persistent-action)
(define-key helm-map (kbd "C-i")
'helm-execute-persistent-action)
(define-key helm-map (kbd "C-z")
2021-11-15 22:53:48 +00:00
`helm-select-action)
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "M-y") 'helm-show-kill-ring)
(global-set-key (kbd "C-x b") 'helm-mini)
(setq helm-buffers-fuzzy-matching t
helm-recentf-fuzzy-match t)
2021-11-15 22:53:48 +00:00
(global-set-key (kbd "C-x C-f") 'helm-find-files) ; Set Helm up to provide meta-x suggestions and others.
(defun pl/helm-alive-p () "Prevent golden-ratio from interefering with Helm."
(if (boundp 'helm-alive-p)
(symbol-value 'helm-alive-p)))
2021-11-15 22:53:48 +00:00
(add-to-list 'golden-ratio-inhibit-functions 'pl/helm-alive-p))
;; Add Helm support to the web wowser
(use-package helm-eww)
2021-11-15 22:53:48 +00:00
;; Add on-the-fly syntax linting
(use-package flycheck
:demand
:config
(add-hook 'after-init-hook #'global-flycheck-mode))
2021-11-15 22:53:48 +00:00
;; Integrate Helm recommendations and Flycheck linting
(use-package helm-flycheck
:demand
:config
2021-11-15 22:53:48 +00:00
(eval-after-load 'flycheck
'(define-key flycheck-mode-map (kbd "C-c ! h") 'helm-flycheck)))
2021-11-15 22:53:48 +00:00
;; Add an SRFI browser.
(use-package srfi)
2021-11-15 22:53:48 +00:00
;; Enable development features in certain modes.
(defvar proghook-active 0)
2021-11-15 22:53:48 +00:00
(defun proghook () "Function for prog-mode hook."
(display-line-numbers-mode 'toggle)
(semantic-mode 'toggle)
(flycheck-mode 'toggle)
(electric-pair-mode 'toggle)
(electric-quote-mode 'toggle)
(electric-indent-mode 'toggle)
(ws-butler-mode 'toggle)
(context-coloring-mode 'toggle))
(add-hook 'prog-mode-hook 'proghook)
2021-11-15 22:53:48 +00:00
(provide 'init)
;;; init.el ends here