Move a ton of packages to init.el

This commit is contained in:
mir 2024-01-23 18:47:28 -09:00
parent 4b18ac395c
commit 2f427ad014
2 changed files with 203 additions and 248 deletions

203
init.el
View File

@ -61,6 +61,209 @@
;; https://andrewjamesjohnson.com/suppressing-ad-handle-definition-warnings-in-emacs/ ;; https://andrewjamesjohnson.com/suppressing-ad-handle-definition-warnings-in-emacs/
(setq ad-redefinition-action 'accept) (setq ad-redefinition-action 'accept)
;; we be moving packages here to see what's slow elsewhere
(use-package emacs
:custom
;; (scroll-margin 2)
(scroll-conservatively 100)
;; (scroll-up-aggressively 0.01)
;; (scroll-down-aggressively 0.01)
(auto-window-vscroll nil)
:init
(global-visual-line-mode t)
(set-language-environment "UTF-8")
(global-prettify-symbols-mode 1)
(auto-insert-mode))
(use-package epg
:after tramp
:custom ;; these are ripped from `custom-file' which was auto-generated
(auth-sources '("~/.authinfo.gpg"))
(epg-pinentry-mode 'loopback))
;; save minibuffer history, see Vertico below
(use-package savehist
:init (savehist-mode)
:custom (savehist-file
(expand-file-name "minibuffer-history" backup-directory)))
;; save place in all files
(use-package saveplace
:init (save-place-mode t)
:custom
(save-place-file
(expand-file-name "file-position-save" backup-directory)))
(use-package image-mode
:hook
(image-mode . turn-off-line-numbers)
(image-mode . (lambda () (blink-cursor-mode -1))))
;; Visualize whitespace. In a very chill and invisible way.
(use-package whitespace
:diminish (whitespace-mode ;; org-indent-mode
;; org-vw-mode
auto-fill-mode)
:custom
(whitespace-style '(face lines-tail))
(whitespace-line-column 80)
(fill-column 80)
:hook
(prog-mode . whitespace-mode)
;; (org-mode . auto-fill-mode)
)
;; ...and finally, sync files with disk changes
(use-package autorevert
:diminish auto-revert-mode
:config (global-auto-revert-mode))
(use-package xwidget
:if (featurep 'xwidget)
:commands xwidget-webkit-browse-url
:config
(defun mir/webkit-isearch ()
(interactive)
(xwidget-webkit-search
(setq isearch-string
(read-from-minibuffer "Find in page: "))
(car xwidget-list)
'insensitive nil t))
(defun mir/webkit-isearch-next ()
(interactive)
(xwidget-webkit-search isearch-string
(car xwidget-list) 'insensitive nil t))
(defun mir/webkit-isearch-prev ()
(interactive)
(xwidget-webkit-search isearch-string
(car xwidget-list) 'insensitive t t))
;; (posframe-show ) ;; need posframe package
:bind (
("/" . 'mir/webkit-isearch)
("n" . 'mir/webkit-isearch-next)
("N" . 'mir/webkit-isearch-prev)
))
;; built in spell checker, for losers
(use-package flyspell
:diminish
:custom
(flyspell-auto-correct-word t)
:hook
(org-mode . flyspell-mode))
;; unique buffer names
(use-package uniquify
:custom (uniquify-buffer-name-style 'forward))
;; cache file cleanup
(use-package kkc
:custom (kkc-init-file-name (expand-file-name "kkcrc" backup-directory)))
;; https://laurencewarne.github.io/emacs/programming/2022/12/26/exploring-proced.html
(use-package proced
:commands proced
:custom
(proced-auto-update-flag t)
(proced-goal-attribute nil)
(proced-show-remote-processes t)
(proced-enable-color-flag t)
(proced-format 'custom)
:config
(add-to-list
'proced-format-alist
'(custom user pid ppid sess tree pcpu pmem rss start time state
(args comm))))
(use-package gnus
:hook
(gnus-summary-mode . hl-line-mode)
(gnus-summary-prepare . gnus-summary-sort-by-most-recent-date)
)
(use-package tramp
:defer 2
:custom (tramp-persistency-file-name
(expand-file-name "tramp-history" backup-directory))
:config
(defun find-current-file-sudo (&rest throwaway)
;; (interactive)
(if buffer-file-name
(unless (or (file-writable-p buffer-file-name)
(file-directory-p buffer-file-name))
(find-alternate-file (format "/sudo::%s" buffer-file-name)))))
(advice-add #'find-file :after #'find-current-file-sudo))
;; eshell. Pretty good actually.
(use-package eshell
:after tramp
;; :commands (eshell/emacs eshell/man)
;; :init
;; (defun eshell-banner-initialize ()
;; "Run Neofetch in eshell."
;; (eshell/ls nil))
:custom
(eshell-scroll-to-bottom-on-input t)
(eshell-hist-ignoredups t)
(eshell-history-file-name (expand-file-name "zsh/histfile" "~/.local/share/"))
(eshell-history-size nil)
(eshell-banner-message "")
(eshell-expand-input-functions '(eshell-expand-history-references))
:config
(add-to-list 'tramp-remote-path "/bedrock/bin" 'append)
(add-to-list 'eshell-modules-list 'eshell-rebind)
(add-to-list 'eshell-modules-list 'eshell-hist)
(add-to-list 'eshell-modules-list 'eshell-tramp)
(add-hook 'kill-emacs-hook (lambda ()
(if (fboundp #'eshell-save-some-history)
(eshell-save-some-history))))
(defun eshell-evil-insert-line (count &optional vcount)
(interactive "p")
(eshell-bol)
(evil-insert count vcount))
(defun mir/edit-file-or-lib (name)
"Edit library called NAME if it exists, otherwise edit FILE.
If the current window occupies the whole frame, split it."
(let* ((old-buffer (current-buffer))
(old-default-dir default-directory) ; needed to preserve environment
find-fun lib-fun ; scope these so we can bind them later
(openfun (lambda (arg)
"Implicit function for opening a file or library."
(let ((arg-file-name (expand-file-name arg))
(arg-lib-name (locate-library arg)))
(if (file-exists-p arg-file-name)
(funcall find-fun arg-file-name)
(if arg-lib-name
(funcall lib-fun arg)
(funcall find-fun arg-file-name)))))))
(if (one-window-p)
(setq find-fun #'find-file-other-window
lib-fun #'find-library-other-window)
(setq find-fun #'find-file
lib-fun #'find-library))
(let ((result (funcall openfun name)))
(with-current-buffer old-buffer
(setq default-directory old-default-dir))
result)))
(defun eshell/emacs (&rest args)
"run external Emacs."
(eshell-eval-using-options ; this is somewhat broken but works okay
"emacs" args
'(
(nil "batch" nil batch "Non-interactive")
(nil "chdir" t change-dir "change to directory DIR")
("nw" nil nil no-window "open in terminal mode, no window")
("fs" "fullscreen" nil full-screen "Open in full screen")
:external "emacs"
:usage "[FILE] etc placeholder text...")
(mapcar #'mir/edit-file-or-lib
(eshell-stringify-list (flatten-tree (reverse args))))))
(defun mir/eshell-setup-keys ()
(evil-collection-define-key
'normal
'eshell-mode-map
(kbd "I") 'eshell-evil-insert-line
(kbd "RET") 'hkey-either))
(advice-add 'evil-collection-eshell-setup-keys
:after 'mir/eshell-setup-keys))
;; straight.el: the better package manager? ;; straight.el: the better package manager?
;; minified bootstrap (split lines if you want) (or not) ;; minified bootstrap (split lines if you want) (or not)
;; (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (straight-use-package 'use-package) (setq straight-use-package-by-default t) ;; (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (straight-use-package 'use-package) (setq straight-use-package-by-default t)

View File

@ -6,95 +6,11 @@
;; ----------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------
;;; Code: ;;; Code:
(use-package emacs
:elpaca nil
:custom
;; (scroll-margin 2)
(scroll-conservatively 100)
;; (scroll-up-aggressively 0.01)
;; (scroll-down-aggressively 0.01)
(auto-window-vscroll nil)
:init
(global-visual-line-mode t)
(set-language-environment "UTF-8")
(global-prettify-symbols-mode 1)
(auto-insert-mode))
;; seq version workaround, see https://www.reddit.com/r/emacs/comments/1937vaz/emacs_291_on_windows_install_magit_requires_seq/?rdt=48529
(defun +elpaca-unload-seq (e)
(and (featurep 'seq) (unload-feature 'seq t))
(elpaca--continue-build e))
(defun +elpaca-seq-build-steps ()
(append (butlast (if (file-exists-p (expand-file-name "seq" elpaca-builds-directory))
elpaca--pre-built-steps elpaca-build-steps))
(list '+elpaca-unload-seq 'elpaca--activate-package)))
(use-package seq :elpaca `(seq :build ,(+elpaca-seq-build-steps)))
;; eldoc version workarounds...
(defun global-eldoc-mode (&rest args)
"Placeholder function. Do nothing and return nil."
nil)
(defun +elpaca-unload-eldoc (e)
(and (featurep 'eldoc) (unload-feature 'eldoc t))
(elpaca--continue-build e))
(defun +elpaca-eldoc-build-steps ()
(append (butlast (if (file-exists-p (expand-file-name "eldoc" elpaca-builds-directory))
elpaca--pre-built-steps elpaca-build-steps))
(list '+elpaca-unload-eldoc 'elpaca--activate-package)))
(use-package eldoc
:elpaca `(eldoc :build ,(+elpaca-eldoc-build-steps))
:init
)
(elpaca-wait) (elpaca-wait)
;; (use-package no-littering) ;a bad start, and we need more ;; (use-package no-littering) ;a bad start, and we need more
(use-package epg
:elpaca nil
:after tramp
:custom ;; these are ripped from `custom-file' which was auto-generated
(auth-sources '("~/.authinfo.gpg"))
(epg-pinentry-mode 'loopback))
(use-package compat) (use-package compat)
;; save minibuffer history, see Vertico below
(use-package savehist
:elpaca nil
:init (savehist-mode)
;; :custom (savehist-file ; taken care of by `no-littering'
;; (expand-file-name "minibuffer-history" backup-directory))
)
;; save place in all files
(use-package saveplace
:elpaca nil
:init (save-place-mode t)
:custom
(save-place-file
(expand-file-name "file-position-save" backup-directory)))
(use-package tramp
:elpaca nil
;; :after eshell
:custom (tramp-persistency-file-name
(expand-file-name "tramp-history" backup-directory))
:config
(defun find-current-file-sudo (&rest throwaway)
;; (interactive)
(if buffer-file-name
(unless (or (file-writable-p buffer-file-name)
(file-directory-p buffer-file-name))
(find-alternate-file (format "/sudo::%s" buffer-file-name)))))
(advice-add #'find-file :after #'find-current-file-sudo))
;; Visualize whitespace. In a very chill and invisible way.
(use-package image-mode
:elpaca nil
:config
(turn-off-line-numbers)
(blink-cursor-mode -1))
;; diminish ;; diminish
(use-package diminish (use-package diminish
:config (diminish 'visual-line-mode)) :config (diminish 'visual-line-mode))
@ -116,25 +32,6 @@
:diminish (eldoc-mode eldoc-box-hover-at-point-mode) :diminish (eldoc-mode eldoc-box-hover-at-point-mode)
:hook (prog-mode . eldoc-box-hover-at-point-mode)) :hook (prog-mode . eldoc-box-hover-at-point-mode))
(use-package whitespace
:elpaca nil
:diminish (whitespace-mode ;; org-indent-mode
;; org-vw-mode
auto-fill-mode)
:custom
(whitespace-style '(face lines-tail))
(whitespace-line-column 80)
(fill-column 80)
:hook
(prog-mode . whitespace-mode)
;; (org-mode . auto-fill-mode)
)
;; ...and finally, sync files with disk changes
(use-package autorevert
:elpaca nil
:diminish auto-revert-mode
:config (global-auto-revert-mode))
;; (use-package use-package-ensure-system-package) ;; (use-package use-package-ensure-system-package)
;; load evil or meow ;; load evil or meow
@ -202,79 +99,6 @@
[remap evil-window-decrease-height] 'edwina-dec-mfact [remap evil-window-decrease-height] 'edwina-dec-mfact
[remap balance-windows] 'edwina-arrange)) [remap balance-windows] 'edwina-arrange))
;; eshell. Pretty good actually.
(use-package eshell
:elpaca nil
;; :commands (eshell/emacs eshell/man)
;; :init
;; (defun eshell-banner-initialize ()
;; "Run Neofetch in eshell."
;; (eshell/ls nil))
:custom
(eshell-scroll-to-bottom-on-input t)
(eshell-hist-ignoredups t)
(eshell-history-file-name (expand-file-name "zsh/histfile" "~/.local/share/"))
(eshell-history-size nil)
(eshell-banner-message "")
(eshell-expand-input-functions '(eshell-expand-history-references))
:config
(add-to-list 'tramp-remote-path "/bedrock/bin" 'append)
(add-to-list 'eshell-modules-list 'eshell-rebind)
(add-to-list 'eshell-modules-list 'eshell-hist)
(add-to-list 'eshell-modules-list 'eshell-tramp)
(add-hook 'kill-emacs-hook (lambda ()
(if (fboundp #'eshell-save-some-history)
(eshell-save-some-history))))
(defun eshell-evil-insert-line (count &optional vcount)
(interactive "p")
(eshell-bol)
(evil-insert count vcount))
(defun mir/edit-file-or-lib (name)
"Edit library called NAME if it exists, otherwise edit FILE.
If the current window occupies the whole frame, split it."
(let* ((old-buffer (current-buffer))
(old-default-dir default-directory) ; needed to preserve environment
find-fun lib-fun ; scope these so we can bind them later
(openfun (lambda (arg)
"Implicit function for opening a file or library."
(let ((arg-file-name (expand-file-name arg))
(arg-lib-name (locate-library arg)))
(if (file-exists-p arg-file-name)
(funcall find-fun arg-file-name)
(if arg-lib-name
(funcall lib-fun arg)
(funcall find-fun arg-file-name)))))))
(if (one-window-p)
(setq find-fun #'find-file-other-window
lib-fun #'find-library-other-window)
(setq find-fun #'find-file
lib-fun #'find-library))
(let ((result (funcall openfun name)))
(with-current-buffer old-buffer
(setq default-directory old-default-dir))
result)))
(defun eshell/emacs (&rest args)
"run external Emacs."
(eshell-eval-using-options ; this is somewhat broken but works okay
"emacs" args
'(
(nil "batch" nil batch "Non-interactive")
(nil "chdir" t change-dir "change to directory DIR")
("nw" nil nil no-window "open in terminal mode, no window")
("fs" "fullscreen" nil full-screen "Open in full screen")
:external "emacs"
:usage "[FILE] etc placeholder text...")
(mapcar #'mir/edit-file-or-lib
(eshell-stringify-list (flatten-tree (reverse args))))))
(defun mir/eshell-setup-keys ()
(evil-collection-define-key
'normal
'eshell-mode-map
(kbd "I") 'eshell-evil-insert-line
(kbd "RET") 'hkey-either))
(advice-add 'evil-collection-eshell-setup-keys
:after 'mir/eshell-setup-keys))
;; show command that caused last scrollback in eshell etc ;; show command that caused last scrollback in eshell etc
(use-package sticky-shell (use-package sticky-shell
:elpaca (sticky-shell :elpaca (sticky-shell
@ -981,35 +805,6 @@ Return nil if DIR is not in a hugo project at all."
;; (require 'exwm-config) ;; (require 'exwm-config)
;; (exwm-config-example))) ;; (exwm-config-example)))
(elpaca nil
(use-package xwidget
:elpaca nil
:if (featurep 'xwidget)
:commands xwidget-webkit-browse-url
:config
(defun mir/webkit-isearch ()
(interactive)
(xwidget-webkit-search
(setq isearch-string
(read-from-minibuffer "Find in page: "))
(car xwidget-list)
'insensitive nil t))
(defun mir/webkit-isearch-next ()
(interactive)
(xwidget-webkit-search isearch-string
(car xwidget-list) 'insensitive nil t))
(defun mir/webkit-isearch-prev ()
(interactive)
(xwidget-webkit-search isearch-string
(car xwidget-list) 'insensitive t t))
;; (posframe-show ) ;; need posframe package
:general (general-define-key
:states 'normal
:keymaps 'xwidget-webkit-mode-map
"/" 'mir/webkit-isearch
"n" 'mir/webkit-isearch-next
"N" 'mir/webkit-isearch-prev)))
;; (use-package ani-el ;; (use-package ani-el
;; :elpaca (ani-el ;; :elpaca (ani-el
;; :repo "https://git.mirmarq42.xyz/mir/ani-el" ;; :repo "https://git.mirmarq42.xyz/mir/ani-el"
@ -1021,15 +816,6 @@ Return nil if DIR is not in a hugo project at all."
:custom (inferior-lisp-program "sbcl") :custom (inferior-lisp-program "sbcl")
:config (load (expand-file-name "~/quicklisp/slime-helper.el"))) :config (load (expand-file-name "~/quicklisp/slime-helper.el")))
;; built in spell checker, for losers
(use-package flyspell
:elpaca nil
:diminish
:custom
(flyspell-auto-correct-word t)
:hook
(org-mode . flyspell-mode))
;; Java never looked so useful... ;; Java never looked so useful...
(use-package clojure-mode (use-package clojure-mode
:mode "\\.cljs\\'") :mode "\\.cljs\\'")
@ -1039,39 +825,12 @@ Return nil if DIR is not in a hugo project at all."
(use-package cider (use-package cider
:after clojure-mode) :after clojure-mode)
;; unique buffer names
(use-package uniquify
:elpaca nil
:custom (uniquify-buffer-name-style 'forward))
;; cache file cleanup
(use-package kkc
:elpaca nil
:custom (kkc-init-file-name (expand-file-name "kkcrc" backup-directory)))
(use-package dwim-shell-command (use-package dwim-shell-command
:elpaca (dwim-shell-command :elpaca (dwim-shell-command
:files (:defaults "dwim-shell-commands.el")) :files (:defaults "dwim-shell-commands.el"))
:config (require 'dwim-shell-commands) :config (require 'dwim-shell-commands)
:commands dwim-shell-commands-kill-process) :commands dwim-shell-commands-kill-process)
;; https://laurencewarne.github.io/emacs/programming/2022/12/26/exploring-proced.html
(elpaca nil
(use-package proced
:elpaca nil
:commands proced
:custom
(proced-auto-update-flag t)
(proced-goal-attribute nil)
(proced-show-remote-processes t)
(proced-enable-color-flag t)
(proced-format 'custom)
:config
(add-to-list
'proced-format-alist
'(custom user pid ppid sess tree pcpu pmem rss start time state
(args comm)))))
(use-package youtube-sub-extractor (use-package youtube-sub-extractor
:elpaca (youtube-sub-extractor :elpaca (youtube-sub-extractor
:host github :host github
@ -1150,13 +909,6 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html"
:custom (notibox-corner 'topright) :custom (notibox-corner 'topright)
:config (notibox/setup-timer)) :config (notibox/setup-timer))
(use-package gnus
:elpaca nil
:hook
(gnus-summary-mode . hl-line-mode)
(gnus-summary-prepare . gnus-summary-sort-by-most-recent-date)
)
;; (use-package hl-column ; disabled because visual yuck ;; (use-package hl-column ; disabled because visual yuck
;; :if (display-graphic-p) ;; :if (display-graphic-p)
;; :config ;; :config