diff --git a/user/configdir/emacs/init.el b/user/configdir/emacs/init.el index f1f8984..e968b1b 100644 --- a/user/configdir/emacs/init.el +++ b/user/configdir/emacs/init.el @@ -18,15 +18,15 @@ ;; Investigate buffer-manage, comment-tags, company, guru-mode, ivy. ;; Integrate GDB? -(if (fboundp `use-package) - () - (package-install `use-package)) -(setq package-native-compile t) +(setq-default package-native-compile t) (require 'package) (add-to-list 'package-archives `("melpa-unstable" . "https://melpa.org/packages/")) +(if (fboundp `use-package) + () + (progn (package-refresh-contents) (package-install `use-package))) ;; Make startup faster by reducing the frequency of garbage ;; collection. The default is 800 kilobytes. Measured in bytes. @@ -52,28 +52,28 @@ ;; Subsection 1.1 -(setq load-path - (flatten-list - (list load-path - (mapcar `directory-file-name `("/usr/share/emacs/site-lisp/quack.el"))))) +(setq-default load-path + (flatten-list + (list load-path + (mapcar `directory-file-name `("/usr/share/emacs/site-lisp/quack.el"))))) - (use-package eww - :defer t - :config - (progn - (define-key eww-mode-map (kbd "C-c f") 'ace-link) - (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") +(use-package eww + :defer t + :config + (progn + (define-key eww-mode-map (kbd "C-c f") 'ace-link) + (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") - ;; Allow for multiple Wowsers. - (defun eww-hook () "Reconfigure eww buffers on the fly." - (progn (rename-buffer "eww" t) - (variable-pitch-mode))) - (add-hook 'eww-mode-hook 'eww-hook))) + ;; Allow for multiple Wowsers. + (defun eww-hook () "Reconfigure eww buffers on the fly." + (progn (rename-buffer "eww" t) + (variable-pitch-mode))) + (add-hook 'eww-mode-hook 'eww-hook))) (use-package help-mode :defer t @@ -97,19 +97,19 @@ :ensure t :init ;; Add all your customizations prior to loading the themes - (setq modus-themes-success-deuteranopia t - modus-themes-bold-constructs t - modus-themes-syntax '(faint yellow-comments green-strings) - ;; modus-themes-mixed-fonts t ; available for 1.7 - modus-themes-links '(faint bold italic) - modus-themes-prompts '(gray intense) - modus-themes-mode-line '(3d accented) - modus-themes-completions 'opinionated - modus-themes-fringes 'intense - modus-themes-lang-checkers '(text-also background intense) - modus-themes-hl-line '(accented) - modus-themes-paren-match '(bold intense) - modus-themes-variable-pitch-ui t) + (setq-default modus-themes-success-deuteranopia t + modus-themes-bold-constructs t + modus-themes-syntax '(faint yellow-comments green-strings) + modus-themes-mixed-fonts t ; available for 1.7 + modus-themes-links '(faint bold italic) + modus-themes-prompts '(gray intense) + modus-themes-mode-line '(3d accented) + modus-themes-completions 'opinionated + modus-themes-fringes 'intense + modus-themes-lang-checkers '(text-also background intense) + modus-themes-hl-line '(accented) + modus-themes-paren-match '(bold intense) + modus-themes-variable-pitch-ui t) (modus-themes-load-themes) :config (modus-themes-load-operandi)) @@ -120,9 +120,9 @@ ;; Fonts and faces. -(set-face-attribute 'default nil :family "Iosevka Light" :height 125) -(set-face-attribute 'variable-pitch nil :family "Clear Sans" :height 1.0) -(set-face-attribute 'fixed-pitch nil :family "Iosevka Light" :height 1.5) +(set-face-attribute 'default nil :family "Clear Sans" :height 125) +(set-face-attribute 'variable-pitch nil :family "FreeSerif" :height 1.0) +(set-face-attribute 'fixed-pitch nil :family "Iosevka Light" :height 1.25) ;; y-or-no-p is fine (fset 'yes-or-no-p 'y-or-n-p) @@ -133,9 +133,9 @@ ;; Inhibit the GNU information startup dialog. (setq inhibit-startup-message t) -;; Set the default geometry of the frame in GUI mode. +;; Set the default dimensions (but not geometry) of the frame in GUI mode. (setq default-frame-alist - '((top . 200) (left . 400) + '(() () (width . 80) (height . 25))) ;; Hide the toolbar in GUI mode. @@ -157,8 +157,8 @@ ;; Set up our environment packages. (defun install-if-not-avail (x) "Check if X installed. if not, install." (if (package-installed-p x) - (print (concat (symbol-name x) " is already installed")) - (print (concat (symbol-name x) " is not installed, installing.")))) + (print (concat (symbol-name x) " is already installed.")) + (print (concat (symbol-name x) " is not installed, installing...")))) (defun setup-packages (sequence) "Check if the packages in SEQUENCE are available. If not, install them." (mapc 'install-if-not-avail sequence)) @@ -216,6 +216,9 @@ ;; Subsection 2.1 +(use-package xterm-color + :ensure t + :demand) (use-package rainbow-blocks :ensure t @@ -224,17 +227,18 @@ :ensure t :demand) -;; Good-scroll improves Emacs' scrolling abilities. -(use-package good-scroll - :ensure t - :demand - :config - (progn (good-scroll-mode 1) - (global-set-key [next] #'good-scroll-up-full-screen) - (global-set-key [prior] #'good-scroll-down-full-screen) - (setq good-scroll-render-rate .16))) +;; ;; Good-scroll improves Emacs' scrolling abilities. +;; (use-package good-scroll +;; :ensure t +;; :demand +;; :config +;; (progn (good-scroll-mode 1) +;; (global-set-key [next] #'good-scroll-up-full-screen) +;; (global-set-key [prior] #'good-scroll-down-full-screen) +;; (setq good-scroll-render-rate .16))) ;; Golden Ratio resizes the current buffer according to the golden ratio. +;; TODO: Make it recenter on switch. (use-package golden-ratio :ensure t :demand @@ -243,8 +247,35 @@ (golden-ratio-mode 1) ;; Interop with other libraries. (setq golden-ratio-extra-commands - (flatten-list (list 'golden-ratio-extra-commands '(ace-window ace-jump-move)))))) + (flatten-list (list 'golden-ratio-extra-commands '(ace-window ace-jump-move)))) + (setq golden-ratio-recenter 1))) +;; Golden Scroll forces scrolling to adhere to the golden ratio. +;; TODO: Recenter on scroll. +(use-package golden-ratio-scroll-screen + :ensure t + :demand + :config + (progn + (global-set-key (kbd "") `golden-ratio-scroll-screen-down) + (global-set-key (kbd "") `golden-ratio-scroll-screen-up) + (global-set-key (kbd "C-v") `golden-ratio-scroll-screen-up) + (global-set-key (kbd "M-v") `golden-ratio-scroll-screen-down) + + ;; The built-in support for recentering seems broken... + ;; It would be trivial to write a wrapper function to achieve the same effect, though. + ;; Basically, just write your own scroll function that calls the golden-scroll function + ;; and then recenters the screen. It would be nice to combine this with centered-cursor-mode, + ;; too - only problem is that it stutters a bit at the end of buffers when using golden-scroll functions. + (setq golden-ratio-scroll-recenter 1))) + +;; zoom-window allows for temporarily "full-screening" a window. +(use-package zoom-window + :ensure t + :demand + :config + (progn + (global-set-key (kbd "C-z") `zoom-window-zoom))) ;; Dim inactive buffers. (use-package dimmer @@ -254,8 +285,8 @@ (progn (dimmer-mode 1) (dimmer-configure-helm) - (setq - ; dimmer-adjustment-mode :both + (setq-default + dimmer-adjustment-mode :both dimmer-fraction .40))) @@ -318,24 +349,19 @@ ;; Subsection 2.2 -;; Allow us to easily get around using the Ace packages. +;; Allow us to easily get around using the Avy and Ace packages. +(use-package avy + :ensure t + :demand + :config + (global-set-key (kbd "C-c SPC") 'avy-goto-char)) + (use-package ace-window :ensure t :demand :config (global-set-key (kbd "M-o") 'ace-window)) -;; (use-package avy -;; :ensure t -;; :demand -;; :config -;; (global-set-key (kbd "C-c SPC") 'avy-jump-char)) -(use-package ace-jump-mode - :ensure t - :demand - :config - (global-set-key (kbd "C-c SPC") 'ace-jump-char-mode)) - (use-package ace-link :defer t :ensure t @@ -347,76 +373,72 @@ :ensure t :defer t) -;; Add SLY, a Lisp REPL. +;; Add SLY, a Common Lisp REPL. (use-package sly :ensure t :defer t :config (setq inferior-lisp-program "sbcl")) -;; etags alows for... something. -(use-package etags - :defer t) - -;; ac-mode allows for autocompletion. -(use-package ac-sly - :defer t) - -(use-package ac-sly - :defer t) -(use-package ac-html - :defer t) -(use-package ac-etags - :defer t) -(use-package ac-ispell - :defer t) -(use-package ac-c-headers - :defer t) -(use-package ac-haskell-process - :defer t) - -;; provides auto-completion. duh. -(use-package auto-complete - :defer t +;; Add Geiser, a Scheme REPL. +(use-package geiser + :ensure t + :defer t + :config + (setq-default inferior-lisp-program "mit-scheme-native")) + +(use-package geiser-mit + :ensure t + :defer t) + +(use-package ac-sly + :ensure t + :defer t) + +(use-package ac-geiser + :ensure t + :defer t) + +(use-package ac-html + :ensure t) + +(use-package ac-etags + :ensure t) + +(use-package ac-ispell + :ensure t) + +(use-package ac-c-headers + :ensure t) + +(use-package ac-ispell + :ensure t + :defer t) + +(use-package auto-complete :ensure t - :after ac-sly ac-html etags ac-etags ac-ispell ac-c-headers ac-haskell-process :demand :config - (progn (ac-config-default) - (ac-set-trigger-key "TAB") - ;; Dictionaries defined below, along with support functions. - (progn (setq ac-sources '(ac-sly - ac-html - ac-etags - ac-ispell - ac-c-headers - ac-haskell-process)) - (add-hook 'sly-mode-hook 'set-up-sly-ac) - (defun set-up-sly-ac () (add-to-list 'ac-modes 'sly-mrepl-mode)) - - ;; Allow the auto-completion of HTML. - (ac-html-enable-data-provider 'ac-html-default-data-provider) - (add-to-list 'ac-sources '(ac-source-haml-tag - ac-source-haml-attr - ac-source-haml-attrv)) - - ;; Use e/ctags as a C auto-completion source. - (ac-etags-setup) - (defun my/c-mode-common-hook () - (add-to-list 'ac-sources 'ac-source-etags)) - (add-hook 'c-mode-common-hook 'my/c-mode-common-hook) - - ;; Completion of English words longer than 4 characters. - (custom-set-variables - '(ac-ispell-requires 4) - '(ac-ispell-fuzzy-limit 4)) - (ac-ispell-setup) - - ;; Allow auto-completion using C headers as a source. - (add-hook 'c-mode-hook - (lambda () - (add-to-list 'ac-sources 'ac-source-c-headers) - (add-to-list 'ac-sources 'ac-source-c-header-symbols t)))))) + (progn + (ac-config-default) + (ac-set-trigger-key "TAB") + ;; Sources. + (defun list-sources (SOURCES) "Produce a list containing the contents of SOURCES." + (flatten-list + (list (list SOURCES) ac-sources))) + (add-hook 'c-mode-hook + (lambda () + (progn + (ac-etags-setup) + (setq ac-sources + (list-sources `(ac-source-etags ac-source-c-headers ac-source-c-header-symbols)))))) + (add-hook 'scheme-mode-hook + (lambda () + (progn + (setq ac-sources + (list-sources `(ac-source-geiser)))))) + (add-hook 'geiser-mode-hook 'ac-geiser-setup) + (add-hook 'geiser-repl-mode-hook 'ac-geiser-setup))) ;; Configure the fuzzy-pattern matching engine, Helm (use-package helm @@ -432,11 +454,11 @@ (setq helm-autoresize-min-height 20) (helm-autoresize-mode 1) (define-key helm-map (kbd "") - 'helm-execute-persistent-action) + 'helm-execute-persistent-action) (define-key helm-map (kbd "C-i") - 'helm-execute-persistent-action) + 'helm-execute-persistent-action) (define-key helm-map (kbd "C-z") - 'helm-select-action) + '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) @@ -513,12 +535,10 @@ (defun texthook () "Function for 'text-mode' hook." (progn - (variable-pitch-mode) - (solaire-mode) - (rainbow-mode) - (goggles-mode) - (focus-mode) - (mapcar 'set-on '(display-line-numbers)))) + (variable-pitch-mode 1) + (solaire-mode 1) + (goggles-mode 1) + (focus-mode 1))) (add-hook 'text-mode-hook 'texthook) @@ -540,7 +560,7 @@ '("2f93ebb862a9d50fee9c1b3302d858e2d2c0bba9d4e1be9bb3b08b7373f1710c" default)) '(helm-completion-style 'helm) '(package-selected-packages - '(dimmer god-mode paredit geiser-mit ctxmenu aggressive-indent-mode xpm ws-butler web-completion-data use-package srfi solarized-theme solaire-mode sly rainbow-mode rainbow-blocks powerline popwin paren-face parchment-theme names helm-slime helm-mode-manager helm-flycheck helm-eww good-scroll goggles gnuplot focus flyspell-correct-helm flymake-haskell-multi flymake flycheck-haskell flycheck-aspell eww-lnum electric-operator context-coloring clean-buffers aggressive-indent ace-window ace-link ace-jump-mode ac-slime ac-html ac-haskell-process ac-etags)) + '(ac-geiser centered-cursor-mode golden-ratio-scroll-screen helpful indent-guide zoom-window dimmer god-mode paredit geiser-mit ctxmenu aggressive-indent-mode xpm ws-butler web-completion-data use-package srfi solarized-theme solaire-mode sly rainbow-mode rainbow-blocks powerline popwin paren-face parchment-theme names helm-slime helm-mode-manager helm-flycheck helm-eww good-scroll goggles gnuplot focus flyspell-correct-helm flymake-haskell-multi flymake flycheck-haskell flycheck-aspell eww-lnum electric-operator context-coloring clean-buffers aggressive-indent ace-window ace-link ace-jump-mode ac-slime ac-html ac-haskell-process ac-etags)) '(quack-default-program "scheme") '(quack-newline-behavior 'newline) '(quack-programs