diff options
author | Case Duckworth | 2023-01-20 13:14:55 -0600 |
---|---|---|
committer | Case Duckworth | 2023-01-20 13:14:55 -0600 |
commit | d7824cacb2bb9d0b9c15fa24e15ac367effec9a5 (patch) | |
tree | 78d5a09594dc682595e9450217445d21fe83b87e /init.el | |
parent | Add link-hint (diff) | |
download | emacs-d7824cacb2bb9d0b9c15fa24e15ac367effec9a5.tar.gz emacs-d7824cacb2bb9d0b9c15fa24e15ac367effec9a5.zip |
meh
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 121 |
1 files changed, 107 insertions, 14 deletions
diff --git a/init.el b/init.el index aed189c..864ac1b 100644 --- a/init.el +++ b/init.el | |||
@@ -1,6 +1,17 @@ | |||
1 | ;;; init.el --- An Emacs of one's own -*- lexical-binding: t -*- | 1 | ;;; init.el --- An Emacs of one's own -*- lexical-binding: t -*- |
2 | |||
3 | ;; Author: Case Duckworth <acdw@acdw.net>, with inspo from many others | ||
4 | ;; Homepage: https://git.acdw.net/emacs | ||
5 | ;; Config-Requires: ((emacs "29.0")) | ||
2 | ;; Bankruptcy: 9.4 | 6 | ;; Bankruptcy: 9.4 |
3 | 7 | ||
8 | ;; This configuration is Free Software. Everyone is permitted to do whatever | ||
9 | ;; they want with it, without limitation. This software comes without any | ||
10 | ;; warranty whatsoever, but with two pieces of advice: | ||
11 | ;; | ||
12 | ;; - Don't hurt others. | ||
13 | ;; - Make good choices. | ||
14 | |||
4 | ;;; Code: | 15 | ;;; Code: |
5 | 16 | ||
6 | (load (locate-user-emacs-file "basics")) ; super basic stuff | 17 | (load (locate-user-emacs-file "basics")) ; super basic stuff |
@@ -106,6 +117,14 @@ | |||
106 | :config | 117 | :config |
107 | (fringe-mode '(nil . 0))) | 118 | (fringe-mode '(nil . 0))) |
108 | 119 | ||
120 | (use-package ispell | ||
121 | :config | ||
122 | (setopt ispell-program-name (choose-executable "ispell" "aspell")) | ||
123 | (add-hook 'before-save-hook | ||
124 | #'+ispell-move-buffer-words-to-dir-locals-hook) | ||
125 | (put 'ispell-buffer-session-localwords 'safe-local-variable | ||
126 | '+ispell-safe-local-p)) | ||
127 | |||
109 | (use-package flyspell | 128 | (use-package flyspell |
110 | :hook org-mode-hook) | 129 | :hook org-mode-hook) |
111 | 130 | ||
@@ -164,6 +183,8 @@ | |||
164 | (use-package time | 183 | (use-package time |
165 | :config | 184 | :config |
166 | (setopt display-time-format " %H:%M" | 185 | (setopt display-time-format " %H:%M" |
186 | display-time-interval 60 | ||
187 | display-time-use-mail-icon t | ||
167 | display-time-mail-function | 188 | display-time-mail-function |
168 | (defun +notmuch-new-mail-p () | 189 | (defun +notmuch-new-mail-p () |
169 | (plist-get (cl-find "inbox+unread" | 190 | (plist-get (cl-find "inbox+unread" |
@@ -173,8 +194,24 @@ | |||
173 | :test #'equal) | 194 | :test #'equal) |
174 | :count)) | 195 | :count)) |
175 | display-time-default-load-average nil) | 196 | display-time-default-load-average nil) |
197 | (with-eval-after-load 'notmuch | ||
198 | (add-hook 'notmuch-after-tag-hook #'display-time-update)) | ||
176 | (display-time-mode)) | 199 | (display-time-mode)) |
177 | 200 | ||
201 | (use-package tab-bar | ||
202 | :config | ||
203 | (setopt tab-bar-show t | ||
204 | tab-bar-close-button-show t) | ||
205 | ;; (add-to-list 'tab-bar-format 'tab-bar-format-menu-bar) | ||
206 | (add-to-list 'tab-bar-format 'tab-bar-format-align-right :append) | ||
207 | (add-to-list 'tab-bar-format 'tab-bar-format-global :append) | ||
208 | (when (daemonp) | ||
209 | (add-hook 'server-after-make-frame-hook | ||
210 | (defun after-frame@tab-bar () | ||
211 | (tab-bar-mode) | ||
212 | (remove-hook 'server-after-make-frame-hook | ||
213 | #'after-frame@tab-bar))))) | ||
214 | |||
178 | 215 | ||
179 | ;;; Applications | 216 | ;;; Applications |
180 | 217 | ||
@@ -265,7 +302,9 @@ With prefix ARG, toggle the value of | |||
265 | 302 | ||
266 | (use-package filldent | 303 | (use-package filldent |
267 | :load-path "~/src/emacs/filldent/" | 304 | :load-path "~/src/emacs/filldent/" |
268 | :bind ("M-q" . filldent-dwim)) | 305 | :bind ("M-q" . filldent-dwim) |
306 | :config | ||
307 | (setopt filldent-fill-modes '(web-mode))) | ||
269 | 308 | ||
270 | (use-package frowny | 309 | (use-package frowny |
271 | :load-path "~/src/emacs/frowny/" | 310 | :load-path "~/src/emacs/frowny/" |
@@ -338,8 +377,30 @@ With prefix ARG, toggle the value of | |||
338 | word-boundary))) | 377 | word-boundary))) |
339 | (hi-lock-unface-buffer regexp) | 378 | (hi-lock-unface-buffer regexp) |
340 | (highlight-regexp regexp 'font-lock-warning-face)))))) | 379 | (highlight-regexp regexp 'font-lock-warning-face)))))) |
380 | (add-hook 'jabber-chat-mode-hook | ||
381 | (defun jabber-chat@leave-when-kill () | ||
382 | (add-hook 'kill-buffer-hook | ||
383 | (defun @jabber-leave@kill () | ||
384 | (apply #'jabber-muc-leave (jabber-muc-argument-list))) | ||
385 | nil :local))) | ||
341 | (when (fboundp 'jabber-chat-update-focus) | 386 | (when (fboundp 'jabber-chat-update-focus) |
342 | (add-hook 'window-configuration-change-hook #'jabber-chat-update-focus))) | 387 | (add-hook 'window-configuration-change-hook #'jabber-chat-update-focus)) |
388 | (with-eval-after-load 'consult | ||
389 | (defvar jabber-chat-buffer-source | ||
390 | `( :name "Jabber" | ||
391 | :hidden nil | ||
392 | :narrow ?j | ||
393 | :category buffer | ||
394 | :state ,#'consult--buffer-state | ||
395 | :items ,(lambda () | ||
396 | (mapcar #'buffer-name | ||
397 | (seq-filter (lambda (buf) | ||
398 | (with-current-buffer buf | ||
399 | (eq major-mode 'jabber-chat-mode))) | ||
400 | (buffer-list)))))) | ||
401 | (add-to-list 'consult-buffer-sources 'jabber-chat-buffer-source :append) | ||
402 | (consult-customize | ||
403 | consult-buffer :preview-key (kbd "M-.")))) | ||
343 | 404 | ||
344 | (use-package keepassxc-shim | 405 | (use-package keepassxc-shim |
345 | :load-path "~/src/emacs/keepassxc-shim/" | 406 | :load-path "~/src/emacs/keepassxc-shim/" |
@@ -349,6 +410,14 @@ With prefix ARG, toggle the value of | |||
349 | 410 | ||
350 | ;;; External packages | 411 | ;;; External packages |
351 | 412 | ||
413 | (use-package async | ||
414 | :ensure t | ||
415 | :config | ||
416 | ;; https://github.com/jwiegley/emacs-async/issues/64 | ||
417 | ;; (setopt message-send-mail-function #'async-smtpmail-send-it) | ||
418 | (dired-async-mode) | ||
419 | (async-bytecomp-package-mode)) | ||
420 | |||
352 | (use-package trashed | 421 | (use-package trashed |
353 | :ensure t) | 422 | :ensure t) |
354 | 423 | ||
@@ -367,11 +436,45 @@ With prefix ARG, toggle the value of | |||
367 | :config (minions-mode)) | 436 | :config (minions-mode)) |
368 | 437 | ||
369 | (use-package visual-fill-column | 438 | (use-package visual-fill-column |
439 | :preface | ||
440 | (defcustom visual-fill-column-widen-amount 4 | ||
441 | "Amount to widen `fill-column' by in `visual-fill-column-mode'." | ||
442 | :type 'natnum | ||
443 | :group 'visual-fill-column) | ||
444 | (defun visual-fill-column--widen/narrow-handle-arg (cols) | ||
445 | (cond | ||
446 | ((null cols) visual-fill-column-widen-amount) | ||
447 | ((listp cols) (* visual-fill-column-widen-amount | ||
448 | (1+ (/ (car cols) 4)))) | ||
449 | ((eq '- cols) (- visual-fill-column-widen-amount)) | ||
450 | (:else cols))) | ||
451 | (defun visual-fill-column-widen (&optional cols) | ||
452 | "Widen `fill-column' by COLS, and re-display. | ||
453 | If COLS is missing or nil, widen by | ||
454 | `visual-fill-column-widen-amount'. When called with a plain | ||
455 | \\[universal-argument], multiply that amount by 1 + the amount of | ||
456 | \\[universal-argument]s. If called with a numerical prefix | ||
457 | argument, widen by that number of columns." | ||
458 | (interactive "P") | ||
459 | (let ((cols (visual-fill-column--widen/narrow-handle-arg cols))) | ||
460 | (cl-incf fill-column cols) | ||
461 | (visual-fill-column-adjust) | ||
462 | (message "Fill-column: %s" fill-column))) | ||
463 | (defun visual-fill-column-narrow (&optional cols) | ||
464 | "Narrow `fill-column' by COLS, then redisplay. | ||
465 | The prefix argument is as in `visual-fill-column-widen' but negated." | ||
466 | (interactive "P") | ||
467 | (let ((cols (visual-fill-column--widen/narrow-handle-arg cols))) | ||
468 | (cl-decf fill-column cols) | ||
469 | (visual-fill-column-adjust) | ||
470 | (message "Fill-column: %s" fill-column))) | ||
370 | :ensure t | 471 | :ensure t |
371 | :init | 472 | :init |
372 | (setopt visual-fill-column-center-text t | 473 | (setopt visual-fill-column-center-text t |
373 | visual-fill-column-extra-text-width '(3 . 3)) | 474 | visual-fill-column-extra-text-width '(3 . 3)) |
374 | :config | 475 | :config |
476 | (keymap-set visual-fill-column-mode-map "C-x C->" #'visual-fill-column-widen) | ||
477 | (keymap-set visual-fill-column-mode-map "C-x C-<" #'visual-fill-column-narrow) | ||
375 | (add-hook 'visual-fill-column-mode-hook #'visual-line-mode) | 478 | (add-hook 'visual-fill-column-mode-hook #'visual-line-mode) |
376 | (add-hook 'eww-mode-hook #'visual-fill-column-mode) | 479 | (add-hook 'eww-mode-hook #'visual-fill-column-mode) |
377 | (advice-add 'text-scale-adjust :after #'visual-fill-column-adjust)) | 480 | (advice-add 'text-scale-adjust :after #'visual-fill-column-adjust)) |
@@ -726,15 +829,5 @@ With PREFIX, prompt to change the current dictionary." | |||
726 | (use-package php-mode | 829 | (use-package php-mode |
727 | :ensure t) | 830 | :ensure t) |
728 | 831 | ||
729 | (use-package tab-bar | 832 | (use-package rec-mode |
730 | :config | 833 | :ensure t) |
731 | (setopt tab-bar-show t) | ||
732 | (add-to-list 'tab-bar-format 'tab-bar-format-menu-bar) | ||
733 | (add-to-list 'tab-bar-format 'tab-bar-format-align-right :append) | ||
734 | (add-to-list 'tab-bar-format 'tab-bar-format-global :append) | ||
735 | (with-eval-after-load 'notmuch | ||
736 | |||
737 | ;; (remove-hook 'notmuch-after-tag-hook #'tab-bar-make-keymap-1) | ||
738 | (define-advice notmuch-update-tags (:after (&rest _) update-tab-bar) | ||
739 | (tab-bar--update-tab-bar-lines))) | ||
740 | (tab-bar-mode)) | ||