diff options
author | Case Duckworth | 2022-01-16 23:13:11 -0600 |
---|---|---|
committer | Case Duckworth | 2022-01-16 23:13:11 -0600 |
commit | 2243b1e4effdeda0cec9cde4a49fd9ac8a5f9271 (patch) | |
tree | f7206bee6d6d046e528ab3af26550e08c1df03b5 /lisp | |
parent | Unignore private.el (diff) | |
download | emacs-2243b1e4effdeda0cec9cde4a49fd9ac8a5f9271.tar.gz emacs-2243b1e4effdeda0cec9cde4a49fd9ac8a5f9271.zip |
Dammit, lots of changes
Diffstat (limited to 'lisp')
-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 |
5 files changed, 117 insertions, 8 deletions
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 | ||