From 2223dd66591aad1ee44916994c8782d5a59315d0 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 14 Jan 2023 19:14:24 -0600 Subject: Whitespace etc. --- basics.el | 170 ++++++++++++++++++++++++++++++---------------------------- early-init.el | 12 ++--- init.el | 159 +++++++++++++++++++++++++++++------------------------- 3 files changed, 180 insertions(+), 161 deletions(-) diff --git a/basics.el b/basics.el index 3b24a68..7b4b1fd 100644 --- a/basics.el +++ b/basics.el @@ -29,61 +29,61 @@ :ensure t :demand t :preface (setq-default no-littering-etc-directory etc/ - no-littering-var-directory etc/)) + no-littering-var-directory etc/)) ;;; Settings ;; Async (setq-default async-shell-command-buffer 'new-buffer - async-shell-command-display-buffer nil) + async-shell-command-display-buffer nil) ;; Scrolling (setq-default auto-hscroll-mode t - auto-window-vscroll nil - fast-but-imprecise-scrolling t - hscroll-margin 1 - hscroll-step 1 - scroll-conservatively 25 - scroll-margin 0 - scroll-preserve-screen-position 1 - scroll-step 1) + auto-window-vscroll nil + fast-but-imprecise-scrolling t + hscroll-margin 1 + hscroll-step 1 + scroll-conservatively 25 + scroll-margin 0 + scroll-preserve-screen-position 1 + scroll-step 1) (scroll-bar-mode -1) (horizontal-scroll-bar-mode -1) (pixel-scroll-precision-mode) ;; Cursor (setq-default cursor-in-non-selected-windows 'hollow - cursor-type 'bar - blink-cursor-blinks 1 - blink-cursor-interval 0.25 - blink-cursor-delay 0.25) + cursor-type 'bar + blink-cursor-blinks 1 + blink-cursor-interval 0.25 + blink-cursor-delay 0.25) (blink-cursor-mode) ;; Mouse (setq-default mouse-drag-copy-region t - mouse-wheel-progressive-speed nil - mouse-yank-at-point t) + mouse-wheel-progressive-speed nil + mouse-yank-at-point t) ;; Dialogs (unless (boundp 'use-short-answers) (fset 'yes-or-no-p 'y-or-n-p)) (setq-default read-answer-short t - use-dialog-box nil - use-file-dialog nil - use-short-answers t) + use-dialog-box nil + use-file-dialog nil + use-short-answers t) ;; Minibuffer (setq-default completion-ignore-case t - read-buffer-completion-ignore-case t - read-file-name-completion-ignore-case t - completions-detailed t - enable-recursive-minibuffers t - file-name-shadow-properties '(invisible t intangible t) - minibuffer-eldef-shorten-default t - minibuffer-prompt-properties '( read-only t - cursor-intangible t - face minibuffer-prompt)) + read-buffer-completion-ignore-case t + read-file-name-completion-ignore-case t + completions-detailed t + enable-recursive-minibuffers t + file-name-shadow-properties '(invisible t intangible t) + minibuffer-eldef-shorten-default t + minibuffer-prompt-properties '( read-only t + cursor-intangible t + face minibuffer-prompt)) (file-name-shadow-mode) (minibuffer-electric-default-mode) @@ -98,15 +98,15 @@ (require 'savehist) (setq-default history-length 1024 - history-delete-duplicates t - ;; savehist-file (etc/ "savehist.el") - savehist-save-minibuffer-history t - savehist-autosave-interval 30) + history-delete-duplicates t + ;; savehist-file (etc/ "savehist.el") + savehist-save-minibuffer-history t + savehist-autosave-interval 30) (savehist-mode) ;; Killing and yanking (setq-default kill-do-not-save-duplicates t - kill-read-only-ok t + kill-read-only-ok t ;; XXX: This setting causes an error message the first time it's ;; called: "Selection owner couldn't convert: TIMESTAMP". I have ;; absolutely no idea why I get this error, but it's generated in @@ -114,12 +114,12 @@ ;; do anything else with it, so for now, I'll just live with the ;; message. save-interprogram-paste-before-kill t - yank-pop-change-selection t) + yank-pop-change-selection t) (delete-selection-mode) ;; Notifying the user (setq-default echo-keystrokes 0.01 - ring-bell-function #'ignore) + ring-bell-function #'ignore) ;; Point and mark (setq-default set-mark-command-repeat-pop t) @@ -129,8 +129,8 @@ ;; Startup (setq-default inhibit-startup-screen t - initial-buffer-choice t - initial-scratch-message nil) + initial-buffer-choice t + initial-scratch-message nil) (define-advice startup-echo-area-message (:override ()) (if (get-buffer "*Warnings*") @@ -143,15 +143,15 @@ ;; Text editing (setq-default fill-column 80 - sentence-end-double-space t - tab-width 8 - tab-always-indent 'complete) + sentence-end-double-space t + tab-width 8 + tab-always-indent 'complete) (global-so-long-mode) (setq-default show-paren-delay 0.01 - show-paren-style 'parenthesis - show-paren-when-point-in-periphery t - show-paren-when-point-inside-paren t) + show-paren-style 'parenthesis + show-paren-when-point-in-periphery t + show-paren-when-point-inside-paren t) (show-paren-mode) (electric-pair-mode) @@ -177,33 +177,33 @@ ;; Abbrev (setq-default abbrev-file-name (sync/ "abbrev.el") - save-abbrevs 'silently) + save-abbrevs 'silently) ;; Files (setq-default auto-revert-verbose nil - global-auto-revert-non-file-buffers t - create-lockfiles nil - find-file-visit-truename t - mode-require-final-newline t - view-read-only t - save-silently t) + global-auto-revert-non-file-buffers t + create-lockfiles nil + find-file-visit-truename t + mode-require-final-newline t + view-read-only t + save-silently t) (global-auto-revert-mode) (setq-default auto-save-default nil - auto-save-interval 1 - auto-save-no-message t - auto-save-timeout 1 - auto-save-visited-interval 1 + auto-save-interval 1 + auto-save-no-message t + auto-save-timeout 1 + auto-save-visited-interval 1 remote-file-name-inhibit-auto-save-visited t) (add-to-list 'auto-save-file-name-transforms - `(".*" ,(etc/ "auto-save/" t) t)) + `(".*" ,(etc/ "auto-save/" t) t)) (auto-save-visited-mode) (setq-default backup-by-copying t - version-control t - kept-new-versions 8 - kept-old-versions 8 - delete-old-versions t) + version-control t + kept-new-versions 8 + kept-old-versions 8 + delete-old-versions t) (require 'recentf) (setq-default ;; recentf-save-file (etc/ "recentf" t) @@ -218,7 +218,7 @@ (require 'saveplace) (setq-default ;; save-place-file (etc/ "places.el") save-place-forget-unreadable-files (eq system-type - 'gnu/linux)) + 'gnu/linux)) (save-place-mode) (require 'uniquify) @@ -228,12 +228,18 @@ uniquify-separator path-separator) (setq-local vc-follow-symlinks t - vc-make-backup-files t) + vc-make-backup-files t) + +;; Whitespace +(require 'whitespace) +(setq-default whitespace-style + '(face trailing tabs space-after-tab space-before-tab tab-mark)) +(global-whitespace-mode) ;; Native compilation (setq-default native-comp-async-report-warnings-errors 'silent - native-comp-deferred-compilation t - native-compile-target-directory (etc/ "eln" t)) + native-comp-deferred-compilation t + native-compile-target-directory (etc/ "eln" t)) (add-to-list 'native-comp-eln-load-path native-compile-target-directory) (when (fboundp 'startup-redirect-eln-cache) (startup-redirect-eln-cache native-compile-target-directory)) @@ -302,13 +308,13 @@ N spaces." #'+lisp-comment-or-uncomment-sexp))) (define-key emacs-lisp-mode-map (kbd "C-c C-c") - #'eval-defun) + #'eval-defun) (define-key emacs-lisp-mode-map (kbd "C-c C-k") - #'elisp-eval-region-or-buffer) + #'elisp-eval-region-or-buffer) (define-key lisp-interaction-mode-map (kbd "C-c C-c") - #'eval-defun) + #'eval-defun) (define-key lisp-interaction-mode-map (kbd "C-c C-k") - #'elisp-eval-region-or-buffer) + #'elisp-eval-region-or-buffer) (define-advice eval-region (:around (orig start end &rest args) pulse) (apply orig start end args) (pulse-momentary-highlight-region start end)) @@ -320,17 +326,17 @@ N spaces." (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) (add-hook 'find-file-not-found-functions - (defun create-missing-directories () - "Automatically create missing directories." - (let ((target-dir (file-name-directory buffer-file-name))) - (unless (file-exists-p target-dir) - (make-directory target-dir :parents))))) + (defun create-missing-directories () + "Automatically create missing directories." + (let ((target-dir (file-name-directory buffer-file-name))) + (unless (file-exists-p target-dir) + (make-directory target-dir :parents))))) (add-hook 'find-file-hook - (defun vc-remote-off () - "Turn VC off when remote." - (when (file-remote-p (buffer-file-name)) - (setq-local vc-handled-backends nil)))) + (defun vc-remote-off () + "Turn VC off when remote." + (when (file-remote-p (buffer-file-name)) + (setq-local vc-handled-backends nil)))) ;;; Advice @@ -555,15 +561,15 @@ See also `with-region-or-to-eol'." ;; Optionally make narrowing help available in the minibuffer. ;; You may want to use `embark-prefix-help-command' or which-key instead. (define-key consult-narrow-map (vconcat consult-narrow-key "?") - #'consult-narrow-help)) + #'consult-narrow-help)) (use-package orderless :ensure t :demand t :init (setopt completion-styles '(substring orderless basic) - completion-category-defaults nil - completion-category-overrides - '((file (styles basic partial-completion))))) + completion-category-defaults nil + completion-category-overrides + '((file (styles basic partial-completion orderless))))) (use-package marginalia :ensure t :demand t @@ -593,8 +599,8 @@ See also `with-region-or-to-eol'." :ensure t :config (setq undo-fu-session-incompatible-files - '("/COMMIT_EDITMSG\\'" - "/git-rebase-todo\\'")) + '("/COMMIT_EDITMSG\\'" + "/git-rebase-todo\\'")) (global-undo-fu-session-mode)) ;;; basics.el ends here diff --git a/early-init.el b/early-init.el index d59fe64..70b61a8 100644 --- a/early-init.el +++ b/early-init.el @@ -9,9 +9,9 @@ ;; Frames (setq default-frame-alist '((tool-bar-lines . 0) - (menu-bar-lines . 0) - (vertical-scroll-bars . nil) - (horizontal-scroll-bars . nil)) + (menu-bar-lines . 0) + (vertical-scroll-bars . nil) + (horizontal-scroll-bars . nil)) frame-inhibit-implied-resize t frame-resize-pixelwise t window-resize-pixelwise t @@ -22,12 +22,12 @@ ;; Packages (require 'package) (add-to-list 'package-archives - '("melpa" . "https://melpa.org/packages/") :append) + '("melpa" . "https://melpa.org/packages/") :append) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") :append) (setq package-priorities '(("melpa" . 3) - ("nongnu" . 2) - ("gnu" . 1) + ("nongnu" . 2) + ("gnu" . 1) ("melpa-stable" . 0))) (package-initialize) (unless package-archive-contents diff --git a/init.el b/init.el index f4eac89..f114adf 100644 --- a/init.el +++ b/init.el @@ -9,58 +9,71 @@ ;;; Built-ins (use-package emacs ; Misc. config - :custom-face - (fixed-pitch ((t :family ,(find-font "Comic Code" - "DejaVu Sans Mono") - :height 100))) - (variable-pitch ((t :family ,(find-font "Atkinson Hyperlegible" - "DejaVu Serif") - :height 1.4))) - (default ((t :family ,(find-font "Comic Code" - "DejaVu Sans Mono") - :height 100))) - (font-lock-comment-face ((t :slant italic))) :config (setopt tab-bar-show 1 - recenter-positions '(top middle bottom)) - (keymap-global-unset "C-\\")) + recenter-positions '(top middle bottom) + initial-scratch-message + (mapconcat (lambda (s) (format ";; %s" s)) + (process-lines "fortune") + "\n")) + (keymap-global-unset "C-\\") + (add-hook 'kill-buffer-query-functions + (defun scratch@immortal () + (if (equal (buffer-name) "*scratch*") + (progn (bury-buffer) nil) + t)))) (use-package faces - :defer 2 ; This is sort of expensive :config - ;; Emojis - (cl-loop with ffl = (font-family-list) - for font in '("Noto Emoji" "Noto Color Emoji" - "Segoe UI Emoji" "Apple Color Emoji" - "FreeSans" "FreeMono" "FreeSerif" - "Unifont" "Symbola") - if (member font ffl) - do (set-fontset-font t 'symbol font)) - ;; International scripts - (cl-loop with ffl = (font-family-list) - for (charset . font) in '((latin . "Noto Sans") - (han . "Noto Sans CJK SC Regular") - (kana . "Noto Sans CJK JP Regular") - (hangul . "Noto Sans CJK KR Regular") - (cjk-misc . "Noto Sans CJK KR Regular") - (khmer . "Noto Sans Khmer") - (lao . "Noto Sans Lao") - (burmese . "Noto Sans Myanmar") - (thai . "Noto Sans Thai") - (ethiopic . "Noto Sans Ethiopic") - (hebrew . "Noto Sans Hebrew") - (arabic . "Noto Sans Arabic") - (gujarati . "Noto Sans Gujarati") - (devanagari . "Noto Sans Devanagari") - (kannada . "Noto Sans Kannada") - (malayalam . "Noto Sans Malayalam") - (oriya . "Noto Sans Oriya") - (sinhala . "Noto Sans Sinhala") - (tamil . "Noto Sans Tamil") - (telugu . "Noto Sans Telugu") - (tibetan . "Noto Sans Tibetan")) - if (member font ffl) - do (set-fontset-font t charset font))) + (add-hook 'server-after-make-frame-hook + (defun first-frame@set-fonts () + (face-spec-set 'fixed-pitch + `((t :family ,(find-font "Comic Code" + "DejaVu Sans Mono") + :height 100))) + (face-spec-set 'variable-pitch + `((t :family ,(find-font "Atkinson Hyperlegible" + "DejaVu Serif") + :height 1.4))) + (face-spec-set 'default + `((t :family ,(find-font "Comic Code" + "DejaVu Sans Mono") + :height 100))) + (face-spec-set 'font-lock-comment-face + `((t :slant italic))) + ;; Emojis + (cl-loop with ffl = (font-family-list) + for font in '("Noto Emoji" "Noto Color Emoji" + "Segoe UI Emoji" "Apple Color Emoji" + "FreeSans" "FreeMono" "FreeSerif" + "Unifont" "Symbola") + if (member font ffl) + do (set-fontset-font t 'symbol font)) + ;; International scripts + (cl-loop with ffl = (font-family-list) + for (charset . font) in '((latin . "Noto Sans") + (han . "Noto Sans CJK SC Regular") + (kana . "Noto Sans CJK JP Regular") + (hangul . "Noto Sans CJK KR Regular") + (cjk-misc . "Noto Sans CJK KR Regular") + (khmer . "Noto Sans Khmer") + (lao . "Noto Sans Lao") + (burmese . "Noto Sans Myanmar") + (thai . "Noto Sans Thai") + (ethiopic . "Noto Sans Ethiopic") + (hebrew . "Noto Sans Hebrew") + (arabic . "Noto Sans Arabic") + (gujarati . "Noto Sans Gujarati") + (devanagari . "Noto Sans Devanagari") + (kannada . "Noto Sans Kannada") + (malayalam . "Noto Sans Malayalam") + (oriya . "Noto Sans Oriya") + (sinhala . "Noto Sans Sinhala") + (tamil . "Noto Sans Tamil") + (telugu . "Noto Sans Telugu") + (tibetan . "Noto Sans Tibetan")) + if (member font ffl) + do (set-fontset-font t charset font))))) (use-package text-mode :config @@ -71,11 +84,11 @@ (add-hook 'prog-mode-hook #'auto-fill-mode) (add-hook 'prog-mode-hook (defun prog@indent-tabs-maybe () - (indent-tabs-mode + (indent-tabs-mode (if (derived-mode-p 'emacs-lisp-mode - 'python-mode - 'haskell-mode) - -1 1))))) + 'python-mode + 'haskell-mode) + -1 1))))) (use-package eshell :preface @@ -201,15 +214,15 @@ :after custom-allowed :config (add-hook 'custom-allowed-after-load-hook - (defun dawn-modus () - (dawn-schedule-themes 'modus-operandi + (defun dawn-modus () + (dawn-schedule-themes 'modus-operandi 'modus-vivendi)))) (use-package electric-cursor :load-path "~/src/emacs/electric-cursor/" :config (setopt electric-cursor-alist '((overwrite-mode . box) - (t . bar))) + (t . bar))) (electric-cursor-mode)) (use-package mode-line-bell @@ -378,10 +391,10 @@ With prefix ARG, toggle the value of (define-advice load-theme (:after (&rest _) mlscroll) (mlscroll-mode -1) (when (seq-intersection '(modus-vivendi modus-operandi) - custom-enabled-themes) + custom-enabled-themes) (modus-themes-with-colors - (setq mlscroll-in-color fg-dim - mlscroll-out-color bg-inactive))) + (setq mlscroll-in-color fg-dim + mlscroll-out-color bg-inactive))) (run-with-idle-timer 1 nil #'mlscroll-mode)) :config (load-theme@mlscroll)) @@ -399,8 +412,8 @@ With prefix ARG, toggle the value of :config (setopt ws-butler-trim-predicate (lambda (begin end) - (not (eq 'font-lock-string-face - (get-text-property end 'face))))) + (not (eq 'font-lock-string-face + (get-text-property end 'face))))) (ws-butler-global-mode)) (use-package wgrep @@ -408,16 +421,16 @@ With prefix ARG, toggle the value of :config (setopt wgrep-enable-key (kbd "C-x C-q")) :bind (:map grep-mode-map - ("C-x C-q" . wgrep-change-to-wgrep-mode))) + ("C-x C-q" . wgrep-change-to-wgrep-mode))) (use-package avy :ensure t :init (setopt avy-background t - avy-keys (string-to-list "asdfghjklqwertyuiopzxcvbnm")) + avy-keys (string-to-list "asdfghjklqwertyuiopzxcvbnm")) :bind (("M-j" . avy-goto-char-timer) - :map isearch-mode-map - ("M-j" . avy-isearch))) + :map isearch-mode-map + ("M-j" . avy-isearch))) (use-package zzz-to-char :ensure t @@ -426,16 +439,16 @@ With prefix ARG, toggle the value of (use-package anzu :ensure t :bind (("M-%" . anzu-query-replace-regexp) - ("C-M-%" . anzu-query-replace))) + ("C-M-%" . anzu-query-replace))) (use-package isearch-mb :ensure t :config (setopt isearch-lazy-count t - isearch-regexp-lax-whitespace t - search-whitespace-regexp "\\W+" - search-default-mode t ; Search regexp by default - isearch-wrap-pause 'no) + isearch-regexp-lax-whitespace t + search-whitespace-regexp "\\W+" + search-default-mode t ; Search regexp by default + isearch-wrap-pause 'no) (define-advice isearch-cancel (:before (&rest _) add-search-to-history) "Add search string to history when canceling." (unless (equal "" isearch-string) @@ -444,11 +457,11 @@ With prefix ARG, toggle the value of "Don't exit replace for any key that's not in `query-replace-map'." (save-window-excursion (cl-letf* ((lookup-key-orig (symbol-function 'lookup-key)) - ((symbol-function 'lookup-key) - (lambda (map key &optional accept-default) - (or (apply lookup-key-orig map key accept-default) - (when (eq map query-replace-map) 'help))))) - (apply orig r)))) + ((symbol-function 'lookup-key) + (lambda (map key &optional accept-default) + (or (apply lookup-key-orig map key accept-default) + (when (eq map query-replace-map) 'help))))) + (apply orig r)))) ;; Consult (autoload 'consult-line "consult" nil t) (autoload 'consult-isearch-history "consult" nil t) -- cgit 1.4.1-21-gabe81