Speed up init by not loading things. Still a bit slow...

This commit is contained in:
mir 2024-02-25 11:23:23 -09:00
parent d22a2ae642
commit 315694498a
2 changed files with 28 additions and 18 deletions

View File

@ -8,13 +8,14 @@
;; blame @chke@emacs.ch if this no worky ;; blame @chke@emacs.ch if this no worky
(defvar mir/default-gc-thresh gc-cons-threshold) (defvar mir/default-gc-thresh gc-cons-threshold)
(defun max-gc-thresh () (defun max-gc-thresh ()
(setq gc-cons-threshold most-positive-fixnum)) (setq gc-cons-threshold (/ most-positive-fixnum 1000000)))
;; (max-gc-thresh) (max-gc-thresh)
(defun restore-gc-thresh () (defun restore-gc-thresh ()
(setq gc-cons-threshold mir/default-gc-thresh)) (setq gc-cons-threshold mir/default-gc-thresh))
;(add-hook 'minibuffer-setup-hook #'max-gc-thresh) ;(add-hook 'minibuffer-setup-hook #'max-gc-thresh)
;(add-hook 'minibuffer-exit-hook #'restore-gc-thresh) ;(add-hook 'minibuffer-exit-hook #'restore-gc-thresh)
;(add-hook 'elpaca-after-init-hook #'restore-gc-thresh) ;(add-hook 'elpaca-after-init-hook #'restore-gc-thresh)
(add-hook 'after-init-hook #'restore-gc-thresh)
;;; (setq gc-cons-percentage 0.5) ;;; (setq gc-cons-percentage 0.5)
;; (run-with-idle-timer 5 t #'garbage-collect) ;; (run-with-idle-timer 5 t #'garbage-collect)
;(setq garbage-collection-messages t) ;(setq garbage-collection-messages t)

41
init.el
View File

@ -28,7 +28,9 @@
;; do the things ;; do the things
(add-hook 'server-after-make-frame-hook #'mir/graphical-setup) (add-hook 'server-after-make-frame-hook #'mir/graphical-setup)
(if (display-graphic-p) (if (display-graphic-p)
(add-hook 'elpaca-after-init-hook #'mir/graphical-setup)) ;; (add-hook 'elpaca-after-init-hook #'mir/graphical-setup)
(add-hook 'after-init-hook #'mir/graphical-setup)
)
;; Control backups/swapfiles ;; Control backups/swapfiles
(defvar backup-directory (defvar backup-directory
@ -361,11 +363,9 @@ If the current window occupies the whole frame, split it."
:init :init
(add-hook 'emacs-lisp-mode-hook #'page-break-lines-mode)) (add-hook 'emacs-lisp-mode-hook #'page-break-lines-mode))
(use-package rainbow-mode (use-package rainbow-mode
:init :hook (prog-mode . rainbow-mode))
(add-hook 'prog-mode-hook #'rainbow-mode))
(use-package powershell (use-package powershell
:init :mode ("\\.ps1\\'" . powershell-mode))
(add-to-list 'auto-mode-alist '("\\.ps1\\'" . powershell-mode)))
;; (message "%s" elpaca--queues) ;; (message "%s" elpaca--queues)
(if (fboundp #'elpaca) (elpaca-process-queues)) (if (fboundp #'elpaca) (elpaca-process-queues))
@ -587,7 +587,7 @@ see https://www.reddit.com/r/emacs/comments/xq6rpa/comment/iqynyu9/?utm_source=
(use-package app-launcher (use-package app-launcher
:git (app-launcher :git (app-launcher
:host github :repo "SebastienWae/app-launcher") :host github :repo "SebastienWae/app-launcher")
:after vertico :commands (app-launcher-run-app emacs-run-launcher)
:config :config
;; modified from https://www.reddit.com/r/unixporn/comments/s7p7pr/so_which_run_launcher_do_you_use_rofi_or_dmenu/ ;; modified from https://www.reddit.com/r/unixporn/comments/s7p7pr/so_which_run_launcher_do_you_use_rofi_or_dmenu/
(defun emacs-run-launcher () (defun emacs-run-launcher ()
@ -661,7 +661,8 @@ targets."
:around #'embark-hide-which-key-indicator) :around #'embark-hide-which-key-indicator)
:custom (enable-recursive-minibuffers t)) :custom (enable-recursive-minibuffers t))
;; Consult users will also want the embark-consult package. ;; Consult users will also want the embark-consult package.
(use-package embark-consult) (use-package embark-consult
:after (embark consult))
;; el-patch, TODO remove linum requirement ;; el-patch, TODO remove linum requirement
(use-package el-patch) (use-package el-patch)
@ -932,7 +933,8 @@ Return nil if DIR is not in a hugo project at all."
;; Better lisp highlighting? ;; Better lisp highlighting?
(use-package highlight-defined (use-package highlight-defined
:hook (emacs-lisp-mode . highlight-defined-mode)) :hook (emacs-lisp-mode . highlight-defined-mode))
(use-package relint) (use-package relint
:commands relint-file)
(use-package elisp-autofmt (use-package elisp-autofmt
:git (elisp-autofmt :git (elisp-autofmt
:url "https://codeberg.org/ideasman42/emacs-elisp-autofmt" :url "https://codeberg.org/ideasman42/emacs-elisp-autofmt"
@ -1188,10 +1190,13 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html"
(= 2 digit) (or "/" "-") (= 2 digit))) (= 2 digit) (or "/" "-") (= 2 digit)))
(uuid (seq (= 8 hex) "-" (= 3 (seq (= 4 hex) "-")) (= 12 hex))) (uuid (seq (= 8 hex) "-" (= 3 (seq (= 4 hex) "-")) (= 12 hex)))
(guid (seq uuid))) (guid (seq uuid)))
(rxt-elisp-to-pcre (rx ,@expressions))))) (rxt-elisp-to-pcre (rx ,@expressions))))
:commands prx)
(use-package haskell-mode) (use-package haskell-mode
(use-package yuck-mode) :mode "\\.hs")
(use-package yuck-mode
:mode "\\.yuck")
(use-package fretboard (use-package fretboard
:git (:host github :repo "vifon/fretboard.el") :git (:host github :repo "vifon/fretboard.el")
@ -1213,7 +1218,7 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html"
:if (display-graphic-p) ;we won't yet bother with :if (display-graphic-p) ;we won't yet bother with
;kitty/sixel/catimg shit ;kitty/sixel/catimg shit
:git (:host github :repo "MitchMarq42/vidframe.el") :git (:host github :repo "MitchMarq42/vidframe.el")
) :defer t)
;; Kitty Keyboard Protocol ;; Kitty Keyboard Protocol
(use-package kkp (use-package kkp
@ -1225,7 +1230,8 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html"
(use-package eagle (use-package eagle
:git (:repo "https://codeberg.org/akib/emacs-eagle")) :git (:repo "https://codeberg.org/akib/emacs-eagle"))
(use-package cube (use-package cube
:git (:repo "https://codeberg.org/akib/emacs-cube")) :git (:repo "https://codeberg.org/akib/emacs-cube")
:commands 'cube)
;; Emacs App Framework. Definitely pretty broken but it worked once ;; Emacs App Framework. Definitely pretty broken but it worked once
(unless (eq system-type 'windows-nt) (unless (eq system-type 'windows-nt)
@ -1293,11 +1299,14 @@ This is redefined for use with `hypop' library because multiple Emacs frames may
:hook (python-mode . indent-bars-mode)) :hook (python-mode . indent-bars-mode))
(use-package lua-mode) (use-package lua-mode
:mode "\\.lua")
(use-package nix-mode) (use-package nix-mode
:mode "\\.nix")
(use-package yeetube) (use-package yeetube
:commands 'yeetube-search)
;(require 'mir-packages) ;(require 'mir-packages)
;; (setq esup-depth 0) ;; (setq esup-depth 0)