diff options
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 961 |
1 files changed, 478 insertions, 483 deletions
diff --git a/init.el b/init.el index 8f2bc12..cec8777 100644 --- a/init.el +++ b/init.el | |||
@@ -3,7 +3,7 @@ | |||
3 | ;; Created: Sometime during Covid-19, 2020 | 3 | ;; Created: Sometime during Covid-19, 2020 |
4 | ;; Keywords: configuration | 4 | ;; Keywords: configuration |
5 | ;; URL: https://tildegit.org/acdw/emacs | 5 | ;; URL: https://tildegit.org/acdw/emacs |
6 | ;; Bankruptcy: 5d | 6 | ;; Bankruptcy: 6 |
7 | 7 | ||
8 | ;; This file is NOT part of GNU Emacs. | 8 | ;; This file is NOT part of GNU Emacs. |
9 | 9 | ||
@@ -16,54 +16,113 @@ | |||
16 | 16 | ||
17 | ;;; Code: | 17 | ;;; Code: |
18 | 18 | ||
19 | ;;; `setup' -- configuration macro | ||
20 | (straight-use-package '(setup :host nil | ||
21 | :repo "https://git.sr.ht/~zge/setup")) | ||
22 | (require 'setup) | ||
23 | |||
24 | ;; shorthand for `customize-set-variable' (via setup) | ||
25 | (defmacro setc (&rest args) | ||
26 | "Customize user options using ARGS like `setq'." | ||
27 | (declare (debug setq)) | ||
28 | `(setup (:option ,@args))) | ||
29 | |||
30 | ;; Install packages with `straight-use-package' | ||
31 | (setup-define :straight | ||
32 | (lambda (recipe) | ||
33 | `(straight-use-package ',recipe)) | ||
34 | :documentation "Install RECIPE with `straight-use-package'." | ||
35 | :repeatable t | ||
36 | :shorthand (lambda (sexp) | ||
37 | (let ((recipe (cadr sexp))) | ||
38 | (if (consp recipe) | ||
39 | (car recipe) | ||
40 | recipe)))) | ||
41 | |||
42 | ;; Bind keys to `acdw/map' | ||
43 | (setup-define :acdw/map | ||
44 | (lambda (key command) | ||
45 | `(define-key acdw/map | ||
46 | ,(if (stringp key) (kbd key) key) | ||
47 | #',command)) | ||
48 | :documentation "Bind KEY to COMMAND in `acdw/map'." | ||
49 | :debug '(form sexp) | ||
50 | :repeatable t) | ||
51 | |||
52 | ;; Bind keys to `acdw/leader' | ||
53 | (setup-define :acdw/leader | ||
54 | (lambda (key command) | ||
55 | `(define-key acdw/leader | ||
56 | ,(if (stringp key) (kbd key) key) | ||
57 | #',command)) | ||
58 | :documentation "Bind KEY to COMMAND in `acdw/leader' map." | ||
59 | :debug '(form sexp) | ||
60 | :repeatable t) | ||
61 | |||
62 | ;; Bind keys, and autoload the functions they're bound to. | ||
63 | (setup-define :bind-autoload | ||
64 | (lambda (key command) | ||
65 | `(progn | ||
66 | (autoload #',command (symbol-name setup-name)) | ||
67 | (define-key (symbol-value setup-map) | ||
68 | ,(if (stringp key) (kbd key) key) | ||
69 | #',command))) | ||
70 | :documentation "Bind KEY to COMMAND, and autload COMMAND from FEATURE." | ||
71 | :debug '(form sexp) | ||
72 | :repeatable t) | ||
73 | |||
19 | ;;; About me | 74 | ;;; About me |
20 | (acdw/set | 75 | (setc user-full-name "Case Duckworth" |
21 | '((user-full-name "Case Duckworth") | 76 | user-mail-address "acdw@acdw.net" |
22 | (user-mail-address "acdw@acdw.net") | 77 | calendar-location-name "Baton Rouge, LA" |
23 | (calendar-location-name "Baton Rouge, LA") | 78 | calendar-latitude 30.4 |
24 | (calendar-latitude 30.4) | 79 | calendar-longitude -91.1) |
25 | (calendar-longitude -91.1) | ||
26 | (calendar-date-style iso))) | ||
27 | 80 | ||
28 | ;;; Good defaults | 81 | ;;; Good defaults |
29 | 82 | ||
30 | ;; Lines | 83 | ;; Lines |
31 | (acdw/set '((fill-column 80))) | 84 | (setc fill-column 80 |
32 | (global-display-fill-column-indicator-mode +1) | 85 | word-wrap t |
86 | truncate-lines nil) | ||
33 | (add-hook 'text-mode-hook #'turn-on-auto-fill) | 87 | (add-hook 'text-mode-hook #'turn-on-auto-fill) |
34 | (add-hook 'prog-mode-hook #'turn-on-auto-fill) | 88 | (add-hook 'prog-mode-hook #'turn-on-auto-fill) |
89 | (global-display-fill-column-indicator-mode +1) | ||
35 | (global-so-long-mode +1) | 90 | (global-so-long-mode +1) |
36 | 91 | ||
37 | ;; I don't want `visual-line-mode', because I really only want to wrap and | ||
38 | ;; truncate lines. Believe me, I know what I'm doing. | ||
39 | (acdw/set '((word-wrap t) | ||
40 | (truncate-lines nil))) | ||
41 | |||
42 | ;; Whitespace | 92 | ;; Whitespace |
43 | (acdw/set '((whitespace-style | 93 | (setc whitespace-style |
44 | (empty indentation space-before-tab space-after-tab)) | 94 | '(empty indentation space-before-tab space-after-tab) |
45 | (indent-tabs-mode nil "We've lost this battle...") | 95 | indent-tabs-mode nil |
46 | (tab-width 4))) | 96 | tab-width 4 |
97 | smie-indent-basic tab-width) | ||
47 | (add-hook 'before-save-hook #'whitespace-cleanup) | 98 | (add-hook 'before-save-hook #'whitespace-cleanup) |
48 | 99 | ||
49 | ;; Pairs | 100 | ;; Pairs |
50 | (add-hook 'prog-mode-hook #'electric-pair-local-mode) | 101 | (setc show-paren-delay 0 |
51 | (acdw/set '((show-paren-delay 0) | 102 | show-paren-style 'mixed |
52 | (show-paren-style mixed) | 103 | show-paren-when-point-inside-paren t |
53 | (show-paren-when-point-inside-paren t) | 104 | show-paren-when-point-in-periphery t) |
54 | (show-paren-when-point-in-periphery t))) | ||
55 | (show-paren-mode +1) | 105 | (show-paren-mode +1) |
106 | (add-hook 'prog-mode-hook #'electric-pair-local-mode) | ||
56 | 107 | ||
57 | ;; Killing & Yanking | 108 | ;; Killing and yanking |
109 | (setc save-interprogram-paste-before-kill t | ||
110 | yank-pop-change-selection t | ||
111 | x-select-enable-clipboard t | ||
112 | x-select-enable-primary t | ||
113 | mouse-drag-copy-region t | ||
114 | kill-do-not-save-duplicates t) | ||
58 | (delete-selection-mode +1) | 115 | (delete-selection-mode +1) |
59 | (acdw/set '((save-interprogram-paste-before-kill t) | ||
60 | (yank-pop-change-selection t) | ||
61 | (x-select-enable-clipboard t) | ||
62 | (x-select-enable-primary t) | ||
63 | (mouse-drag-copy-region t) | ||
64 | (kill-do-not-save-duplicates t))) | ||
65 | 116 | ||
66 | ;; Encoding | 117 | ;; Encoding |
118 | (setc local-coding-system 'utf-8-unix | ||
119 | coding-system-for-read 'utf-8-unix | ||
120 | coding-system-for-write 'utf-8-unix | ||
121 | buffer-file-coding-system 'utf-8-unix | ||
122 | org-export-coding-system 'utf-8-unix | ||
123 | org-html-coding-system 'utf-8-unix | ||
124 | default-process-coding-system '(utf-8-unix . utf-8-unix) | ||
125 | x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)) | ||
67 | (set-charset-priority 'unicode) | 126 | (set-charset-priority 'unicode) |
68 | (set-language-environment "UTF-8") | 127 | (set-language-environment "UTF-8") |
69 | (prefer-coding-system 'utf-8-unix) | 128 | (prefer-coding-system 'utf-8-unix) |
@@ -71,453 +130,387 @@ | |||
71 | (set-terminal-coding-system 'utf-8-unix) | 130 | (set-terminal-coding-system 'utf-8-unix) |
72 | (set-keyboard-coding-system 'utf-8-unix) | 131 | (set-keyboard-coding-system 'utf-8-unix) |
73 | (set-selection-coding-system 'utf-8-unix) | 132 | (set-selection-coding-system 'utf-8-unix) |
74 | (acdw/set '((locale-coding-system utf-8-unix) | 133 | |
75 | (coding-system-for-read utf-8-unix) | 134 | ;; Uniquify |
76 | (coding-system-for-write utf-8-unix) | 135 | (setup (:require uniquify) |
77 | (buffer-file-coding-system utf-8-unix) | 136 | (:option uniquify-buffer-name-style 'forward |
78 | (org-export-coding-system utf-8-unix) | 137 | uniquify-separator path-separator |
79 | (org-html-coding-system utf-8-unix) | 138 | uniquify-after-kill-buffer-p t |
80 | (default-process-coding-system (utf-8-unix . utf-8-unix)) | 139 | uniquify-ignore-buffers-re "^\\*")) |
81 | (x-select-request-type (UTF8_STRING COMPOUND_TEXT TEXT STRING)))) | 140 | |
82 | 141 | ;; Files | |
83 | ;; Unique buffer names | 142 | (setc backup-directory-alist `((".*" . ,(acdw/in-dir "backup/" t))) |
84 | (when (require 'uniquify) | 143 | tramp-backup-directory-alist backup-directory-alist |
85 | (acdw/set '((uniquify-buffer-name-style forward) | 144 | auto-save-file-name-transforms `((".*" ,(acdw/in-dir "auto-save/" t) t)) |
86 | (uniquify-separator "/") | 145 | auto-save-list-file-prefix (acdw/in-dir "auto-save-list/.saves-" t) |
87 | (uniquify-after-kill-buffer-p t) | 146 | backup-by-copying t |
88 | (uniquify-ignore-buffers-re "^\\*")))) | 147 | delete-old-versions t |
89 | 148 | version-control t | |
90 | ;; Backups | 149 | vc-make-backup-files t) |
91 | (acdw/set `((backup-by-copying t) | ||
92 | (delete-old-versions -1) | ||
93 | (version-control t) | ||
94 | (vc-make-backup-files t) | ||
95 | (backup-directory-alist ((".*" . ,(acdw/in-dir "backup/" t)))))) | ||
96 | ;; Autosaves | ||
97 | (acdw/set `((auto-save-file-name-transforms | ||
98 | ((".*" ,(acdw/in-dir "auto-save/" t) t))) | ||
99 | (auto-save-list-file-prefix | ||
100 | ,(acdw/in-dir "auto-save-list/.saves-" t)))) | ||
101 | (auto-save-visited-mode +1) | 150 | (auto-save-visited-mode +1) |
102 | 151 | ||
103 | (defun hook--auto-save-when-unfocused () | ||
104 | "Save all buffers when out of focus." | ||
105 | (acdw/when-unfocused #'save-some-buffers t)) | ||
106 | (add-function :after after-focus-change-function | 152 | (add-function :after after-focus-change-function |
107 | #'hook--auto-save-when-unfocused) | 153 | (defun hook--auto-save-when-unfocused () |
108 | 154 | "Save all buffers when out of focus." | |
109 | ;; Auto-revert | 155 | (acdw/when-unfocused #'save-some-buffers t))) |
110 | (when (require 'autorevert) | 156 | |
111 | (global-auto-revert-mode +1)) | 157 | (setup (:require autorevert) |
112 | ;; Save place | 158 | (global-auto-revert-mode +1)) |
113 | (when (require 'saveplace) | 159 | |
114 | (acdw/set | 160 | (setup (:require saveplace) |
115 | `((save-place-file ,(acdw/in-dir "places.el")) | 161 | (:option save-place-file (acdw/in-dir "places.el") |
116 | (save-place-forget-unreadable-files ,(eq acdw/system :home)))) | 162 | save-place-forget-unreadable-files (eq acdw/system :home)) |
117 | (save-place-mode +1)) | 163 | (save-place-mode +1)) |
118 | ;; Recent files | 164 | |
119 | (when (require 'recentf) | 165 | (setup (:require recentf) |
120 | (acdw/set | 166 | (:option recentf-save-file (acdw/in-dir "recentf.el") |
121 | `((recentf-save-file ,(acdw/in-dir "recentf.el")) | 167 | recentf-max-menu-items 100 |
122 | (recentf-max-menu-items 100) | 168 | recentf-max-saved-items nil |
123 | (recentf-max-saved-items nil) | 169 | recentf-auto-cleanup 60 |
124 | (recentf-auto-cleanup 60 "Cleanup the recentf list when idle for 60s."))) | 170 | (append recentf-exclude) acdw/dir) |
125 | (add-to-list 'recentf-exclude acdw/dir) | ||
126 | (recentf-mode +1)) | 171 | (recentf-mode +1)) |
127 | 172 | ||
128 | ;; Move the custom file | 173 | ;; Minibuffer |
129 | (acdw/set `((custom-file ,(acdw/in-dir "custom.el")))) | 174 | (setc minibuffer-prompt-properties |
175 | '(read-only t | ||
176 | cursor-intangible t | ||
177 | face minibuffer-prompt) | ||
178 | enable-recursive-minibuffers t | ||
179 | file-name-shadow-properties '(invisible t intangible t) | ||
180 | read-answer-short t) | ||
181 | (minibuffer-depth-indicate-mode +1) | ||
182 | (file-name-shadow-mode +1) | ||
183 | (fset 'yes-or-no-p #'y-or-n-p) | ||
184 | |||
185 | (setup (:require savehist) | ||
186 | (:option (append savehist-additional-variables) 'kill-ring | ||
187 | (append savehist-additional-variables) 'search-ring | ||
188 | (append savehist-additional-variables) 'regexp-search-ring | ||
189 | history-length t | ||
190 | history-delete-duplicates t | ||
191 | savehist-autosave-interval 6 | ||
192 | savehist-file (acdw/in-dir "savehist.el")) | ||
193 | (savehist-mode +1)) | ||
130 | 194 | ||
131 | ;; Cursor | 195 | (setup (:require icomplete) |
132 | (acdw/set '((cursor-type bar) | 196 | (:option completion-ignore-case t |
133 | (cursor-in-non-selected-windows hollow))) | 197 | read-buffer-completion-ignore-case t |
198 | icomplete-delay-completions-threshold 0 | ||
199 | icomplete-max-delay-chars 0 | ||
200 | icomplete-compute-delay 0 | ||
201 | icomplete-show-matches-on-no-input t | ||
202 | icomplete-with-buffer-completion-tables t | ||
203 | icomplete-in-buffer t | ||
204 | completion-styles '(partial-completion substring flex)) | ||
205 | (fido-mode -1) | ||
206 | (icomplete-mode +1)) | ||
207 | |||
208 | (setup imenu | ||
209 | (:option imenu-auto-rescan t)) | ||
134 | 210 | ||
135 | ;; (defun hook--overwrite-mode-change-cursor () | 211 | ;; Cursor |
136 | ;; (setq cursor-type (if overwrite-mode 'hbar 'bar))) | 212 | (setc cursor-type 'bar |
137 | ;; (add-hook 'overwrite-mode-hook #'hook--overwrite-mode-change-cursor) | 213 | cursor-in-non-selected-windows 'hollow) |
138 | 214 | ||
139 | ;; Scrolling | 215 | ;; Scrolling |
140 | (acdw/set '((auto-window-vscroll nil) | 216 | (setc auto-window-vscroll nil |
141 | (fast-but-imprecise-scrolling t) | 217 | fast-but-imprecise-scrolling t |
142 | (scroll-margin 0) | 218 | scroll-margin 0 |
143 | (scroll-conservatively 101) | 219 | scroll-conservatively 101 |
144 | (scroll-preserve-screen-position 1))) | 220 | scroll-preserve-screen-position 1) |
145 | 221 | ||
146 | ;; Bindings | 222 | ;; MS Windows |
147 | (acdw/binds (("C-h" ehelp-command :after ("ehelp" nil nil 'keymap)) | 223 | (setc w32-allow-system-shell t |
148 | ([remap just-one-space] cycle-spacing) | 224 | w32-pass-lwindow-to-system nil |
149 | ("M-/" hippie-expand) | 225 | w32-lwindow-modifier 'super |
150 | ("M-=" count-words) | 226 | w32-pass-rwindow-to-system nil |
151 | ("C-x C-b" ibuffer))) | 227 | w32-rwindow-modifier 'super |
152 | 228 | w32-pass-apps-to-system nil | |
153 | ;;; Startup | 229 | w32-apps-modifier 'hyper) |
154 | (acdw/set `((inhibit-startup-screen t) | 230 | |
155 | (initial-buffer-choice t) | 231 | ;; Dired |
156 | (initial-scratch-message | 232 | (setup dired |
157 | ,(concat ";; Howdy, " | 233 | (:option dired-recursive-copies 'always |
158 | (nth 0 (split-string user-full-name)) "!" | 234 | dired-recursive-deletes 'always |
159 | " Welcome to GNU Emacs.\n\n")))) | 235 | delete-by-moving-to-trash t |
160 | 236 | dired-listing-switches "-Al" | |
161 | ;;; Windows settings | 237 | ls-lisp-dirs-first t |
162 | (when (eq acdw/system :work) | 238 | dired-ls-F-marks-symlinks t |
163 | (acdw/set `((w32-allow-system-shell t) | 239 | dired-no-confirm '(byte-compile |
164 | (w32-pass-lwindow-to-system nil) | 240 | chgrp chmod chown copy |
165 | (w32-lwindow-modifier 'super) | 241 | hardlink load move |
166 | (w32-pass-rwindow-to-system nil) | 242 | shell touch symlink) |
167 | (w32-rwindow-modifier 'super) | 243 | dired-dwim-target t) |
168 | (w32-pass-apps-to-system nil) | 244 | (:also-load dired-x) |
169 | (w32-apps-modifier 'hyper)))) | 245 | (:hook dired-hide-details-mode |
246 | hl-line-mode) | ||
247 | (:acdw/map "C-x C-j" dired-jump)) | ||
248 | |||
249 | ;; Eshell | ||
250 | (setup eshell | ||
251 | (:option eshell-directory-name (acdw/in-dir "eshell/" t) | ||
252 | eshell-aliases-file (acdw/in-dir "eshell/aliases" t))) | ||
170 | 253 | ||
171 | (acdw/set '((default-directory (expand-file-name "~/")))) | 254 | ;; Garbage collection |
255 | (add-hook 'minibuffer-setup-hook #'acdw/gc-disable) | ||
256 | (add-hook 'minibuffer-exit-hook #'acdw/gc-enable) | ||
257 | (add-function :after after-focus-change-function | ||
258 | (defun hook--gc-when-unfocused () | ||
259 | (acdw/when-unfocused #'garbage-collect))) | ||
260 | |||
261 | ;; Etc. good defaults | ||
262 | (setc custom-file (acdw/in-dir "custom.el") | ||
263 | inhibit-startup-screen t | ||
264 | initial-buffer-choice t | ||
265 | initial-scratch-message (concat ";; Howdy, " (nth 0 (split-string | ||
266 | user-full-name)) | ||
267 | "! Welcome to GNU Emacs.\n\n") | ||
268 | default-directory (expand-file-name "~/") | ||
269 | disabled-command-function nil | ||
270 | load-prefer-newer t | ||
271 | comp-async-report-warnings-errors nil | ||
272 | frame-title-format "%b %+%* GNU Emacs") | ||
273 | |||
274 | ;; Etc. bindings | ||
275 | (autoload 'ehelp-command "ehelp" nil nil 'keymap) | ||
276 | (define-key acdw/map (kbd "C-h") 'ehelp-command) | ||
277 | (define-key acdw/map [remap just-one-space] #'cycle-spacing) | ||
278 | (define-key acdw/map (kbd "M-/") #'hippie-expand) | ||
279 | (define-key acdw/map (kbd "M-=") #'count-words) | ||
280 | (define-key acdw/map (kbd "C-x C-b") #'ibuffer) | ||
281 | |||
282 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
283 | ;;; Here ends the package-less configuration. Everything following requires a | ||
284 | ;;; package to be downloaded. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
285 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
286 | |||
287 | ;;; Interactivity | ||
288 | |||
289 | |||
290 | ;;;; Begin-end | ||
291 | (setup (:straight beginend) | ||
292 | (beginend-global-mode +1)) | ||
293 | |||
294 | ;;;; Expand-region | ||
295 | (setup (:straight expand-region) | ||
296 | (:acdw/map "C-=" er/expand-region)) | ||
297 | |||
298 | ;;;; CRUX | ||
299 | (setup (:straight crux) | ||
300 | (:with-map acdw/map | ||
301 | (:bind "M-o" crux-other-window-or-switch-buffer) | ||
302 | (:bind "C-a" crux-move-beginning-of-line) | ||
303 | (:bind "C-k" crux-kill-and-join-forward)) | ||
304 | (crux-reopen-as-root-mode +1)) | ||
305 | |||
306 | ;;; Functionality | ||
307 | |||
308 | ;;;; Undo-fu | ||
309 | (setup (:straight undo-fu) | ||
310 | (:with-map acdw/map | ||
311 | (:bind "C-/" undo-fu-only-undo | ||
312 | "C-?" undo-fu-only-redo))) | ||
313 | |||
314 | (setup (:straight undo-fu-session) | ||
315 | (:option undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'" | ||
316 | "/git-rebase-todo\\'") | ||
317 | undo-fu-session-directory (acdw/in-dir "undo/" t)) | ||
318 | (global-undo-fu-session-mode +1)) | ||
172 | 319 | ||
173 | ;;; Minibuffer | 320 | ;;; Minibuffer |
174 | 321 | ||
175 | (acdw/set '((minibuffer-prompt-properties (read-only t | 322 | ;;;; Icomplete-vertical |
176 | cursor-intangible t | 323 | (setup (:straight icomplete-vertical) |
177 | face minibuffer-prompt)) | 324 | (let ((map icomplete-minibuffer-map)) |
178 | (enable-recursive-minibuffers t) | 325 | (let ((command #'icomplete-forward-completions)) |
179 | (file-name-shadow-properties (invisible t)))) | 326 | (define-key map (kbd "<down>") command) |
180 | (minibuffer-depth-indicate-mode +1) | 327 | (define-key map (kbd "C-n") command)) |
181 | (file-name-shadow-mode +1) | 328 | (let ((command #'icomplete-backward-completions)) |
182 | 329 | (define-key map (kbd "<up>") command) | |
183 | (acdw/pkg recursion-indicator | 330 | (define-key map (kbd "C-p") command)) |
184 | :set '((recursion-indicator-general "%") | 331 | (define-key map (kbd "RET") #'icomplete-force-complete-and-exit) |
185 | (recursion-indicator-minibuffer "@")) | 332 | (define-key map (kbd "C-RET") #'minibuffer-complete-and-exit)) |
186 | :now ((recursion-indicator-mode +1))) | 333 | (icomplete-vertical-mode +1)) |
187 | 334 | ||
188 | ;; Save history | 335 | ;;;; Orderless |
189 | (when (require 'savehist) | 336 | (setup (:straight orderless) |
190 | (acdw/set `((savehist-additional-variables | 337 | (:option (prepend completion-styles) 'orderless)) |
191 | (kill-ring search-ring regexp-search-ring)) | 338 | |
192 | (history-length t) | 339 | ;;;; Consult |
193 | (history-delete-duplicates t) | 340 | (setup (:straight consult) |
194 | (savehist-autosave-interval 6) | 341 | (:with-map acdw/map |
195 | (savehist-file ,(acdw/in-dir "savehist.el")))) | 342 | (:bind-autoload |
196 | (savehist-mode +1)) | 343 | ;; C-c bindings (`mode-specific-map') |
197 | 344 | "C-c h" consult-history | |
198 | ;; God mode | 345 | "C-c m" consult-mode-command |
199 | (acdw/pkg god-mode | 346 | ;; C-x bindings (`ctl-x-map') |
200 | :binds (("<escape>" god-local-mode) | 347 | "C-x M-:" consult-complex-command |
201 | ("i" god-local-mode :map god-local-mode-map) | 348 | "C-x b" consult-buffer |
202 | ("." repeat :map god-local-mode-map) | 349 | "C-x 4 b" consult-buffer-other-window |
203 | ("C-x C-1" delete-other-windows) | 350 | "C-x 5 b" consult-buffer-other-frame |
204 | ("C-x C-2" split-window-below) | 351 | "C-x r x" consult-register |
205 | ("C-x C-3" split-window-right) | 352 | "C-x r b" consult-bookmark |
206 | ("C-x C-0" delete-window)) | 353 | ;; M-g bindings (`goto-map') |
207 | :now ((defun acdw/god-mode-update-cursor () | 354 | "M-g o" consult-outline |
208 | (setq cursor-type (if (or god-local-mode buffer-read-only) | 355 | "M-g m" consult-mark |
209 | 'box | 356 | "M-g k" consult-global-mark |
210 | 'bar))) | 357 | "M-g i" consult-imenu |
211 | (defun acdw/god-mode-toggle-on-overwrite () | 358 | "M-g e" consult-error |
212 | (if (bound-and-true-p overwrite-mode) | 359 | ;; M-s bindings (`search-map') |
213 | (progn | 360 | "M-s g" consult-grep ; alts: consult-git-grep, consult-ripgrep |
214 | (setq cursor-type 'hbar) | 361 | "M-s f" consult-find ; alts: consult-locate |
215 | (god-local-mode-pause)) | 362 | "M-s l" consult-line |
216 | (god-local-mode-resume) | 363 | "M-s m" consult-multi-occur |
217 | (acdw/god-mode-update-cursor))) | 364 | "M-s k" consult-keep-lines |
218 | (require 'god-mode) | 365 | "M-s u" consult-focus-lines |
219 | (god-mode)) | 366 | ;; Other bindings |
220 | :hooks (((god-mode-enabled-hook god-mode-disabled-hook) | 367 | "M-y" consult-yank-pop |
221 | acdw/god-mode-update-cursor) | 368 | "<f1> a" consult-apropos |
222 | (overwrite-mode-hook acdw/god-mode-toggle-on-overwrite))) | 369 | "C-h a" consult-apropos)) |
223 | 370 | (autoload 'consult-register-preview "consult") | |
224 | ;; Icomplete (-vertical) | 371 | (:option register-preview-delay 0 |
225 | (when (require 'icomplete) | 372 | register-preview-function #'consult-register-preview)) |
226 | (acdw/set '((completion-ignore-case t) | 373 | |
227 | (read-buffer-completion-ignore-case t) | 374 | ;;;; Marginalia |
228 | (icomplete-delay-completions-threshold 0) | 375 | (setup (:straight marginalia) |
229 | (icomplete-max-delay-chars 0) | 376 | (:option marginalia-annotators '(marginalia-annotators-heavy |
230 | (icomplete-compute-delay 0) | 377 | marginalia-annotators-light)) |
231 | (icomplete-show-matches-on-no-input t) | 378 | (marginalia-mode +1)) |
232 | (icomplete-with-buffer-completion-tables t) | 379 | |
233 | (icomplete-in-buffer t))) | 380 | ;;; UI |
234 | (acdw/pkg orderless | 381 | |
235 | :set '((completion-styles (orderless)))) | 382 | ;;;; Modus themes |
236 | (acdw/pkg icomplete-vertical | 383 | (setup (:straight (modus-themes |
237 | :binds (("<down>" icomplete-forward-completions | 384 | :host gitlab |
238 | :map icomplete-minibuffer-map) | 385 | :repo "protesilaos/modus-themes")) |
239 | ("C-n" icomplete-forward-completions | 386 | (:option modus-themes-slanted-constructs t |
240 | :map icomplete-minibuffer-map) | 387 | modus-themes-bold-constructs t |
241 | ("<up>" icomplete-backward-completions | 388 | modus-themes-region 'bg-only |
242 | :map icomplete-minibuffer-map) | 389 | modus-themes-org-blocks 'grayscale |
243 | ("C-p" icomplete-backward-completions | 390 | modus-themes-headings '((1 . section) |
244 | :map icomplete-minibuffer-map) | 391 | (t . no-color)) |
245 | ("C-v" icomplete-vertical-toggle | 392 | modus-themes-mode-line nil) |
246 | :map icomplete-minibuffer-map) | 393 | (acdw/sunrise-sunset #'modus-themes-load-operandi |
247 | ("RET" icomplete-force-complete-and-exit | 394 | #'modus-themes-load-vivendi)) |
248 | :map icomplete-minibuffer-map) | 395 | |
249 | ("C-j" minibuffer-complete-and-exit | 396 | ;;;; Mode line |
250 | :map icomplete-minibuffer-map)) | 397 | (setup (:straight simple-modeline) |
251 | :now ((fido-mode -1) | 398 | (setup (:straight minions)) |
252 | (icomplete-mode +1) | 399 | (:option simple-modeline-segments |
253 | (icomplete-vertical-mode +1)))) | 400 | '((acdw-modeline/modified |
254 | 401 | acdw-modeline/buffer-name | |
255 | ;; Consult | 402 | acdw-modeline/vc-branch |
256 | (acdw/pkg consult | 403 | simple-modeline-segment-position |
257 | :binds (;; C-c bindings (`mode-specific-map') | 404 | simple-modeline-segment-word-count) |
258 | ("C-c h" consult-history) | 405 | (simple-modeline-segment-misc-info |
259 | ("C-c m" consult-mode-command) | 406 | simple-modeline-segment-process |
260 | ;; C-x bindings (`ctl-x-map') | 407 | acdw-modeline/god-mode-indicator |
261 | ("C-x M-:" consult-complex-command) | 408 | acdw-modeline/minions |
262 | ("C-x b" consult-buffer) | 409 | simple-modeline-segment-major-mode))) |
263 | ("C-x 4 b" consult-buffer-other-window) | 410 | (require 'acdw-modeline) |
264 | ("C-x 5 b" consult-buffer-other-frame) | 411 | (simple-modeline-mode +1)) |
265 | ("C-x r x" consult-register) | 412 | |
266 | ("C-x r b" consult-bookmark) | 413 | ;;; Utilities |
267 | ;; M-g bindings (`goto-map') | 414 | |
268 | ("M-g o" consult-outline) | 415 | ;;;; 0x0 -- upload files to a nullpointer |
269 | ("M-g m" consult-mark) | 416 | (setup (:straight (0x0 :host nil |
270 | ("M-g k" consult-global-mark) | 417 | :repo "https://git.sr.ht/~zge/nullpointer-emacs")) |
271 | ("M-g i" consult-imenu) | 418 | (:option 0x0-default-host 'ttm)) |
272 | ("M-g e" consult-error) | 419 | |
273 | ;; M-s bindings (`search-map') | 420 | ;;; Applications |
274 | ("M-s g" consult-grep) ; alts: | 421 | |
275 | ; consult-git-grep, | 422 | ;;;; Magit |
276 | ; consult-ripgrep | 423 | (setup (:straight magit) |
277 | ("M-s f" consult-find) ; alts: | 424 | (:acdw/leader "g" magit-status) |
278 | ; consult-locate | 425 | (:option magit-display-buffer-function |
279 | ("M-s l" consult-line) | 426 | (defun magit-display-buffer-same-window (buffer) |
280 | ("M-s m" consult-multi-occur) | ||
281 | ("M-s k" consult-keep-lines) | ||
282 | ("M-s u" consult-focus-lines) | ||
283 | ;; Other bindings | ||
284 | ("M-y" consult-yank-pop) | ||
285 | ("<f1> a" consult-apropos) | ||
286 | ("C-h a" consult-apropos)) | ||
287 | :now ((autoload 'consult-register-preview "consult")) | ||
288 | :set '((register-preview-delay 0) | ||
289 | (register-preview-function #'consult-register-preview))) | ||
290 | |||
291 | ;; begin-end | ||
292 | (acdw/pkg beginend | ||
293 | :now ((beginend-global-mode))) | ||
294 | |||
295 | ;; Marginalia | ||
296 | (acdw/pkg marginalia | ||
297 | :set '((marginalia-annotators (marginalia-annotators-heavy | ||
298 | marginalia-annotators-light))) | ||
299 | :now ((marginalia-mode +1))) | ||
300 | |||
301 | ;; Imenu | ||
302 | (when (require 'imenu) | ||
303 | (acdw/set '((imenu-auto-rescan t)))) | ||
304 | |||
305 | ;; Fonts | ||
306 | (acdw/set-faces ((fixed-pitch . ((t (:inherit default)))))) | ||
307 | |||
308 | ;;; Packages | ||
309 | |||
310 | ;; Undo-fu | ||
311 | (acdw/pkg undo-fu | ||
312 | :binds (("C-/" undo-fu-only-undo) | ||
313 | ("C-?" undo-fu-only-redo))) | ||
314 | (acdw/pkg undo-fu-session | ||
315 | :set `((undo-fu-session-incompatible-files ("/COMMIT_EDITMSG\\'" | ||
316 | "/git-rebase-todo\\'")) | ||
317 | (undo-fu-session-directory ,(acdw/in-dir "undo/" t))) | ||
318 | :then ((global-undo-fu-session-mode +1))) | ||
319 | |||
320 | ;; Modus themes | ||
321 | (acdw/pkg (modus-themes | ||
322 | :host gitlab | ||
323 | :repo "protesilaos/modus-themes") | ||
324 | :set `((modus-themes-slanted-constructs t) | ||
325 | (modus-themes-bold-constructs t) | ||
326 | (modus-themes-region 'bg-only) | ||
327 | (modus-themes-org-blocks 'grayscale) | ||
328 | (modus-themes-headings ((1 . section) | ||
329 | (t . no-color))) | ||
330 | (modus-themes-scale-headings nil) | ||
331 | (modus-themes-mode-line nil)) | ||
332 | :now ((acdw/sunrise-sunset #'modus-themes-load-operandi | ||
333 | #'modus-themes-load-vivendi))) | ||
334 | |||
335 | ;; Expand-region | ||
336 | (acdw/pkg expand-region | ||
337 | :binds (("C-=" er/expand-region))) | ||
338 | |||
339 | ;; CRUX | ||
340 | (acdw/pkg crux | ||
341 | :binds (("M-o" crux-other-window-or-switch-buffer) | ||
342 | ([remap move-beginning-of-line] crux-move-beginning-of-line) | ||
343 | ([remap kill-line] crux-kill-and-join-forward))) | ||
344 | ;;; Frame title | ||
345 | |||
346 | (acdw/set `((frame-title-format | ||
347 | "%b %+%* GNU Emacs"))) | ||
348 | |||
349 | ;;; Mode line | ||
350 | |||
351 | ;; Minions | ||
352 | (acdw/pkg minions) | ||
353 | |||
354 | ;; Simple mode line | ||
355 | (acdw/pkg simple-modeline | ||
356 | :set '((simple-modeline-segments | ||
357 | ((;; left | ||
358 | acdw-modeline/modified | ||
359 | acdw-modeline/buffer-name | ||
360 | acdw-modeline/vc-branch | ||
361 | simple-modeline-segment-position | ||
362 | simple-modeline-segment-word-count) | ||
363 | (;; right | ||
364 | simple-modeline-segment-misc-info | ||
365 | simple-modeline-segment-process | ||
366 | acdw-modeline/god-mode-indicator | ||
367 | acdw-modeline/minions | ||
368 | simple-modeline-segment-major-mode)))) | ||
369 | :now ((require 'acdw-modeline) | ||
370 | (simple-modeline-mode +1))) | ||
371 | |||
372 | ;;; Magit | ||
373 | |||
374 | (acdw/pkg magit | ||
375 | :binds (("g" magit-status :map acdw/leader)) | ||
376 | :set `((magit-display-buffer-function | ||
377 | ,(defun magit-display-buffer-same-window (buffer) | ||
378 | "Display BUFFER in the selected window like God intended." | 427 | "Display BUFFER in the selected window like God intended." |
379 | (display-buffer buffer | 428 | (display-buffer buffer '(display-buffer-same-window))) |
380 | '(display-buffer-same-window)))) | 429 | magit-popup-display-buffer-action '((display-buffer-same-window)))) |
381 | (magit-popup-display-buffer-action | ||
382 | ((display-buffer-same-window))))) | ||
383 | 430 | ||
384 | ;;; Web browsing | 431 | ;;;; File browsing |
432 | (setup (:straight dired-subtree) | ||
433 | (define-key dired-mode-map "i" #'dired-subtree-toggle)) | ||
385 | 434 | ||
386 | (acdw/set '((browse-url-browser-function browse-url-firefox) | 435 | (setup (:straight dired-collapse) |
387 | (browse-url-new-window-flag t) | 436 | (:hook-into dired-mode)) |
388 | (browse-url-firefox-new-window-is-tab t) | ||
389 | (shr-max-width fill-column) | ||
390 | (shr-width fill-column))) | ||
391 | 437 | ||
438 | ;;;; Web browsing | ||
392 | (when (eq acdw/system :work) | 439 | (when (eq acdw/system :work) |
393 | (add-to-list 'exec-path "C:/Program Files/Mozilla Firefox")) | 440 | (add-to-list 'exec-path "C:/Program Files/Mozilla Firefox")) |
394 | 441 | ||
395 | (acdw/hooks ((text-mode-hook goto-address-mode) | 442 | (setc browse-url-browser-function 'browse-url-firefox |
396 | (prog-mode-hook goto-address-prog-mode))) | 443 | browse-url-new-window-flag t |
397 | 444 | browse-url-firefox-new-window-is-tab t | |
398 | ;;; Gemini/gopher browsing | 445 | shr-max-width fill-column |
399 | 446 | shr-width fill-column) | |
400 | (acdw/pkg (elpher | 447 | |
401 | :repo "git://thelambdalab.xyz/elpher.git") | 448 | (add-hook 'text-mode-hook #'goto-address-mode) |
402 | :set '((elpher-ipv4-always t) | 449 | (add-hook 'prog-mode-hook #'goto-address-prog-mode) |
403 | (elpher-certificate-directory | 450 | |
404 | (acdw/in-var "elpher/"))) | 451 | ;;;; Gemini/gopher browsing |
405 | :now ((acdw/bind-after-map "elpher" elpher-mode-map | 452 | (setup (:straight (elpher :host nil |
406 | (("n" elpher-next-link :map-after "elpher") | 453 | :repo "git://thelambdalab.xyz/elpher.git")) |
407 | ("p" elpher-prev-link :map-after "elpher") | 454 | (:option elpher-ipv4-always t |
408 | ("o" elpher-follow-current-link :map-after "elpher") | 455 | elpher-certificate-directory (acdw/in-dir "elpher/")) |
409 | ("G" elpher-go-current :map-after "elpher"))) | 456 | (:bind "n" elpher-next-link |
410 | (when (boundp 'god-exempt-major-modes) | 457 | "p" elpher-prev-link |
411 | (add-to-list 'god-exempt-major-modes 'elpher-mode)))) | 458 | "o" elpher-follow-current-link |
412 | 459 | "G" elpher-go-current) | |
413 | (acdw/pkg (gemini-mode | 460 | (:hook acdw/reading-mode) |
414 | :repo "https://git.carcosa.net/jmcbray/gemini.el.git") | 461 | (when (boundp 'god-exempt-major-modes) |
415 | :now ((add-to-list 'auto-mode-alist | 462 | (:option (append god-exempt-major-modes) 'elpher-mode))) |
416 | '("\\.\\(gemini\\|gmi\\)\\'" . gemini-mode)))) | 463 | |
417 | 464 | (setup (:straight (gemini-mode | |
418 | ;;; Dired | 465 | :host nil |
419 | (acdw/pkg dired | 466 | :repo "https://git.carcosa.net/jmcbray/gemini.el.git")) |
420 | :local t | 467 | (:option (append auto-mode-alist) |
421 | :set `((dired-recursive-copies always) | 468 | '("\\.\\(gemini\\|gmi\\)\\'" . gemini-mode))) |
422 | (dired-recursive-deletes always) | 469 | |
423 | (delete-by-moving-to-trash t) | 470 | ;;;; Read e-books (nov.el) |
424 | (dired-listing-switches "-Al") | 471 | (setup (:straight nov) |
425 | (ls-lisp-dirs-first t) | 472 | (:option nov-text-width fill-column |
426 | (dired-dwim-target t)) | 473 | (append auto-mode-alist) '("\\.epub\\'" . nov-mode))) |
427 | :now ((autoload 'dired-mode-map "dired" nil nil 'keymap) | 474 | |
428 | (acdw/pkg dired-subtree) | 475 | ;;;; Org mode |
429 | (acdw/pkg dired-x | 476 | (setup (:straight (org :host nil |
430 | :local t | 477 | :repo "https://code.orgmode.org/bzg/org-mode.git")) |
431 | :binds (("C-x C-j" dired-jump))) | 478 | (require 'acdw-org) |
432 | (acdw/pkg dired-collapse | 479 | (:option org-directory "~/org" |
433 | :hooks ((dired-mode-hook dired-collapse-mode))) | 480 | org-hide-emphasis-markers t |
434 | (defun hook--dired-mode () | 481 | org-fontify-whole-heading-line t |
435 | (hl-line-mode +1) | 482 | org-fontify-done-headline t |
436 | (dired-hide-details-mode +1))) | 483 | org-fontify-quote-and-verse-blocks t |
437 | :hooks ((dired-mode-hook hook--dired-mode)) | 484 | org-src-fontify-natively t |
438 | :binds (("i" dired-subtree-toggle :map dired-mode-map))) | 485 | org-pretty-entities t |
439 | 486 | org-tags-column (- 0 fill-column -3) | |
440 | ;;; Eshell | 487 | org-src-tab-acts-natively t |
441 | 488 | org-src-window-setup 'current-window | |
442 | (acdw/set `((eshell-directory-name ,(acdw/in-dir "eshell/" t)) | 489 | org-confirm-babel-evaluate nil |
443 | (eshell-aliases-file ,(acdw/in-dir "eshell/aliases" t)))) | 490 | org-adapt-indentation nil |
444 | 491 | org-catch-invisible-edits 'smart | |
445 | ;;; Org-mode | 492 | org-special-ctrl-a/e t |
446 | (acdw/pkg (org | 493 | org-special-ctrl-k t |
447 | :repo "https://code.orgmode.org/bzg/org-mode.git") | 494 | org-imenu-depth 3 |
448 | :now ((require 'acdw-org)) | 495 | org-export-headline-levels 8 |
449 | :set `((org-directory "~/org") | 496 | org-export-with-smart-quotes t |
450 | (org-hide-emphasis-markers t) | 497 | org-export-with-sub-superscripts t) |
451 | (org-fontify-whole-heading-line t) | 498 | (:bind "RET" unpackaged/org-return-dwim) |
452 | (org-fontify-done-headline t) | 499 | (add-hook 'before-save-hook #'acdw/hook--org-mode-fix-blank-lines)) |
453 | (org-fontify-quote-and-verse-blocks t) | ||
454 | (org-src-fontify-natively t) | ||
455 | (org-pretty-entities t) | ||
456 | (org-tags-column ,(- 0 fill-column -3)) | ||
457 | (org-src-tab-acts-natively t) | ||
458 | (org-src-window-setup current-window) | ||
459 | (org-confirm-babel-evaluate nil) | ||
460 | (org-adapt-indentation nil) | ||
461 | (org-catch-invisible-edits smart) | ||
462 | (org-special-ctrl-a/e t) | ||
463 | (org-special-ctrl-k t) | ||
464 | (org-imenu-depth 3) | ||
465 | (org-export-headline-levels 8) | ||
466 | (org-export-with-smart-quotes t) | ||
467 | (org-export-with-sub-superscripts t)) | ||
468 | :hooks ((before-save-hook acdw/hook--org-mode-fix-blank-lines)) | ||
469 | :binds (("RET" unpackaged/org-return-dwim | ||
470 | :map org-mode-map :map-after 'org))) | ||
471 | |||
472 | ;;; Nov.el -- ebook reader | ||
473 | (acdw/pkg nov | ||
474 | :now ((autoload #'nov-mode "nov") | ||
475 | (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))) | ||
476 | :set `((nov-text-width ,fill-column))) | ||
477 | |||
478 | ;;; 0x0 -- upload files | ||
479 | (acdw/pkg (0x0 :repo "https://git.sr.ht/~zge/nullpointer-emacs") | ||
480 | :set '((0x0-default-host ttm))) | ||
481 | 500 | ||
482 | ;;; Programming languages | 501 | ;;; Programming languages |
483 | 502 | ||
484 | ;; General | 503 | ;;;; Formatting |
485 | 504 | (setup (:straight (apheleia :host github | |
486 | (acdw/set `((smie-indent-basic ,tab-width))) | 505 | :repo "raxod502/apheleia")) |
487 | 506 | (apheleia-global-mode +1)) | |
488 | ;; Formatting | 507 | |
489 | 508 | ;;;; Emacs lisp | |
490 | (acdw/pkg (apheleia | 509 | (setup emacs-lisp |
491 | :host github | 510 | (require 'cl-lib) |
492 | :repo "raxod502/apheleia") | 511 | (:option eval-expression-print-length nil |
493 | :now ((apheleia-global-mode +1)) | 512 | eval-expression-print-level nil |
494 | :then ((add-to-list 'apheleia-formatters | 513 | lisp-indent-function #'common-lisp-indent-function) |
495 | '(shfmt . ("shfmt"))) | ||
496 | (add-to-list 'apheleia-mode-alist | ||
497 | '(sh-mode . shfmt)))) | ||
498 | |||
499 | ;; Shell(s) | ||
500 | (when (executable-find "shellcheck") | ||
501 | (acdw/pkg flymake-shellcheck | ||
502 | :hooks ((sh-mode-hook (flymake-mode | ||
503 | flymake-shellcheck-load))))) | ||
504 | |||
505 | (acdw/set `((sh-basic-offset ,tab-width) | ||
506 | (sh-indent-after-case 0) | ||
507 | (sh-indent-for-case-alt +) | ||
508 | (sh-indent-for-case-label 0))) | ||
509 | |||
510 | (defun hook--sh-mode-indent-like-shfmt () | ||
511 | "Try to mirror `shfmt' formatting in shell scripts." | ||
512 | (setq indent-tabs-mode t)) | ||
513 | (add-hook 'sh-mode-hook #'hook--sh-mode-indent-like-shfmt) | ||
514 | |||
515 | ;; Emacs lisp | ||
516 | (acdw/set '((eval-expression-print-length nil) | ||
517 | (eval-expression-print-level nil))) | ||
518 | |||
519 | (when (require 'cl-lib) | ||
520 | (setq-default lisp-indent-function #'common-lisp-indent-function) | ||
521 | (put 'cl-flet 'common-lisp-indent-function | 514 | (put 'cl-flet 'common-lisp-indent-function |
522 | (get 'flet 'common-lisp-indent-function)) | 515 | (get 'flet 'common-lisp-indent-function)) |
523 | (put 'cl-labels 'common-lisp-indent-function | 516 | (put 'cl-labels 'common-lisp-indent-function |
@@ -526,34 +519,36 @@ | |||
526 | (put 'dotimes-protect 'common-lisp-indent-function | 519 | (put 'dotimes-protect 'common-lisp-indent-function |
527 | (get 'when 'common-lisp-indent-function))) | 520 | (get 'when 'common-lisp-indent-function))) |
528 | 521 | ||
529 | ;; Racket | 522 | ;;;; Shell scripts |
530 | (acdw/pkg racket-mode) | 523 | (setup sh |
531 | 524 | (:option sh-basic-offset tab-width | |
532 | ;; Web stuff | 525 | sh-indent-after-case 0 |
533 | (acdw/set '((css-indent-offset 2) | 526 | sh-indent-for-case-alt '+ |
534 | (js-indent-level 2) | 527 | sh-indent-for-case-label 0) |
535 | (sgml-indent-offset 2))) | 528 | (:local-set indent-tabs-mode t) |
536 | 529 | ||
537 | ;;; Miscellaneous | 530 | (when (executable-find "shfmt") |
538 | 531 | (:option (append apheleia-formatters) '(shfmt . ("shfmt")) | |
539 | (acdw/set '((disabled-command-function nil) | 532 | (append apheleia-mode-alist) '(sh-mode . shfmt))) |
540 | (load-prefer-newer t) | 533 | |
541 | (comp-async-report-warnings-errors nil))) | 534 | (when (executable-find "shellcheck") |
542 | 535 | (straight-use-package 'flymake-shellcheck) | |
543 | (fset 'yes-or-no-p #'y-or-n-p) | 536 | (:hook flymake-mode |
544 | 537 | flymake-shellcheck-load))) | |
545 | ;; Garbage collection | 538 | |
546 | (defun hook--gc-cons-maximize () | 539 | ;;;; Web languages |
547 | (setq gc-cons-threshold most-positive-fixnum)) | 540 | (setup (:straight web-mode) |
548 | (add-hook 'minibuffer-setup-hook #'hook--gc-cons-maximize) | 541 | (:option css-level-offset 2 |
549 | 542 | js-indent-level 2 | |
550 | (defun hook--gc-cons-baseline () | 543 | sgml-indent-offset 2) |
551 | (setq gc-cons-threshold gc-cons-threshold-basis)) | 544 | (dolist (extension '("\\(p\\|dj\\)?html" |
552 | (add-hook 'minibuffer-exit-hook #'hook--gc-cons-baseline) | 545 | "html?" |
553 | 546 | "\\(tpl\\.\\)?php" | |
554 | (defun hook--gc-when-unfocused () | 547 | "[agj]sp" |
555 | (acdw/when-unfocused #'garbage-collect)) | 548 | "as[cp]x" |
556 | (add-function :after after-focus-change-function | 549 | "erb" |
557 | #'hook--gc-when-unfocused) | 550 | "mustache")) |
551 | (add-to-list 'auto-mode-alist | ||
552 | `(,(concat "\\." extension "\\'") . web-mode)))) | ||
558 | 553 | ||
559 | ;;; init.el ends here | 554 | ;;; init.el ends here |