refactor(emacs): Cleanup

This commit is contained in:
Madeleine Sydney
2025-02-17 02:51:21 -07:00
parent 584cff0bd2
commit 0c2e7d7d6d
2 changed files with 55 additions and 51 deletions

View File

@@ -64,10 +64,8 @@
"If any Evil Ex search highlightings are active, remove them and return t.
Otherwise, nil."
(let ((names '(evil-ex-substitute evil-ex-search)))
(if (-any #'evil-ex-hl-active-p names)
(progn (evil-ex-nohighlight)
t)
nil)))
(when (-any #'evil-ex-hl-active-p names)
(prog1 t (evil-ex-nohighlight)))))
(add-hook 'syd-escape-hook #'syd-evil-nohl-h)
(general-def
@@ -91,8 +89,8 @@ Otherwise, nil."
(unless noninteractive
(defvar syd-evil-collection-disabled-list
'(anaconda-mode buff-menu calc comint company custom eldoc elisp-mode ert
free-keys helm help image indent kmacro kotlin-mode lispy outline
replace shortdoc simple slime tab-bar)
free-keys helm help image indent kmacro kotlin-mode lispy outline
replace shortdoc simple slime tab-bar)
"A list of `evil-collection' modules to ignore. See
`evil-collection-mode-list' for a list of available options.")
@@ -109,35 +107,35 @@ Otherwise, nil."
;; It must be updated whenever evil-collection updates theirs.
(defvar evil-collection-mode-list
`(2048-game ag alchemist anaconda-mode apropos arc-mode atomic-chrome
auto-package-update beginend bluetooth bm bookmark
(buff-menu "buff-menu") bufler calc calendar cider citre cmake-mode
color-rg comint company compile consult corfu crdt (csv "csv-mode")
(custom cus-edit) cus-theme dape dashboard daemons deadgrep debbugs
debug devdocs dictionary diff-hl diff-mode dired dired-sidebar
disk-usage distel doc-view docker eat ebib ebuku edbi edebug ediff eglot
elpaca ement explain-pause-mode eldoc elfeed elisp-mode elisp-refs
elisp-slime-nav embark emms ,@(if (> emacs-major-version 28) '(emoji))
epa ert eshell eval-sexp-fu evil-mc eww fanyi finder flycheck flymake
forge free-keys geiser ggtags git-timemachine gited gnus go-mode gptel
grep guix hackernews helm help helpful hg-histedit hungry-delete hyrolo
ibuffer (image image-mode) image-dired image+ imenu imenu-list
(indent "indent") indium info ivy js2-mode
,@(if (>= emacs-major-version 30) '(kmacro)) leetcode lispy lms log-edit
log-view lsp-ui-imenu lua-mode kotlin-mode macrostep man
(magit magit-repos magit-submodule) magit-repos magit-section
magit-todos markdown-mode monky mpc mpdel mu4e mu4e-conversation neotree
newsticker notmuch nov omnisharp org org-present org-roam osx-dictionary
outline p4 (package-menu package) pass (pdf pdf-tools) popup proced
prodigy profiler p-search python quickrun racer racket-describe realgud
reftex replace restclient rg ripgrep rjsx-mode robe rtags ruby-mode
scheme scroll-lock selectrum sh-script
,@(if (> emacs-major-version 27) '(shortdoc)) simple simple-mpc slime
sly smerge-mode snake so-long speedbar tab-bar tablist tar-mode telega
(term term ansi-term multi-term) tetris thread tide timer-list
transmission trashed tuareg typescript-mode vc-annotate vc-dir vc-git
vdiff vertico view vlf vterm vundo w3m wdired wgrep which-key
with-editor woman xref xwidget yaml-mode youtube-dl zmusic
(ztree ztree-diff)))
auto-package-update beginend bluetooth bm bookmark
(buff-menu "buff-menu") bufler calc calendar cider citre cmake-mode
color-rg comint company compile consult corfu crdt (csv "csv-mode")
(custom cus-edit) cus-theme dape dashboard daemons deadgrep debbugs
debug devdocs dictionary diff-hl diff-mode dired dired-sidebar
disk-usage distel doc-view docker eat ebib ebuku edbi edebug ediff eglot
elpaca ement explain-pause-mode eldoc elfeed elisp-mode elisp-refs
elisp-slime-nav embark emms ,@(if (> emacs-major-version 28) '(emoji))
epa ert eshell eval-sexp-fu evil-mc eww fanyi finder flycheck flymake
forge free-keys geiser ggtags git-timemachine gited gnus go-mode gptel
grep guix hackernews helm help helpful hg-histedit hungry-delete hyrolo
ibuffer (image image-mode) image-dired image+ imenu imenu-list
(indent "indent") indium info ivy js2-mode
,@(if (>= emacs-major-version 30) '(kmacro)) leetcode lispy lms log-edit
log-view lsp-ui-imenu lua-mode kotlin-mode macrostep man
(magit magit-repos magit-submodule) magit-repos magit-section
magit-todos markdown-mode monky mpc mpdel mu4e mu4e-conversation neotree
newsticker notmuch nov omnisharp org org-present org-roam osx-dictionary
outline p4 (package-menu package) pass (pdf pdf-tools) popup proced
prodigy profiler p-search python quickrun racer racket-describe realgud
reftex replace restclient rg ripgrep rjsx-mode robe rtags ruby-mode
scheme scroll-lock selectrum sh-script
,@(if (> emacs-major-version 27) '(shortdoc)) simple simple-mpc slime
sly smerge-mode snake so-long speedbar tab-bar tablist tar-mode telega
(term term ansi-term multi-term) tetris thread tide timer-list
transmission trashed tuareg typescript-mode vc-annotate vc-dir vc-git
vdiff vertico view vlf vterm vundo w3m wdired wgrep which-key
with-editor woman xref xwidget yaml-mode youtube-dl zmusic
(ztree ztree-diff)))
(cl-defun syd-evil-collection-init (module &key disabled-modules)
"Initialise evil-collection-MODULE.
@@ -181,34 +179,34 @@ modules."
;; Emacs loads these two packages immediately, at startup, which needlessly
;; convolutes load order for evil-collection-help.
(with-transient-after 'help-mode
(syd-evil-collection-init 'help))
(syd-evil-collection-init 'help))
(with-transient-after 'Buffer-menu-mode
(syd-evil-collection-init '(buff-menu "buff-menu")))
(syd-evil-collection-init '(buff-menu "buff-menu")))
(with-transient-after 'calc-mode
(syd-evil-collection-init 'calc))
(syd-evil-collection-init 'calc))
(with-transient-after 'image-mode
(syd-evil-collection-init 'image))
(syd-evil-collection-init 'image))
(with-transient-after 'emacs-lisp-mode
(syd-evil-collection-init 'elisp-mode))
(syd-evil-collection-init 'elisp-mode))
(with-transient-after 'occur-mode
(syd-evil-collection-init 'replace))
(syd-evil-collection-init 'replace))
(with-transient-after 'indent-rigidly
(syd-evil-collection-init '(indent "indent")))
(syd-evil-collection-init '(indent "indent")))
(when (>= emacs-major-version 30)
(with-transient-after 'kmacro-menu-mode
(syd-evil-collection-init 'kmacro)))
(syd-evil-collection-init 'kmacro)))
(with-transient-after 'minibuffer-setup-hook
(when evil-collection-setup-minibuffer
(syd-evil-collection-init 'minibuffer)
(evil-collection-minibuffer-insert)))
(when evil-collection-setup-minibuffer
(syd-evil-collection-init 'minibuffer)
(evil-collection-minibuffer-insert)))
(with-transient-after 'process-menu-mode
(syd-evil-collection-init '(process-menu simple)))
(syd-evil-collection-init '(process-menu simple)))
(with-transient-after 'shortdoc-mode
(syd-evil-collection-init 'shortdoc))
(syd-evil-collection-init 'shortdoc))
(with-transient-after 'tabulated-list-mode
(syd-evil-collection-init 'tabulated-list))
(syd-evil-collection-init 'tabulated-list))
(with-transient-after 'tab-bar-mode
(syd-evil-collection-init 'tab-bar))
(syd-evil-collection-init 'tab-bar))
;; HACK: Do this ourselves because evil-collection break's
;; `eval-after-load' load order by loading their target plugin before