Dammit, lots of changes

This commit is contained in:
Case Duckworth 2022-01-16 23:13:11 -06:00
parent 4362009bad
commit 2243b1e4ef
6 changed files with 181 additions and 34 deletions

90
init.el
View File

@ -295,23 +295,25 @@
eshell-scroll-to-bottom-on-input 'all eshell-scroll-to-bottom-on-input 'all
eshell-smart-space-goes-to-end t eshell-smart-space-goes-to-end t
eshell-where-to-jump 'begin) eshell-where-to-jump 'begin)
(add-hook 'eshell-mode-hook (setf (alist-get 'eshell-mode mwim-beginning-of-line-function)
(defun +eshell@setup () #'eshell-bol)
"Eshell improperly does loading. Gah." (+eshell-eval-after-load
(interactive) ;; Set local settings
(dolist (setting `((outline-regexp . ,eshell-prompt-regexp) (dolist (setting (list (cons 'outline-regexp eshell-prompt-regexp)
(page-delimiter . ,eshell-prompt-regexp) (cons 'page-delimiter eshell-prompt-regexp)
(imenu-generic-expression (cons 'imenu-generic-expression
. ,`(("Prompt" (list "Prompt"
,(concat eshell-prompt-regexp (concat eshell-prompt-regexp
"\\(.*\\)") "\\(.*\\)")
1))))) 1))))
(set (make-local-variable (car setting)) (cdr setting))) (set (make-local-variable (car setting)) (cdr setting)))
(dolist (binding `(("C-d" . +eshell-quit-or-delete-char))) ;; Bind keys
(define-key eshell-mode-map (dolist (binding '(("C-d" . +eshell-quit-or-delete-char)))
(define-key eshell-mode-map
(kbd (car binding)) (cdr binding))) (kbd (car binding)) (cdr binding)))
(dolist (environment `(("PAGER" . "cat"))) ;; Environment variables
(setenv (car environment) (cdr environment)))))) (dolist (environment '(("PAGER" . "cat")))
(setenv (car environment) (cdr environment)))))
(setup eww (setup eww
(:also-load +eww) (:also-load +eww)
@ -560,6 +562,10 @@
(with-eval-after-load 'user-save (with-eval-after-load 'user-save
(advice-add 'org-export-dispatch :before 'user-save-run-hooks))) (advice-add 'org-export-dispatch :before 'user-save-run-hooks)))
(setup password-cache
(:option password-cache t
password-cache-expiry (* 60 60)))
(setup prog (setup prog
(:local-set comment-auto-fill-only-comments t) (:local-set comment-auto-fill-only-comments t)
(:hook #'prettify-symbols-mode (:hook #'prettify-symbols-mode
@ -591,7 +597,8 @@
(setup time (setup time
(:option display-time-format "%H:%M" (:option display-time-format "%H:%M"
display-time-default-load-average nil) display-time-default-load-average nil
display-time-mail-file :disable)
(display-time-mode +1)) (display-time-mode +1))
(setup (:straight 0x0) (setup (:straight 0x0)
@ -663,12 +670,6 @@
;;cape-dict)) ;;cape-dict))
(add-to-list 'completion-at-point-functions fn :append))))) (add-to-list 'completion-at-point-functions fn :append)))))
(setup (:straight (capf-autosuggest
:host nil
:repo "https://repo.or.cz/emacs-capf-autosuggest.git"))
(:hook-into eshell-mode
comint-mode))
(setup (:straight circe) (setup (:straight circe)
(:require _circe (:require _circe
+circe) +circe)
@ -842,6 +843,8 @@
(add-hook 'modus-themes-after-load-theme-hook #'circe-nick-color-reset)) (add-hook 'modus-themes-after-load-theme-hook #'circe-nick-color-reset))
(add-hook 'kill-emacs-hook #'+circe-quit-all@kill-emacs)) (add-hook 'kill-emacs-hook #'+circe-quit-all@kill-emacs))
(setup (:straight clhs))
(setup (:straight consult) (setup (:straight consult)
(:also-load +consult) (:also-load +consult)
;; from Consult wiki ;; from Consult wiki
@ -1062,6 +1065,11 @@ See also `crux-reopen-as-root-mode'."
(setup (:straight eshell-syntax-highlighting) (setup (:straight eshell-syntax-highlighting)
(:hook-into eshell-mode)) (:hook-into eshell-mode))
(setup (:straight eshell-vterm)
(:load-after eshell)
(defalias 'eshell/v 'eshell-exec-visual)
(eshell-vterm-mode +1))
(setup (:straight-when exec-path-from-shell (setup (:straight-when exec-path-from-shell
(eq system-system 'linux)) (eq system-system 'linux))
(require 'exec-path-from-shell) (require 'exec-path-from-shell)
@ -1130,7 +1138,7 @@ See also `crux-reopen-as-root-mode'."
(let (schemes) (let (schemes)
(dolist (scheme '(("scheme" . geiser-chez) ; chez (dolist (scheme '(("scheme" . geiser-chez) ; chez
("petite" . geiser-chez) ; petite ("petite" . geiser-chez) ; petite
("csi" . geiser-chicken) ; chicken ("csi" . geiser-chicken) ; chicken
("gsi" . geiser-gambit) ("gsi" . geiser-gambit)
("gosh" . geiser-gauche) ("gosh" . geiser-gauche)
("guile" . geiser-guile) ("guile" . geiser-guile)
@ -1276,8 +1284,12 @@ See also `crux-reopen-as-root-mode'."
(+sunrise-sunset 'modus-themes-load-operandi 'modus-themes-load-vivendi)) (+sunrise-sunset 'modus-themes-load-operandi 'modus-themes-load-vivendi))
(setup (:straight mwim) (setup (:straight mwim)
(:+key "C-a" #'mwim-beginning (:require +mwim)
"C-e" #'mwim-end)) (:option +mwim-passthrough-modes '(comint-mode
eshell-mode
vterm-mode))
(:+key "C-a" #'+mwim-beginning-maybe
"C-e" #'+mwim-end-maybe))
(setup (:straight orderless) (setup (:straight orderless)
(:also-load +orderless) (:also-load +orderless)
@ -1392,6 +1404,17 @@ See also `crux-reopen-as-root-mode'."
+modeline-position))) +modeline-position)))
(simple-modeline-mode +1)) (simple-modeline-mode +1))
(setup (:straight-when sly
(defvar +lisp-bin (executable-find "sbcl")))
(:also-load sly-autoloads
+sly)
(:option inferior-lisp-program +lisp-bin
sly-kill-without-query-p t)
(:with-feature sly-mrepl
(dolist (key '("RET" "<return>"))
(:bind key #'sly-mrepl-return-at-end))
(:bind "C-c C-c" #'sly-mrepl-return)))
(setup (:straight smartscan) (setup (:straight smartscan)
(:with-map smartscan-map (:with-map smartscan-map
(:bind "M-'" nil)) (:bind "M-'" nil))
@ -1423,6 +1446,10 @@ See also `crux-reopen-as-root-mode'."
(auto-save-visited-mode -1) (auto-save-visited-mode -1)
(super-save-mode +1)) (super-save-mode +1))
(setup (:straight-when systemd
(executable-find "systemd"))
(:option systemd-man-function 'woman))
(setup (:straight (titlecase (setup (:straight (titlecase
:host github :host github
:repo "duckwork/titlecase.el" :repo "duckwork/titlecase.el"
@ -1541,6 +1568,17 @@ See also `crux-reopen-as-root-mode'."
(setup (:straight vlf) (setup (:straight vlf)
(:require vlf-setup)) (:require vlf-setup))
(setup (:straight-when vterm
(and module-file-suffix
(executable-find "cmake")))
(:also-load +vterm)
(:option vterm-always-compile-module t
vterm-buffer-name-string "vterm: %s"
vterm-max-scrollback 100000 ; max allowed by vterm-module.h
)
(advice-add 'counsel-yank-pop-action :around
#'+vterm-counsel-yank-pop-action))
(setup (:straight web-mode) (setup (:straight web-mode)
(setf (alist-get (rx "." (or "htm" "html" "phtml" "tpl.php" (setf (alist-get (rx "." (or "htm" "html" "phtml" "tpl.php"
"asp" "gsp" "jsp" "ascx" "aspx" "asp" "gsp" "jsp" "ascx" "aspx"

View File

@ -76,5 +76,25 @@ any directory proferred by `consult-dir'."
(add-hook 'eshell-post-command-hook #'eshell-record-args nil t) (add-hook 'eshell-post-command-hook #'eshell-record-args nil t)
(remove-hook 'eshell-post-command-hook #'eshell-record-args t))) (remove-hook 'eshell-post-command-hook #'eshell-record-args t)))
;;;###autoload
(defmacro +eshell-eval-after-load (&rest forms)
"Execute FORMS after Eshell is loaded.
If Eshell is already loaded in the session, immediately execute
forms.
I wrote this because Eshell doesn't properly do loading or
something, it's really annoying to work with."
(declare (indent 0))
`(progn
(defun +eshell@setup ()
"Setup the Eshell session."
,@forms)
(when (featurep 'eshell)
`(dolist (buf (buffer-list))
(with-current-buffer buf
(when (derived-mode-p 'eshell-mode)
(+eshell@setup)))))
'(add-hook 'eshell-mode-hook #'+eshell@setup)))
(provide '+eshell) (provide '+eshell)
;;; +eshell.el ends here ;;; +eshell.el ends here

42
lisp/+mwim.el Normal file
View File

@ -0,0 +1,42 @@
;;; +mwim.el --- Extras -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(require 'seq)
(defgroup +mwim nil
"Extra `mwim' customizations."
:group 'mwim)
(defcustom +mwim-passthrough-modes nil
"Modes to not move-where-I-mean."
:type '(repeat function))
(defun +mwim-beginning-maybe (&optional arg)
"Perform `mwim-beginning', maybe.
Will just do \\[beginning-of-line] in one of
`+mwim-passthrough-modes'."
(interactive)
(if (apply #'derived-mode-p +mwim-passthrough-modes)
(let ((this-mode-map (symbol-value (intern (format "%s-map" major-mode))))
(key "C-a"))
(funcall (or (keymap-lookup this-mode-map key t t)
(keymap-lookup (current-global-map) key t t))))
(call-interactively #'mwim-beginning)))
(defun +mwim-end-maybe (&optional arg)
"Perform `mwim-beginning', maybe.
Will just do \\[end-of-line] in one of
`+mwim-passthrough-modes'."
(interactive)
(if (apply #'derived-mode-p +mwim-passthrough-modes)
(let ((this-mode-map (symbol-value (intern (format "%s-map" major-mode))))
(key "C-e"))
(funcall (or (keymap-lookup this-mode-map key t t)
(keymap-lookup (current-global-map) key t t))))
(call-interactively #'mwim-end)))
(provide '+mwim)
;;; +mwim.el ends here

View File

@ -49,6 +49,11 @@
:repeatable t :repeatable t
:after-loaded t) :after-loaded t)
(defun +setup-straight-shorthand (sexp)
"Shorthand for `:straight' and other local macros."
(let ((recipe (cadr sexp)))
(or (car-safe recipe) recipe)))
(setup-define :straight (setup-define :straight
(lambda (recipe) (lambda (recipe)
`(unless (ignore-errors (straight-use-package ',recipe) t) `(unless (ignore-errors (straight-use-package ',recipe) t)
@ -59,11 +64,18 @@
This macro can be used as HEAD, and will replace itself with the This macro can be used as HEAD, and will replace itself with the
first RECIPE's package." first RECIPE's package."
:repeatable t :repeatable t
:shorthand (lambda (sexp) :shorthand #'+setup-straight-shorthand)
(let ((recipe (cadr sexp)))
(if (consp recipe) (setup-define :straight-after
(car recipe) (lambda (recipe feature)
recipe)))) `(with-eval-after-load ,feature
(setup (:straight ,recipe))))
:indent 1
:documentation
"Install RECIPE with `straight-use-package', after FEATURE.
This macro can be used as HEAD, and will replace itself with the
first RECIPE's package."
:shorthand #'+setup-straight-shorthand)
(setup-define :straight-when (setup-define :straight-when
(lambda (recipe condition) (lambda (recipe condition)
@ -80,9 +92,7 @@ evaluating the body. This macro can be used as HEAD, and will
replace itself with the RECIPE's package." replace itself with the RECIPE's package."
:repeatable 2 :repeatable 2
:indent 1 :indent 1
:shorthand (lambda (sexp) :shorthand #'+setup-straight-shorthand)
(let ((recipe (cadr sexp)))
(if (consp recipe) (car recipe) recipe))))
(provide '+setup) (provide '+setup)
;;; +setup.el ends here ;;; +setup.el ends here

18
lisp/+sly.el Normal file
View File

@ -0,0 +1,18 @@
;;; +sly.el --- Sly customizations -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(require 'sly)
(defun sly-mrepl-return-at-end ()
(interactive)
(if (<= (point-max) (point))
(sly-mrepl-return)
(if (bound-and-true-p paredit-mode)
(paredit-newline)
(electric-newline-and-maybe-indent))))
(provide '+sly)
;;; +sly.el ends here

19
lisp/+vterm.el Normal file
View File

@ -0,0 +1,19 @@
;;; +vterm.el --- Vterm extras -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(require +vterm)
(defun +vterm-counsel-yank-pop-action (orig-fun &rest args)
(if (equal major-mode 'vterm-mode)
(let ((inhibit-read-only t)
(yank-undo-function (lambda (_start _end) (vterm-undo))))
(cl-letf (((symbol-function 'insert-for-yank)
(lambda (str) (vterm-send-string str t))))
(apply orig-fun args)))
(apply orig-fun args)))
(provide '+vterm)
;;; +vterm.el ends here