diff options
-rw-r--r-- | init.el | 90 | ||||
-rw-r--r-- | lisp/+eshell.el | 20 | ||||
-rw-r--r-- | lisp/+mwim.el | 42 | ||||
-rw-r--r-- | lisp/+setup.el | 26 | ||||
-rw-r--r-- | lisp/+sly.el | 18 | ||||
-rw-r--r-- | lisp/+vterm.el | 19 |
6 files changed, 181 insertions, 34 deletions
diff --git a/init.el b/init.el index 63d0f87..5a9ee62 100644 --- a/init.el +++ b/init.el | |||
@@ -295,23 +295,25 @@ | |||
295 | eshell-scroll-to-bottom-on-input 'all | 295 | eshell-scroll-to-bottom-on-input 'all |
296 | eshell-smart-space-goes-to-end t | 296 | eshell-smart-space-goes-to-end t |
297 | eshell-where-to-jump 'begin) | 297 | eshell-where-to-jump 'begin) |
298 | (add-hook 'eshell-mode-hook | 298 | (setf (alist-get 'eshell-mode mwim-beginning-of-line-function) |
299 | (defun +eshell@setup () | 299 | #'eshell-bol) |
300 | "Eshell improperly does loading. Gah." | 300 | (+eshell-eval-after-load |
301 | (interactive) | 301 | ;; Set local settings |
302 | (dolist (setting `((outline-regexp . ,eshell-prompt-regexp) | 302 | (dolist (setting (list (cons 'outline-regexp eshell-prompt-regexp) |
303 | (page-delimiter . ,eshell-prompt-regexp) | 303 | (cons 'page-delimiter eshell-prompt-regexp) |
304 | (imenu-generic-expression | 304 | (cons 'imenu-generic-expression |
305 | . ,`(("Prompt" | 305 | (list "Prompt" |
306 | ,(concat eshell-prompt-regexp | 306 | (concat eshell-prompt-regexp |
307 | "\\(.*\\)") | 307 | "\\(.*\\)") |
308 | 1))))) | 308 | 1)))) |
309 | (set (make-local-variable (car setting)) (cdr setting))) | 309 | (set (make-local-variable (car setting)) (cdr setting))) |
310 | (dolist (binding `(("C-d" . +eshell-quit-or-delete-char))) | 310 | ;; Bind keys |
311 | (define-key eshell-mode-map | 311 | (dolist (binding '(("C-d" . +eshell-quit-or-delete-char))) |
312 | (define-key eshell-mode-map | ||
312 | (kbd (car binding)) (cdr binding))) | 313 | (kbd (car binding)) (cdr binding))) |
313 | (dolist (environment `(("PAGER" . "cat"))) | 314 | ;; Environment variables |
314 | (setenv (car environment) (cdr environment)))))) | 315 | (dolist (environment '(("PAGER" . "cat"))) |
316 | (setenv (car environment) (cdr environment))))) | ||
315 | 317 | ||
316 | (setup eww | 318 | (setup eww |
317 | (:also-load +eww) | 319 | (:also-load +eww) |
@@ -560,6 +562,10 @@ | |||
560 | (with-eval-after-load 'user-save | 562 | (with-eval-after-load 'user-save |
561 | (advice-add 'org-export-dispatch :before 'user-save-run-hooks))) | 563 | (advice-add 'org-export-dispatch :before 'user-save-run-hooks))) |
562 | 564 | ||
565 | (setup password-cache | ||
566 | (:option password-cache t | ||
567 | password-cache-expiry (* 60 60))) | ||
568 | |||
563 | (setup prog | 569 | (setup prog |
564 | (:local-set comment-auto-fill-only-comments t) | 570 | (:local-set comment-auto-fill-only-comments t) |
565 | (:hook #'prettify-symbols-mode | 571 | (:hook #'prettify-symbols-mode |
@@ -601,7 +607,8 @@ | |||
601 | 607 | ||
602 | (setup time | 608 | (setup time |
603 | (:option display-time-format "%H:%M" | 609 | (:option display-time-format "%H:%M" |
604 | display-time-default-load-average nil) | 610 | display-time-default-load-average nil |
611 | display-time-mail-file :disable) | ||
605 | (display-time-mode +1)) | 612 | (display-time-mode +1)) |
606 | 613 | ||
607 | (setup (:straight 0x0) | 614 | (setup (:straight 0x0) |
@@ -673,12 +680,6 @@ | |||
673 | ;;cape-dict)) | 680 | ;;cape-dict)) |
674 | (add-to-list 'completion-at-point-functions fn :append))))) | 681 | (add-to-list 'completion-at-point-functions fn :append))))) |
675 | 682 | ||
676 | (setup (:straight (capf-autosuggest | ||
677 | :host nil | ||
678 | :repo "https://repo.or.cz/emacs-capf-autosuggest.git")) | ||
679 | (:hook-into eshell-mode | ||
680 | comint-mode)) | ||
681 | |||
682 | (setup (:straight circe) | 683 | (setup (:straight circe) |
683 | (:require _circe | 684 | (:require _circe |
684 | +circe) | 685 | +circe) |
@@ -852,6 +853,8 @@ | |||
852 | (add-hook 'modus-themes-after-load-theme-hook #'circe-nick-color-reset)) | 853 | (add-hook 'modus-themes-after-load-theme-hook #'circe-nick-color-reset)) |
853 | (add-hook 'kill-emacs-hook #'+circe-quit-all@kill-emacs)) | 854 | (add-hook 'kill-emacs-hook #'+circe-quit-all@kill-emacs)) |
854 | 855 | ||
856 | (setup (:straight clhs)) | ||
857 | |||
855 | (setup (:straight consult) | 858 | (setup (:straight consult) |
856 | (:also-load +consult) | 859 | (:also-load +consult) |
857 | ;; from Consult wiki | 860 | ;; from Consult wiki |
@@ -1072,6 +1075,11 @@ See also `crux-reopen-as-root-mode'." | |||
1072 | (setup (:straight eshell-syntax-highlighting) | 1075 | (setup (:straight eshell-syntax-highlighting) |
1073 | (:hook-into eshell-mode)) | 1076 | (:hook-into eshell-mode)) |
1074 | 1077 | ||
1078 | (setup (:straight eshell-vterm) | ||
1079 | (:load-after eshell) | ||
1080 | (defalias 'eshell/v 'eshell-exec-visual) | ||
1081 | (eshell-vterm-mode +1)) | ||
1082 | |||
1075 | (setup (:straight-when exec-path-from-shell | 1083 | (setup (:straight-when exec-path-from-shell |
1076 | (eq system-system 'linux)) | 1084 | (eq system-system 'linux)) |
1077 | (require 'exec-path-from-shell) | 1085 | (require 'exec-path-from-shell) |
@@ -1140,7 +1148,7 @@ See also `crux-reopen-as-root-mode'." | |||
1140 | (let (schemes) | 1148 | (let (schemes) |
1141 | (dolist (scheme '(("scheme" . geiser-chez) ; chez | 1149 | (dolist (scheme '(("scheme" . geiser-chez) ; chez |
1142 | ("petite" . geiser-chez) ; petite | 1150 | ("petite" . geiser-chez) ; petite |
1143 | ("csi" . geiser-chicken) ; chicken | 1151 | ("csi" . geiser-chicken) ; chicken |
1144 | ("gsi" . geiser-gambit) | 1152 | ("gsi" . geiser-gambit) |
1145 | ("gosh" . geiser-gauche) | 1153 | ("gosh" . geiser-gauche) |
1146 | ("guile" . geiser-guile) | 1154 | ("guile" . geiser-guile) |
@@ -1286,8 +1294,12 @@ See also `crux-reopen-as-root-mode'." | |||
1286 | (+sunrise-sunset 'modus-themes-load-operandi 'modus-themes-load-vivendi)) | 1294 | (+sunrise-sunset 'modus-themes-load-operandi 'modus-themes-load-vivendi)) |
1287 | 1295 | ||
1288 | (setup (:straight mwim) | 1296 | (setup (:straight mwim) |
1289 | (:+key "C-a" #'mwim-beginning | 1297 | (:require +mwim) |
1290 | "C-e" #'mwim-end)) | 1298 | (:option +mwim-passthrough-modes '(comint-mode |
1299 | eshell-mode | ||
1300 | vterm-mode)) | ||
1301 | (:+key "C-a" #'+mwim-beginning-maybe | ||
1302 | "C-e" #'+mwim-end-maybe)) | ||
1291 | 1303 | ||
1292 | (setup (:straight orderless) | 1304 | (setup (:straight orderless) |
1293 | (:also-load +orderless) | 1305 | (:also-load +orderless) |
@@ -1402,6 +1414,17 @@ See also `crux-reopen-as-root-mode'." | |||
1402 | +modeline-position))) | 1414 | +modeline-position))) |
1403 | (simple-modeline-mode +1)) | 1415 | (simple-modeline-mode +1)) |
1404 | 1416 | ||
1417 | (setup (:straight-when sly | ||
1418 | (defvar +lisp-bin (executable-find "sbcl"))) | ||
1419 | (:also-load sly-autoloads | ||
1420 | +sly) | ||
1421 | (:option inferior-lisp-program +lisp-bin | ||
1422 | sly-kill-without-query-p t) | ||
1423 | (:with-feature sly-mrepl | ||
1424 | (dolist (key '("RET" "<return>")) | ||
1425 | (:bind key #'sly-mrepl-return-at-end)) | ||
1426 | (:bind "C-c C-c" #'sly-mrepl-return))) | ||
1427 | |||
1405 | (setup (:straight smartscan) | 1428 | (setup (:straight smartscan) |
1406 | (:with-map smartscan-map | 1429 | (:with-map smartscan-map |
1407 | (:bind "M-'" nil)) | 1430 | (:bind "M-'" nil)) |
@@ -1433,6 +1456,10 @@ See also `crux-reopen-as-root-mode'." | |||
1433 | (auto-save-visited-mode -1) | 1456 | (auto-save-visited-mode -1) |
1434 | (super-save-mode +1)) | 1457 | (super-save-mode +1)) |
1435 | 1458 | ||
1459 | (setup (:straight-when systemd | ||
1460 | (executable-find "systemd")) | ||
1461 | (:option systemd-man-function 'woman)) | ||
1462 | |||
1436 | (setup (:straight (titlecase | 1463 | (setup (:straight (titlecase |
1437 | :host github | 1464 | :host github |
1438 | :repo "duckwork/titlecase.el" | 1465 | :repo "duckwork/titlecase.el" |
@@ -1551,6 +1578,17 @@ See also `crux-reopen-as-root-mode'." | |||
1551 | (setup (:straight vlf) | 1578 | (setup (:straight vlf) |
1552 | (:require vlf-setup)) | 1579 | (:require vlf-setup)) |
1553 | 1580 | ||
1581 | (setup (:straight-when vterm | ||
1582 | (and module-file-suffix | ||
1583 | (executable-find "cmake"))) | ||
1584 | (:also-load +vterm) | ||
1585 | (:option vterm-always-compile-module t | ||
1586 | vterm-buffer-name-string "vterm: %s" | ||
1587 | vterm-max-scrollback 100000 ; max allowed by vterm-module.h | ||
1588 | ) | ||
1589 | (advice-add 'counsel-yank-pop-action :around | ||
1590 | #'+vterm-counsel-yank-pop-action)) | ||
1591 | |||
1554 | (setup (:straight web-mode) | 1592 | (setup (:straight web-mode) |
1555 | (setf (alist-get (rx "." (or "htm" "html" "phtml" "tpl.php" | 1593 | (setf (alist-get (rx "." (or "htm" "html" "phtml" "tpl.php" |
1556 | "asp" "gsp" "jsp" "ascx" "aspx" | 1594 | "asp" "gsp" "jsp" "ascx" "aspx" |
diff --git a/lisp/+eshell.el b/lisp/+eshell.el index bd92b03..1f8677c 100644 --- a/lisp/+eshell.el +++ b/lisp/+eshell.el | |||
@@ -76,5 +76,25 @@ any directory proferred by `consult-dir'." | |||
76 | (add-hook 'eshell-post-command-hook #'eshell-record-args nil t) | 76 | (add-hook 'eshell-post-command-hook #'eshell-record-args nil t) |
77 | (remove-hook 'eshell-post-command-hook #'eshell-record-args t))) | 77 | (remove-hook 'eshell-post-command-hook #'eshell-record-args t))) |
78 | 78 | ||
79 | ;;;###autoload | ||
80 | (defmacro +eshell-eval-after-load (&rest forms) | ||
81 | "Execute FORMS after Eshell is loaded. | ||
82 | If Eshell is already loaded in the session, immediately execute | ||
83 | forms. | ||
84 | |||
85 | I wrote this because Eshell doesn't properly do loading or | ||
86 | something, it's really annoying to work with." | ||
87 | (declare (indent 0)) | ||
88 | `(progn | ||
89 | (defun +eshell@setup () | ||
90 | "Setup the Eshell session." | ||
91 | ,@forms) | ||
92 | (when (featurep 'eshell) | ||
93 | `(dolist (buf (buffer-list)) | ||
94 | (with-current-buffer buf | ||
95 | (when (derived-mode-p 'eshell-mode) | ||
96 | (+eshell@setup))))) | ||
97 | '(add-hook 'eshell-mode-hook #'+eshell@setup))) | ||
98 | |||
79 | (provide '+eshell) | 99 | (provide '+eshell) |
80 | ;;; +eshell.el ends here | 100 | ;;; +eshell.el ends here |
diff --git a/lisp/+mwim.el b/lisp/+mwim.el new file mode 100644 index 0000000..1c8ef5c --- /dev/null +++ b/lisp/+mwim.el | |||
@@ -0,0 +1,42 @@ | |||
1 | ;;; +mwim.el --- Extras -*- lexical-binding: t; -*- | ||
2 | |||
3 | ;;; Commentary: | ||
4 | |||
5 | ;;; Code: | ||
6 | |||
7 | (require 'seq) | ||
8 | |||
9 | (defgroup +mwim nil | ||
10 | "Extra `mwim' customizations." | ||
11 | :group 'mwim) | ||
12 | |||
13 | (defcustom +mwim-passthrough-modes nil | ||
14 | "Modes to not move-where-I-mean." | ||
15 | :type '(repeat function)) | ||
16 | |||
17 | (defun +mwim-beginning-maybe (&optional arg) | ||
18 | "Perform `mwim-beginning', maybe. | ||
19 | Will just do \\[beginning-of-line] in one of | ||
20 | `+mwim-passthrough-modes'." | ||
21 | (interactive) | ||
22 | (if (apply #'derived-mode-p +mwim-passthrough-modes) | ||
23 | (let ((this-mode-map (symbol-value (intern (format "%s-map" major-mode)))) | ||
24 | (key "C-a")) | ||
25 | (funcall (or (keymap-lookup this-mode-map key t t) | ||
26 | (keymap-lookup (current-global-map) key t t)))) | ||
27 | (call-interactively #'mwim-beginning))) | ||
28 | |||
29 | (defun +mwim-end-maybe (&optional arg) | ||
30 | "Perform `mwim-beginning', maybe. | ||
31 | Will just do \\[end-of-line] in one of | ||
32 | `+mwim-passthrough-modes'." | ||
33 | (interactive) | ||
34 | (if (apply #'derived-mode-p +mwim-passthrough-modes) | ||
35 | (let ((this-mode-map (symbol-value (intern (format "%s-map" major-mode)))) | ||
36 | (key "C-e")) | ||
37 | (funcall (or (keymap-lookup this-mode-map key t t) | ||
38 | (keymap-lookup (current-global-map) key t t)))) | ||
39 | (call-interactively #'mwim-end))) | ||
40 | |||
41 | (provide '+mwim) | ||
42 | ;;; +mwim.el ends here | ||
diff --git a/lisp/+setup.el b/lisp/+setup.el index 6c8e31e..367fb01 100644 --- a/lisp/+setup.el +++ b/lisp/+setup.el | |||
@@ -49,6 +49,11 @@ | |||
49 | :repeatable t | 49 | :repeatable t |
50 | :after-loaded t) | 50 | :after-loaded t) |
51 | 51 | ||
52 | (defun +setup-straight-shorthand (sexp) | ||
53 | "Shorthand for `:straight' and other local macros." | ||
54 | (let ((recipe (cadr sexp))) | ||
55 | (or (car-safe recipe) recipe))) | ||
56 | |||
52 | (setup-define :straight | 57 | (setup-define :straight |
53 | (lambda (recipe) | 58 | (lambda (recipe) |
54 | `(unless (ignore-errors (straight-use-package ',recipe) t) | 59 | `(unless (ignore-errors (straight-use-package ',recipe) t) |
@@ -59,11 +64,18 @@ | |||
59 | This macro can be used as HEAD, and will replace itself with the | 64 | This macro can be used as HEAD, and will replace itself with the |
60 | first RECIPE's package." | 65 | first RECIPE's package." |
61 | :repeatable t | 66 | :repeatable t |
62 | :shorthand (lambda (sexp) | 67 | :shorthand #'+setup-straight-shorthand) |
63 | (let ((recipe (cadr sexp))) | 68 | |
64 | (if (consp recipe) | 69 | (setup-define :straight-after |
65 | (car recipe) | 70 | (lambda (recipe feature) |
66 | recipe)))) | 71 | `(with-eval-after-load ,feature |
72 | (setup (:straight ,recipe)))) | ||
73 | :indent 1 | ||
74 | :documentation | ||
75 | "Install RECIPE with `straight-use-package', after FEATURE. | ||
76 | This macro can be used as HEAD, and will replace itself with the | ||
77 | first RECIPE's package." | ||
78 | :shorthand #'+setup-straight-shorthand) | ||
67 | 79 | ||
68 | (setup-define :straight-when | 80 | (setup-define :straight-when |
69 | (lambda (recipe condition) | 81 | (lambda (recipe condition) |
@@ -80,9 +92,7 @@ evaluating the body. This macro can be used as HEAD, and will | |||
80 | replace itself with the RECIPE's package." | 92 | replace itself with the RECIPE's package." |
81 | :repeatable 2 | 93 | :repeatable 2 |
82 | :indent 1 | 94 | :indent 1 |
83 | :shorthand (lambda (sexp) | 95 | :shorthand #'+setup-straight-shorthand) |
84 | (let ((recipe (cadr sexp))) | ||
85 | (if (consp recipe) (car recipe) recipe)))) | ||
86 | 96 | ||
87 | (provide '+setup) | 97 | (provide '+setup) |
88 | ;;; +setup.el ends here | 98 | ;;; +setup.el ends here |
diff --git a/lisp/+sly.el b/lisp/+sly.el new file mode 100644 index 0000000..8d8fd6a --- /dev/null +++ b/lisp/+sly.el | |||
@@ -0,0 +1,18 @@ | |||
1 | ;;; +sly.el --- Sly customizations -*- lexical-binding: t; -*- | ||
2 | |||
3 | ;;; Commentary: | ||
4 | |||
5 | ;;; Code: | ||
6 | |||
7 | (require 'sly) | ||
8 | |||
9 | (defun sly-mrepl-return-at-end () | ||
10 | (interactive) | ||
11 | (if (<= (point-max) (point)) | ||
12 | (sly-mrepl-return) | ||
13 | (if (bound-and-true-p paredit-mode) | ||
14 | (paredit-newline) | ||
15 | (electric-newline-and-maybe-indent)))) | ||
16 | |||
17 | (provide '+sly) | ||
18 | ;;; +sly.el ends here | ||
diff --git a/lisp/+vterm.el b/lisp/+vterm.el new file mode 100644 index 0000000..66e226b --- /dev/null +++ b/lisp/+vterm.el | |||
@@ -0,0 +1,19 @@ | |||
1 | ;;; +vterm.el --- Vterm extras -*- lexical-binding: t; -*- | ||
2 | |||
3 | ;;; Commentary: | ||
4 | |||
5 | ;;; Code: | ||
6 | |||
7 | (require +vterm) | ||
8 | |||
9 | (defun +vterm-counsel-yank-pop-action (orig-fun &rest args) | ||
10 | (if (equal major-mode 'vterm-mode) | ||
11 | (let ((inhibit-read-only t) | ||
12 | (yank-undo-function (lambda (_start _end) (vterm-undo)))) | ||
13 | (cl-letf (((symbol-function 'insert-for-yank) | ||
14 | (lambda (str) (vterm-send-string str t)))) | ||
15 | (apply orig-fun args))) | ||
16 | (apply orig-fun args))) | ||
17 | |||
18 | (provide '+vterm) | ||
19 | ;;; +vterm.el ends here | ||