diff options
-rw-r--r-- | early-init.el | 24 | ||||
-rw-r--r-- | init.el | 39 | ||||
-rw-r--r-- | lisp/acdw.el | 35 |
3 files changed, 58 insertions, 40 deletions
diff --git a/early-init.el b/early-init.el index 3f1ebb0..622d220 100644 --- a/early-init.el +++ b/early-init.el | |||
@@ -51,10 +51,10 @@ | |||
51 | (height . 30) | 51 | (height . 30) |
52 | (left-fringe . 8) ; Width of fringes | 52 | (left-fringe . 8) ; Width of fringes |
53 | (right-fringe . 8) ; (8 is default) | 53 | (right-fringe . 8) ; (8 is default) |
54 | (font . ,(pcase acdw/system | 54 | (font . ,(acdw/system |
55 | (:home "DejaVu Sans Mono 10") | 55 | (:home "DejaVu Sans Mono 10") |
56 | (:work "Consolas 10") | 56 | (:work "Consolas 10") |
57 | (:other "monospace 10")))) | 57 | (:other "monospace 10")))) |
58 | frame-inhibit-implied-resize t ; Don't resize randomly | 58 | frame-inhibit-implied-resize t ; Don't resize randomly |
59 | frame-resize-pixelwise t ; Resize by pixels, not chars | 59 | frame-resize-pixelwise t ; Resize by pixels, not chars |
60 | inhibit-x-resources t ; Don't load ~/.Xresources | 60 | inhibit-x-resources t ; Don't load ~/.Xresources |
@@ -76,15 +76,15 @@ | |||
76 | (defun acdw/first-frame-setup () | 76 | (defun acdw/first-frame-setup () |
77 | ;; fonts | 77 | ;; fonts |
78 | (require 'acdw-fonts) | 78 | (require 'acdw-fonts) |
79 | (setq acdw-fonts/monospace (pcase acdw/system | 79 | (setq acdw-fonts/monospace (acdw/system |
80 | (:home "DejaVu Sans Mono") | 80 | (:home "DejaVu Sans Mono") |
81 | (:work "Consolas") | 81 | (:work "Consolas") |
82 | (:other "monospace")) | 82 | (:other "monospace")) |
83 | acdw-fonts/monospace-size 10 | 83 | acdw-fonts/monospace-size 10 |
84 | acdw-fonts/variable (pcase acdw/system | 84 | acdw-fonts/variable (acdw/system |
85 | (:home "DejaVu Sans") | 85 | (:home "DejaVu Sans") |
86 | (:work "Calibri") | 86 | (:work "Calibri") |
87 | (:other "sans-serif")) | 87 | (:other "sans-serif")) |
88 | acdw-fonts/variable-size 12) | 88 | acdw-fonts/variable-size 12) |
89 | (acdw-fonts/set) | 89 | (acdw-fonts/set) |
90 | (acdw-fonts/setup-emoji-fonts "Segoe UI Emoji" | 90 | (acdw-fonts/setup-emoji-fonts "Segoe UI Emoji" |
diff --git a/init.el b/init.el index 9e6f79f..24d71ed 100644 --- a/init.el +++ b/init.el | |||
@@ -66,7 +66,7 @@ | |||
66 | ;; Flash the mode line | 66 | ;; Flash the mode line |
67 | (defun flash-mode-line () | 67 | (defun flash-mode-line () |
68 | "Flash the modeline as a bell." | 68 | "Flash the modeline as a bell." |
69 | (when (eq acdw/system :home) | 69 | (when (acdw/system :home) |
70 | (beep)) | 70 | (beep)) |
71 | (invert-face 'mode-line) | 71 | (invert-face 'mode-line) |
72 | (run-with-timer 0.1 nil #'invert-face 'mode-line)) | 72 | (run-with-timer 0.1 nil #'invert-face 'mode-line)) |
@@ -103,7 +103,7 @@ | |||
103 | 'browse-url-default-browser) | 103 | 'browse-url-default-browser) |
104 | browse-url-new-window-flag t | 104 | browse-url-new-window-flag t |
105 | browse-url-firefox-new-window-is-tab t) | 105 | browse-url-firefox-new-window-is-tab t) |
106 | (when (eq acdw/system :work) | 106 | (when (acdw/system :work) |
107 | (add-to-list 'exec-path "C:/Program Files/Mozilla Firefox"))) | 107 | (add-to-list 'exec-path "C:/Program Files/Mozilla Firefox"))) |
108 | 108 | ||
109 | (setup buffers | 109 | (setup buffers |
@@ -162,14 +162,14 @@ | |||
162 | 162 | ||
163 | (:global "C-x C-j" dired-jump) | 163 | (:global "C-x C-j" dired-jump) |
164 | 164 | ||
165 | (pcase acdw/system | 165 | (acdw/system |
166 | (:work (:straight w32-browser) | 166 | (:work (:straight w32-browser) |
167 | (autoload 'dired-w32-browser "w32-browser") | 167 | (autoload 'dired-w32-browser "w32-browser") |
168 | (:bind "RET" dired-w32-browser)) | 168 | (:bind "RET" dired-w32-browser)) |
169 | (:home (:straight dired-open) | 169 | (:home (:straight dired-open) |
170 | (require 'dired-open) | 170 | (require 'dired-open) |
171 | (:bind "RET" dired-find-alternate-file) | 171 | (:bind "RET" dired-find-alternate-file) |
172 | (:option (prepend dired-open-functions) #'dired-open-xdg))) | 172 | (:option (prepend dired-open-functions) #'dired-open-xdg))) |
173 | 173 | ||
174 | (:when-loaded | 174 | (:when-loaded |
175 | (:straight dired-subtree) | 175 | (:straight dired-subtree) |
@@ -251,11 +251,11 @@ | |||
251 | (set-terminal-coding-system 'utf-8-unix) | 251 | (set-terminal-coding-system 'utf-8-unix) |
252 | (set-keyboard-coding-system 'utf-8-unix) | 252 | (set-keyboard-coding-system 'utf-8-unix) |
253 | 253 | ||
254 | (pcase acdw/system | 254 | (acdw/system |
255 | (:work (set-clipboard-coding-system 'utf-16-le) | 255 | (:work (set-clipboard-coding-system 'utf-16-le) |
256 | (set-selection-coding-system 'utf-16-le)) | 256 | (set-selection-coding-system 'utf-16-le)) |
257 | (_ (set-selection-coding-system 'utf-8) | 257 | (_ (set-selection-coding-system 'utf-8) |
258 | (set-clipboard-coding-system 'utf-8)))) | 258 | (set-clipboard-coding-system 'utf-8)))) |
259 | 259 | ||
260 | (setup eshell | 260 | (setup eshell |
261 | (:option eshell-directory-name (acdw/dir "eshell/" t) | 261 | (:option eshell-directory-name (acdw/dir "eshell/" t) |
@@ -469,7 +469,7 @@ | |||
469 | 469 | ||
470 | (setup saveplace | 470 | (setup saveplace |
471 | (:option save-place-file (acdw/dir "places.el") | 471 | (:option save-place-file (acdw/dir "places.el") |
472 | save-place-forget-unreadable-files (eq acdw/system :home)) | 472 | save-place-forget-unreadable-files (acdw/system :home)) |
473 | 473 | ||
474 | (save-place-mode +1)) | 474 | (save-place-mode +1)) |
475 | 475 | ||
@@ -617,7 +617,8 @@ | |||
617 | 617 | ||
618 | ;; Use a dumb formatter on modes that `apheleia' doesn't work for. | 618 | ;; Use a dumb formatter on modes that `apheleia' doesn't work for. |
619 | (hook-defun dumb-auto-format before-save-hook | 619 | (hook-defun dumb-auto-format before-save-hook |
620 | (setq stupid-modes '(makefile-mode)) | 620 | (setq stupid-modes '(makefile-mode |
621 | org-mode)) | ||
621 | ;; If there's no apheleia formatter for the mode, just indent the buffer. | 622 | ;; If there's no apheleia formatter for the mode, just indent the buffer. |
622 | (unless (or (apply #'derived-mode-p stupid-modes) | 623 | (unless (or (apply #'derived-mode-p stupid-modes) |
623 | (and (fboundp 'apheleia--get-formatter-command) | 624 | (and (fboundp 'apheleia--get-formatter-command) |
@@ -1039,7 +1040,7 @@ if ripgrep is installed, otherwise `consult-grep'." | |||
1039 | (:option undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'" | 1040 | (:option undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'" |
1040 | "/git-rebase-todo\\'") | 1041 | "/git-rebase-todo\\'") |
1041 | undo-fu-session-directory (acdw/dir "undo/" t) | 1042 | undo-fu-session-directory (acdw/dir "undo/" t) |
1042 | undo-fu-session-compression (eq acdw/system :home)) | 1043 | undo-fu-session-compression (acdw/system :home)) |
1043 | 1044 | ||
1044 | (global-undo-fu-session-mode +1)) | 1045 | (global-undo-fu-session-mode +1)) |
1045 | 1046 | ||
@@ -1113,7 +1114,7 @@ call `zzz-to-char'." | |||
1113 | ;;; System-dependent | 1114 | ;;; System-dependent |
1114 | 1115 | ||
1115 | ;;;; Home | 1116 | ;;;; Home |
1116 | (when (eq acdw/system :home) | 1117 | (when (acdw/system :home) |
1117 | 1118 | ||
1118 | (setup (:straight pkgbuild-mode)) | 1119 | (setup (:straight pkgbuild-mode)) |
1119 | 1120 | ||
diff --git a/lisp/acdw.el b/lisp/acdw.el index a798069..a1c364d 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -21,12 +21,29 @@ | |||
21 | 21 | ||
22 | ;;; Variables | 22 | ;;; Variables |
23 | 23 | ||
24 | (defconst acdw/system (pcase system-type | 24 | (defconst acdw/system |
25 | ('gnu/linux :home) | 25 | (pcase system-type |
26 | ((or 'msdos 'windows-nt) :work) | 26 | ('gnu/linux :home) |
27 | (_ :other)) | 27 | ((or 'msdos 'windows-nt) :work) |
28 | (_ :other)) | ||
28 | "Which computer system is currently being used.") | 29 | "Which computer system is currently being used.") |
29 | 30 | ||
31 | (defmacro acdw/system (&rest arg) | ||
32 | "Convenience macro for interfacing with `acdw/system'. | ||
33 | |||
34 | When called without arguments, it returns `acdw/system'. | ||
35 | When called with one argument, it returns (eq acdw/system ARG). | ||
36 | When called with multiple arguments, it returns `pcase' over each argument." | ||
37 | (cond | ||
38 | ((not arg) acdw/system) | ||
39 | ((not (cdr arg)) | ||
40 | `(when (eq acdw/system ,(car arg)) | ||
41 | ,(car arg))) | ||
42 | ((cdr arg) | ||
43 | `(pcase acdw/system | ||
44 | ,@arg)) | ||
45 | (t (error "Wrong argument type: %s" (type-of arg))))) | ||
46 | |||
30 | 47 | ||
31 | ;;; Utility functions | 48 | ;;; Utility functions |
32 | ;; I don't prefix these because ... reasons. Honestly I probably should prefix | 49 | ;; I don't prefix these because ... reasons. Honestly I probably should prefix |
@@ -162,11 +179,11 @@ if MAKE-DIRECTORY is non-nil." | |||
162 | 179 | ||
163 | (defun acdw/find-emacs-source () | 180 | (defun acdw/find-emacs-source () |
164 | "Find where Emacs keeps its source tree." | 181 | "Find where Emacs keeps its source tree." |
165 | (pcase acdw/system | 182 | (acdw/system |
166 | (:work (expand-file-name | 183 | (:work (expand-file-name |
167 | (concat "~/src/emacs-" emacs-version "/src"))) | 184 | (concat "~/src/emacs-" emacs-version "/src"))) |
168 | (:home (expand-file-name "~/src/pkg/emacs/src/emacs-git/src")) | 185 | (:home (expand-file-name "~/src/pkg/emacs/src/emacs-git/src")) |
169 | (:other nil))) | 186 | (:other nil))) |
170 | 187 | ||
171 | (defun acdw/gc-disable () | 188 | (defun acdw/gc-disable () |
172 | "Functionally disable the Garbage collector." | 189 | "Functionally disable the Garbage collector." |