From b07bba62932bc3c8b90a8bf951d1b089e29c8791 Mon Sep 17 00:00:00 2001 From: Mid Favila Date: Sun, 21 Nov 2021 11:56:15 -0400 Subject: [PATCH] Update init.el and XResources. --- misc/init.el | 390 ++++++++++++++++++++++++++++++++--------------- xresources/XTerm | 4 +- 2 files changed, 268 insertions(+), 126 deletions(-) diff --git a/misc/init.el b/misc/init.el index 9f79eaf..506a64e 100644 --- a/misc/init.el +++ b/misc/init.el @@ -2,6 +2,27 @@ ;;;; Commentary: +;;; TODO: + +;; Integrate flyspell +;; Work on setting up org-mode for publishing (using Muse, AuCTeX, gnuplot, etc) +;; Set up ctxmenu to provide right-click menus +;; Work on improving aggressive-indent's abilities and integrating with clean-aindent-mode, potentially +;; Look into programming with the names libraries - adds namespaces. +;; Configure jammer and schrute to prevent using inefficient tactics and teach +;; Maybe configure paren-face and integrate it with rainbow-blocks? +;; Look into powerline more. +;; Integrate SLY and your extensions more. +;; Replace the standard EWW functions with Helm ones. Also configure EWW more in general. +;; Investigate buffer-manage, comment-tags, company, guru-mode, ivy. +;; Integrate GDB? + + +;; Make startup faster by reducing the frequency of garbage +;; collection. The default is 800 kilobytes. Measured in bytes. +(setq gc-cons-threshold (* 1000 1000 1000)) + + ;;;; Index: ;;; Section One - Packageless Configurations @@ -21,30 +42,58 @@ ;; Subsection 1.1 -(use-package eww) -(use-package help-mode) -(use-package woman) -(use-package org) +(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))) + +(use-package help-mode + :defer t + :config + (define-key help-mode-map (kbd "C-c f") 'ace-link)) + +(use-package woman + :defer t + :config + (define-key woman-mode-map (kbd "C-c f") 'ace-link)) + +(use-package org + :defer t + :config + (define-key org-mode-map (kbd "C-c f") 'ace-link)) ;; Subsection 1.2 ;; Default theme. (use-package modus-themes - :ensure + :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-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-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 @@ -59,11 +108,12 @@ (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) -;; ’y’ or ’n’ is fine + +;; y-or-no-p is fine (fset 'yes-or-no-p 'y-or-n-p) ;; Override x-popup-menu -(fset `x-popup-menu `ace-popup-menu) +(fset 'x-popup-menu 'ace-popup-menu) ;; Inhibit the GNU information startup dialog. (setq inhibit-startup-message t) @@ -86,7 +136,6 @@ (setq window-divider-default-places t) (window-divider-mode 1) -(hl-line-mode 1) ;; Subsection 1.3 @@ -97,9 +146,9 @@ (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)) + (mapc 'install-if-not-avail sequence)) -(setup-packages `()) +(setup-packages '()) ;; Simple functions to control modes." (defun set-on (mode) "Set MODE to on if it's off." @@ -108,52 +157,45 @@ ())) (defun toggle (x) "If X is disabled, enable it. Otherwise disable it." - (if (not (eval x)) - (set x 1) - (set x nil))) + (if (not (eval x)) + (set x 1) + (set x nil))) -;; Allow for multiple Wowsers. -(eval-after-load "eww" - (progn `(defun eww-hook () "Reconfigure eww buffers on the fly." - (progn (rename-buffer "eww" t) - (variable-pitch-mode))))) -(add-hook 'eww-mode-hook `eww-hook) ;; Kill the current buffer. (global-set-key (kbd "C-x k") 'kill-this-buffer) -;; Subsection 1.3 +;; Subsection 1.4 + +;; Give us stats during startup. +(add-hook 'emacs-startup-hook + (lambda () + (message "Emacs ready in %s with %d garbage collections." + (format "%.2f seconds" + (float-time + (time-subtract after-init-time before-init-time))) gcs-done))) + +;; We want to treat documents as ASCII by default. +(prefer-coding-system 'us-ascii-unix) ;; Disable TLS 1.3. (eval-after-load "gnutls" (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.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 collector’s threshold. -(setq gc-cons-threshold 100000000) -(setq large-file-warning-threshold 1000000000) - ;; Store temporary files in a backup directory. +(progn + (setq temporary-file-directory "~/.config/emacs/.backup/temp/") + (setq auto-save-directory "~/.config/emacs/.backup/autosave/")) + (eval-after-load "tramp.el" (progn - (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 - `(("\\(?:[^/]*/\\)*\\(.*\\)" ,(concat auto-save-directory "\\1") t))))) + (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 + '(("\\(?:[^/]*/\\)*\\(.*\\)" ,(concat auto-save-directory "\\1") t))))) ;; Automatically reload files as needed. @@ -171,23 +213,26 @@ (use-package rainbow-mode :ensure t :demand) -;;(use-package aggressive-indent-mode - ;; :ensure t - ;;:demand) -;; Good-scroll improves Emacs’ scrolling abilities. +;; Good-scroll improves Emacs' scrolling abilities. (use-package good-scroll :ensure t :demand :config - (good-scroll-mode 1)) + (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. (use-package golden-ratio :ensure t :demand :config - (golden-ratio-mode 1)) + (progn + (golden-ratio-mode 1) + ;; Interop with ace-window. + (add-to-list 'golden-ratio-extra-commands 'ace-window))) ;; Dim inactive buffers. @@ -195,7 +240,13 @@ :ensure t :demand :config - (dimmer-mode 1)) + (progn + (dimmer-mode 1) + (dimmer-configure-helm) + (setq + ; dimmer-adjustment-mode :both + dimmer-fraction .40))) + ;; Goggles adds pulsing effects to region edits. (use-package goggles @@ -216,7 +267,7 @@ :ensure t :demand :config - (dolist (face `(mode-line mode-line-inactive)))) + (dolist (face '(mode-line mode-line-inactive)))) ;; Powerline allows for modeline tweaks. @@ -231,27 +282,27 @@ :ensure t :demand :config - ;; Meta commands - (eval-after-load "popwin" - `(progn (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) - (push "*slime-apropos*" popwin:special-display-config) ; SLIME commands - (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)))) + (progn (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) + (push '("*Compile-Log*" :height 20) popwin:special-display-config) + (push '("*Warnings*" :height 20) popwin:special-display-config) + (push "*slime-apropos*" popwin:special-display-config) ; SLIME commands + (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))) ;; Subsection 2.2 @@ -261,71 +312,144 @@ :ensure t :demand :config - (global-set-key (kbd "M-o") `ace-window)) + (global-set-key (kbd "M-o") 'ace-window)) -(use-package ace-jump-mode +(use-package avy :ensure t :demand :config - (eval-after-load "ace-jump-mode" `(global-set-key (kbd "C-c SPC") 'ace-jump-mode))) + (global-set-key (kbd "C-c SPC") 'avy-jump-char)) (use-package ace-link + :defer t :ensure t - :demand - :config - (define-key eww-mode-map (kbd "C-c f") 'ace-link) - (define-key Info-mode-map (kbd "C-c f") 'ace-link) - (define-key org-mode-map (kbd "C-c f") 'ace-link) - (define-key help-mode-map (kbd "C-c f") 'ace-link) - (define-key woman-mode-map (kbd "C-c f") 'ace-link)) + :demand) + +;;; Subsection 2.3 ;; Add SLY, a Lisp REPL. (use-package sly :ensure t - :defer + :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 + :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)))))) + ;; Configure the fuzzy-pattern matching engine, Helm (use-package helm :ensure t :demand :bind :config - (require 'helm-config) - (helm-mode 1) - (setq helm-split-window-inside-p t - 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 "") - `helm-execute-persistent-action) - (define-key helm-map (kbd "C-i") - 'helm-execute-persistent-action) - (define-key helm-map (kbd "C-z") - `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) - (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))) - (add-to-list 'golden-ratio-inhibit-functions 'pl/helm-alive-p)) + (progn (require 'helm-config) + (helm-mode 1) + (setq helm-split-window-inside-p t + 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 "") + 'helm-execute-persistent-action) + (define-key helm-map (kbd "C-i") + 'helm-execute-persistent-action) + (define-key helm-map (kbd "C-z") + '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) + (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))) + (add-to-list 'golden-ratio-inhibit-functions 'pl/helm-alive-p))) ;; Add Helm support to the web wowser (use-package helm-eww - :ensure t) + :defer t + :ensure t + :after eww helm + :config + (progn + ())) -;; Add on-the-fly syntax linting + +;; Flycheck provides on-the-fly syntax linting (use-package flycheck - :ensure t) + :defer t + :ensure t + :config + (progn (global-flycheck-mode))) + ;; Integrate Helm recommendations and Flycheck linting (use-package helm-flycheck + :defer t + :after helm flycheck :ensure t :demand :config @@ -333,11 +457,12 @@ ;; Add an SRFI browser. (use-package srfi + :defer t :ensure t) ;; Enable development features in certain modes. (defvar proghook-active 0) -(defun proghook () "Function for ’prog-mode’ hook." +(defun proghook () "Function for 'prog-mode' hook." (progn (clean-aindent-mode) (aggressive-indent-mode) @@ -345,7 +470,6 @@ (semantic-mode) (flycheck-mode) (electric-pair-mode) - (electric-quote-mode) (electric-indent-mode) (solaire-mode) (rainbow-blocks-mode) @@ -353,27 +477,37 @@ (goggles-mode) (focus-mode) (show-paren-mode) - (mapcar `set-on `(display-line-numbers)))) + (mapcar 'set-on '(display-line-numbers)))) -(add-hook `prog-mode-hook `proghook) +(add-hook 'prog-mode-hook 'proghook) ;; Add cwarn-mode to cc-mode later on +(defvar chook-active 0) +(defun chook () "Function for 'c-mode' hook." + (progn + (c-set-style "whitesmith"))) +(add-hook 'c-mode-hook 'chook) + (defvar texthook-active 0) (add-hook 'text-mode-hook 'texthook) -(defun texthook () "Function for ’text-mode’ hook." +(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)))) + (mapcar 'set-on '(display-line-numbers)))) -(add-hook `text-mode-hook `texthook) +(add-hook 'text-mode-hook 'texthook) +;; The rest of the init file. +;; Make gc pauses faster by decreasing the threshold. +(setq gc-cons-threshold (* 2 1000 1000)) + (provide 'init) ;;; init.el ends here @@ -382,7 +516,15 @@ ;; 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. + '(beacon-mode t) '(custom-safe-themes '("2f93ebb862a9d50fee9c1b3302d858e2d2c0bba9d4e1be9bb3b08b7373f1710c" default)) + '(helm-completion-style 'helm) '(package-selected-packages - '(aggressive-indent-mode xpm ws-butler web-completion-data use-package stripes srfi speed-type solarized-theme solaire-mode smooth-scroll sly rainbow-mode rainbow-blocks powerline popwin paren-face parchment-theme names helm-slime helm-mode-manager helm-flycheck helm-eww good-scroll golden-ratio goggles gnuplot focus flyspell-correct-helm flymake-haskell-multi flymake flycheck-haskell flycheck-aspell eww-lnum electric-operator dimmer context-coloring clean-buffers clean-aindent-mode auto-compile aggressive-indent ace-window ace-link ace-jump-mode ac-slime ac-html ac-haskell-process ac-etags))) + '(ctxmenu aggressive-indent-mode xpm ws-butler web-completion-data use-package srfi solarized-theme solaire-mode smooth-scroll 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 dimmer context-coloring clean-buffers clean-aindent-mode auto-compile aggressive-indent ace-window ace-link ace-jump-mode ac-slime ac-html ac-haskell-process ac-etags))) +(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. + ) diff --git a/xresources/XTerm b/xresources/XTerm index 7f76036..5bfd78b 100644 --- a/xresources/XTerm +++ b/xresources/XTerm @@ -1,7 +1,7 @@ !! Look. ! Widgets. -xterm*faceName: Iosevka Regular +xterm*faceName: Iosevka Term xterm*faceSize: 12 ! Misc. @@ -12,7 +12,7 @@ xterm*title: XTerminal ! Save X number of lines. xterm*savelines: 20000 -! Allow double-click to hilight URIs. +! Allow double-click to highlight URIs. xterm*charClass: 33:48,36-47:48,58-59:48,61:48,63-64:48,95:48,126:48 ! Stop scrolling on output.