diff options
Diffstat (limited to 'lisp/+emacs.el')
-rw-r--r-- | lisp/+emacs.el | 95 |
1 files changed, 54 insertions, 41 deletions
diff --git a/lisp/+emacs.el b/lisp/+emacs.el index 7ad6768..2d63e82 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el | |||
@@ -11,7 +11,8 @@ | |||
11 | ;; Emacs. But like, why would I want to? | 11 | ;; Emacs. But like, why would I want to? |
12 | 12 | ||
13 | ;; Other notable packages include | 13 | ;; Other notable packages include |
14 | ;; https://git.sr.ht/~technomancy/better-defaults/ | 14 | ;; - https://git.sr.ht/~technomancy/better-defaults/ |
15 | ;; - https://github.com/susam/emfy | ||
15 | 16 | ||
16 | ;;; Code: | 17 | ;;; Code: |
17 | 18 | ||
@@ -45,6 +46,7 @@ Do this only if the buffer is not visiting a file." | |||
45 | completion-category-overrides '((file (styles . (partial-completion)))) | 46 | completion-category-overrides '((file (styles . (partial-completion)))) |
46 | completion-ignore-case t | 47 | completion-ignore-case t |
47 | completion-styles '(substring partial-completion) | 48 | completion-styles '(substring partial-completion) |
49 | create-lockfiles nil | ||
48 | cursor-in-non-selected-windows 'hollow | 50 | cursor-in-non-selected-windows 'hollow |
49 | cursor-type 'bar | 51 | cursor-type 'bar |
50 | custom-file (.etc "custom.el") | 52 | custom-file (.etc "custom.el") |
@@ -64,6 +66,8 @@ Do this only if the buffer is not visiting a file." | |||
64 | hscroll-step 1 | 66 | hscroll-step 1 |
65 | imenu-auto-rescan t | 67 | imenu-auto-rescan t |
66 | indent-tabs-mode nil | 68 | indent-tabs-mode nil |
69 | indicate-empty-lines t | ||
70 | indicate-buffer-boundaries 'left | ||
67 | inhibit-startup-screen t | 71 | inhibit-startup-screen t |
68 | initial-buffer-choice t | 72 | initial-buffer-choice t |
69 | kill-do-not-save-duplicates t | 73 | kill-do-not-save-duplicates t |
@@ -75,8 +79,8 @@ Do this only if the buffer is not visiting a file." | |||
75 | mark-ring-max 50 | 79 | mark-ring-max 50 |
76 | minibuffer-eldef-shorten-default t | 80 | minibuffer-eldef-shorten-default t |
77 | minibuffer-prompt-properties (list 'read-only t | 81 | minibuffer-prompt-properties (list 'read-only t |
78 | 'cursor-intangible t | 82 | 'cursor-intangible t |
79 | 'face 'minibuffer-prompt) | 83 | 'face 'minibuffer-prompt) |
80 | mode-require-final-newline 'visit-save | 84 | mode-require-final-newline 'visit-save |
81 | mouse-drag-copy-region t | 85 | mouse-drag-copy-region t |
82 | mouse-yank-at-point t | 86 | mouse-yank-at-point t |
@@ -84,8 +88,8 @@ Do this only if the buffer is not visiting a file." | |||
84 | read-answer-short t | 88 | read-answer-short t |
85 | read-buffer-completion-ignore-case t | 89 | read-buffer-completion-ignore-case t |
86 | read-extended-command-predicate (when (fboundp | 90 | read-extended-command-predicate (when (fboundp |
87 | 'command-completion-default-include-p) | 91 | 'command-completion-default-include-p) |
88 | 'command-completion-default-include-p) | 92 | 'command-completion-default-include-p) |
89 | recenter-positions '(top middle bottom) | 93 | recenter-positions '(top middle bottom) |
90 | regexp-search-ring-max 100 | 94 | regexp-search-ring-max 100 |
91 | regexp-search-ring-max 200 | 95 | regexp-search-ring-max 200 |
@@ -101,7 +105,9 @@ Do this only if the buffer is not visiting a file." | |||
101 | show-paren-style 'mixed | 105 | show-paren-style 'mixed |
102 | show-paren-when-point-in-periphery t | 106 | show-paren-when-point-in-periphery t |
103 | show-paren-when-point-inside-paren t | 107 | show-paren-when-point-inside-paren t |
108 | ;;show-trailing-whitespace t | ||
104 | tab-bar-show 1 | 109 | tab-bar-show 1 |
110 | tab-width 4 | ||
105 | tramp-backup-directory-alist backup-directory-alist | 111 | tramp-backup-directory-alist backup-directory-alist |
106 | use-dialog-box nil | 112 | use-dialog-box nil |
107 | use-file-dialog nil | 113 | use-file-dialog nil |
@@ -117,6 +123,13 @@ Do this only if the buffer is not visiting a file." | |||
117 | yank-pop-change-selection t | 123 | yank-pop-change-selection t |
118 | ) | 124 | ) |
119 | 125 | ||
126 | ;; Programming language offsets. | ||
127 | ;; Set these after the initial block so I can use `tab-width' | ||
128 | (setq-default | ||
129 | c-basic-offset tab-width) | ||
130 | |||
131 | ;; Emacs 28 ships with an option, `use-short-answers', that makes this form | ||
132 | ;; obsolete, but I still use 27 at work. | ||
120 | (when (version< emacs-version "28") | 133 | (when (version< emacs-version "28") |
121 | (fset 'yes-or-no-p 'y-or-n-p)) | 134 | (fset 'yes-or-no-p 'y-or-n-p)) |
122 | 135 | ||
@@ -150,23 +163,23 @@ Do this only if the buffer is not visiting a file." | |||
150 | ;;; Modes | 163 | ;;; Modes |
151 | 164 | ||
152 | (dolist (enable-mode '(global-auto-revert-mode | 165 | (dolist (enable-mode '(global-auto-revert-mode |
153 | blink-cursor-mode | 166 | blink-cursor-mode |
154 | electric-pair-mode | 167 | electric-pair-mode |
155 | show-paren-mode | 168 | show-paren-mode |
156 | global-so-long-mode | 169 | global-so-long-mode |
157 | minibuffer-depth-indicate-mode | 170 | minibuffer-depth-indicate-mode |
158 | file-name-shadow-mode | 171 | file-name-shadow-mode |
159 | minibuffer-electric-default-mode | 172 | minibuffer-electric-default-mode |
160 | delete-selection-mode | 173 | delete-selection-mode |
161 | column-number-mode)) | 174 | column-number-mode)) |
162 | (when (fboundp enable-mode) | 175 | (when (fboundp enable-mode) |
163 | (funcall enable-mode +1))) | 176 | (funcall enable-mode +1))) |
164 | 177 | ||
165 | (dolist (disable-mode '(tooltip-mode | 178 | (dolist (disable-mode '(tooltip-mode |
166 | tool-bar-mode | 179 | tool-bar-mode |
167 | menu-bar-mode | 180 | menu-bar-mode |
168 | scroll-bar-mode | 181 | scroll-bar-mode |
169 | horizontal-scroll-bar-mode)) | 182 | horizontal-scroll-bar-mode)) |
170 | (when (fboundp disable-mode) | 183 | (when (fboundp disable-mode) |
171 | (funcall disable-mode -1))) | 184 | (funcall disable-mode -1))) |
172 | 185 | ||
@@ -187,19 +200,19 @@ PRESERVE-NL-BACK and MODE." | |||
187 | (cycle-spacing (- n) preserve-nl-back mode)) | 200 | (cycle-spacing (- n) preserve-nl-back mode)) |
188 | 201 | ||
189 | (defun +save-buffers-quit (&optional arg) | 202 | (defun +save-buffers-quit (&optional arg) |
190 | "Silently save each buffer, then kill the current connection. | 203 | "Silently save each buffer, then kill the current connection. |
191 | If the current frame has no client, kill Emacs itself using | 204 | If the current frame has no client, kill Emacs itself using |
192 | `save-buffers-kill-emacs' after confirming with the user. | 205 | `save-buffers-kill-emacs' after confirming with the user. |
193 | 206 | ||
194 | With prefix ARG, silently save all file-visiting buffers, then | 207 | With prefix ARG, silently save all file-visiting buffers, then |
195 | kill without asking." | 208 | kill without asking." |
196 | (interactive "P") | 209 | (interactive "P") |
197 | (save-some-buffers t) | 210 | (save-some-buffers t) |
198 | (if (and (not (frame-parameter nil 'client)) | 211 | (if (and (not (frame-parameter nil 'client)) |
199 | (and (not arg))) | 212 | (and (not arg))) |
200 | (when (yes-or-no-p "Sure you want to quit? ") | 213 | (when (yes-or-no-p "Sure you want to quit? ") |
201 | (save-buffers-kill-emacs)) | 214 | (save-buffers-kill-emacs)) |
202 | (server-save-buffers-kill-terminal nil))) | 215 | (server-save-buffers-kill-terminal nil))) |
203 | 216 | ||
204 | ;;; Bindings | 217 | ;;; Bindings |
205 | 218 | ||
@@ -225,9 +238,9 @@ kill without asking." | |||
225 | 238 | ||
226 | (when (require 'uniquify nil :noerror) | 239 | (when (require 'uniquify nil :noerror) |
227 | (setq-default uniquify-buffer-name-style 'forward | 240 | (setq-default uniquify-buffer-name-style 'forward |
228 | uniquify-separator path-separator | 241 | uniquify-separator path-separator |
229 | uniquify-after-kill-buffer-p t | 242 | uniquify-after-kill-buffer-p t |
230 | uniquify-ignore-buffers-re "^\\*")) | 243 | uniquify-ignore-buffers-re "^\\*")) |
231 | 244 | ||
232 | (when (require 'goto-addr) | 245 | (when (require 'goto-addr) |
233 | (if (fboundp 'global-goto-address-mode) | 246 | (if (fboundp 'global-goto-address-mode) |
@@ -236,34 +249,34 @@ kill without asking." | |||
236 | 249 | ||
237 | (when (require 'recentf nil :noerror) | 250 | (when (require 'recentf nil :noerror) |
238 | (setq-default recentf-save-file (.etc "recentf.el") | 251 | (setq-default recentf-save-file (.etc "recentf.el") |
239 | recentf-max-menu-items 100 | 252 | recentf-max-menu-items 100 |
240 | recentf-max-saved-items nil | 253 | recentf-max-saved-items nil |
241 | recentf-auto-cleanup 'mode) | 254 | recentf-auto-cleanup 'mode) |
242 | (add-to-list 'recentf-exclude .etc) | 255 | (add-to-list 'recentf-exclude .etc) |
243 | (recentf-mode +1)) | 256 | (recentf-mode +1)) |
244 | 257 | ||
245 | (when (require 'repeat nil :noerror) | 258 | (when (require 'repeat nil :noerror) |
246 | (setq-default repeat-exit-key "g" | 259 | (setq-default repeat-exit-key "g" |
247 | repeat-exit-timeout 5) | 260 | repeat-exit-timeout 5) |
248 | (repeat-mode +1)) | 261 | (repeat-mode +1)) |
249 | 262 | ||
250 | (when (require 'savehist nil :noerror) | 263 | (when (require 'savehist nil :noerror) |
251 | (setq-default history-length t | 264 | (setq-default history-length t |
252 | history-delete-duplicates t | 265 | history-delete-duplicates t |
253 | history-autosave-interval 60 | 266 | history-autosave-interval 60 |
254 | savehist-file (.etc "savehist.el")) | 267 | savehist-file (.etc "savehist.el")) |
255 | (dolist (var '(extended-command-history | 268 | (dolist (var '(extended-command-history |
256 | global-mark-ring | 269 | global-mark-ring |
257 | kill-ring | 270 | kill-ring |
258 | regexp-search-ring | 271 | regexp-search-ring |
259 | search-ring | 272 | search-ring |
260 | mark-ring)) | 273 | mark-ring)) |
261 | (add-to-list 'savehist-additional-variables var)) | 274 | (add-to-list 'savehist-additional-variables var)) |
262 | (savehist-mode +1)) | 275 | (savehist-mode +1)) |
263 | 276 | ||
264 | (when (require 'saveplace nil :noerror) | 277 | (when (require 'saveplace nil :noerror) |
265 | (setq-default save-place-file (.etc "places.el") | 278 | (setq-default save-place-file (.etc "places.el") |
266 | save-place-forget-unreadable-files (eq system-type 'gnu/linux)) | 279 | save-place-forget-unreadable-files (eq system-type 'gnu/linux)) |
267 | (save-place-mode +1)) | 280 | (save-place-mode +1)) |
268 | 281 | ||
269 | ;; (when (require 'tramp) | 282 | ;; (when (require 'tramp) |