summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-01-16 23:13:11 -0600
committerCase Duckworth2022-01-16 23:13:11 -0600
commit2243b1e4effdeda0cec9cde4a49fd9ac8a5f9271 (patch)
treef7206bee6d6d046e528ab3af26550e08c1df03b5
parentUnignore private.el (diff)
downloademacs-2243b1e4effdeda0cec9cde4a49fd9ac8a5f9271.tar.gz
emacs-2243b1e4effdeda0cec9cde4a49fd9ac8a5f9271.zip
Dammit, lots of changes
-rw-r--r--init.el90
-rw-r--r--lisp/+eshell.el20
-rw-r--r--lisp/+mwim.el42
-rw-r--r--lisp/+setup.el26
-rw-r--r--lisp/+sly.el18
-rw-r--r--lisp/+vterm.el19
6 files changed, 181 insertions, 34 deletions
diff --git a/init.el b/init.el index 4136271..9f4d2fe 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
@@ -591,7 +597,8 @@
591 597
592(setup time 598(setup time
593 (:option display-time-format "%H:%M" 599 (:option display-time-format "%H:%M"
594 display-time-default-load-average nil) 600 display-time-default-load-average nil
601 display-time-mail-file :disable)
595 (display-time-mode +1)) 602 (display-time-mode +1))
596 603
597(setup (:straight 0x0) 604(setup (:straight 0x0)
@@ -663,12 +670,6 @@
663 ;;cape-dict)) 670 ;;cape-dict))
664 (add-to-list 'completion-at-point-functions fn :append))))) 671 (add-to-list 'completion-at-point-functions fn :append)))))
665 672
666(setup (:straight (capf-autosuggest
667 :host nil
668 :repo "https://repo.or.cz/emacs-capf-autosuggest.git"))
669 (:hook-into eshell-mode
670 comint-mode))
671
672(setup (:straight circe) 673(setup (:straight circe)
673 (:require _circe 674 (:require _circe
674 +circe) 675 +circe)
@@ -842,6 +843,8 @@
842 (add-hook 'modus-themes-after-load-theme-hook #'circe-nick-color-reset)) 843 (add-hook 'modus-themes-after-load-theme-hook #'circe-nick-color-reset))
843 (add-hook 'kill-emacs-hook #'+circe-quit-all@kill-emacs)) 844 (add-hook 'kill-emacs-hook #'+circe-quit-all@kill-emacs))
844 845
846(setup (:straight clhs))
847
845(setup (:straight consult) 848(setup (:straight consult)
846 (:also-load +consult) 849 (:also-load +consult)
847 ;; from Consult wiki 850 ;; from Consult wiki
@@ -1062,6 +1065,11 @@ See also `crux-reopen-as-root-mode'."
1062(setup (:straight eshell-syntax-highlighting) 1065(setup (:straight eshell-syntax-highlighting)
1063 (:hook-into eshell-mode)) 1066 (:hook-into eshell-mode))
1064 1067
1068(setup (:straight eshell-vterm)
1069 (:load-after eshell)
1070 (defalias 'eshell/v 'eshell-exec-visual)
1071 (eshell-vterm-mode +1))
1072
1065(setup (:straight-when exec-path-from-shell 1073(setup (:straight-when exec-path-from-shell
1066 (eq system-system 'linux)) 1074 (eq system-system 'linux))
1067 (require 'exec-path-from-shell) 1075 (require 'exec-path-from-shell)
@@ -1130,7 +1138,7 @@ See also `crux-reopen-as-root-mode'."
1130 (let (schemes) 1138 (let (schemes)
1131 (dolist (scheme '(("scheme" . geiser-chez) ; chez 1139 (dolist (scheme '(("scheme" . geiser-chez) ; chez
1132 ("petite" . geiser-chez) ; petite 1140 ("petite" . geiser-chez) ; petite
1133 ("csi" . geiser-chicken) ; chicken 1141 ("csi" . geiser-chicken) ; chicken
1134 ("gsi" . geiser-gambit) 1142 ("gsi" . geiser-gambit)
1135 ("gosh" . geiser-gauche) 1143 ("gosh" . geiser-gauche)
1136 ("guile" . geiser-guile) 1144 ("guile" . geiser-guile)
@@ -1276,8 +1284,12 @@ See also `crux-reopen-as-root-mode'."
1276 (+sunrise-sunset 'modus-themes-load-operandi 'modus-themes-load-vivendi)) 1284 (+sunrise-sunset 'modus-themes-load-operandi 'modus-themes-load-vivendi))
1277 1285
1278(setup (:straight mwim) 1286(setup (:straight mwim)
1279 (:+key "C-a" #'mwim-beginning 1287 (:require +mwim)
1280 "C-e" #'mwim-end)) 1288 (:option +mwim-passthrough-modes '(comint-mode
1289 eshell-mode
1290 vterm-mode))
1291 (:+key "C-a" #'+mwim-beginning-maybe
1292 "C-e" #'+mwim-end-maybe))
1281 1293
1282(setup (:straight orderless) 1294(setup (:straight orderless)
1283 (:also-load +orderless) 1295 (:also-load +orderless)
@@ -1392,6 +1404,17 @@ See also `crux-reopen-as-root-mode'."
1392 +modeline-position))) 1404 +modeline-position)))
1393 (simple-modeline-mode +1)) 1405 (simple-modeline-mode +1))
1394 1406
1407(setup (:straight-when sly
1408 (defvar +lisp-bin (executable-find "sbcl")))
1409 (:also-load sly-autoloads
1410 +sly)
1411 (:option inferior-lisp-program +lisp-bin
1412 sly-kill-without-query-p t)
1413 (:with-feature sly-mrepl
1414 (dolist (key '("RET" "<return>"))
1415 (:bind key #'sly-mrepl-return-at-end))
1416 (:bind "C-c C-c" #'sly-mrepl-return)))
1417
1395(setup (:straight smartscan) 1418(setup (:straight smartscan)
1396 (:with-map smartscan-map 1419 (:with-map smartscan-map
1397 (:bind "M-'" nil)) 1420 (:bind "M-'" nil))
@@ -1423,6 +1446,10 @@ See also `crux-reopen-as-root-mode'."
1423 (auto-save-visited-mode -1) 1446 (auto-save-visited-mode -1)
1424 (super-save-mode +1)) 1447 (super-save-mode +1))
1425 1448
1449(setup (:straight-when systemd
1450 (executable-find "systemd"))
1451 (:option systemd-man-function 'woman))
1452
1426(setup (:straight (titlecase 1453(setup (:straight (titlecase
1427 :host github 1454 :host github
1428 :repo "duckwork/titlecase.el" 1455 :repo "duckwork/titlecase.el"
@@ -1541,6 +1568,17 @@ See also `crux-reopen-as-root-mode'."
1541(setup (:straight vlf) 1568(setup (:straight vlf)
1542 (:require vlf-setup)) 1569 (:require vlf-setup))
1543 1570
1571(setup (:straight-when vterm
1572 (and module-file-suffix
1573 (executable-find "cmake")))
1574 (:also-load +vterm)
1575 (:option vterm-always-compile-module t
1576 vterm-buffer-name-string "vterm: %s"
1577 vterm-max-scrollback 100000 ; max allowed by vterm-module.h
1578 )
1579 (advice-add 'counsel-yank-pop-action :around
1580 #'+vterm-counsel-yank-pop-action))
1581
1544(setup (:straight web-mode) 1582(setup (:straight web-mode)
1545 (setf (alist-get (rx "." (or "htm" "html" "phtml" "tpl.php" 1583 (setf (alist-get (rx "." (or "htm" "html" "phtml" "tpl.php"
1546 "asp" "gsp" "jsp" "ascx" "aspx" 1584 "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.
82If Eshell is already loaded in the session, immediately execute
83forms.
84
85I wrote this because Eshell doesn't properly do loading or
86something, 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.
19Will 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.
31Will 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 @@
59This macro can be used as HEAD, and will replace itself with the 64This macro can be used as HEAD, and will replace itself with the
60first RECIPE's package." 65first 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.
76This macro can be used as HEAD, and will replace itself with the
77first 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
80replace itself with the RECIPE's package." 92replace 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