From 315694498a6400a3bee71d660d65f62e27e65dcf Mon Sep 17 00:00:00 2001 From: mir Date: Sun, 25 Feb 2024 11:23:23 -0900 Subject: [PATCH] Speed up init by not loading things. Still a bit slow... --- early-init.el | 5 +++-- init.el | 41 +++++++++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/early-init.el b/early-init.el index 481c3b5..5125f29 100644 --- a/early-init.el +++ b/early-init.el @@ -8,13 +8,14 @@ ;; blame @chke@emacs.ch if this no worky (defvar mir/default-gc-thresh gc-cons-threshold) (defun max-gc-thresh () - (setq gc-cons-threshold most-positive-fixnum)) -;; (max-gc-thresh) + (setq gc-cons-threshold (/ most-positive-fixnum 1000000))) +(max-gc-thresh) (defun restore-gc-thresh () (setq gc-cons-threshold mir/default-gc-thresh)) ;(add-hook 'minibuffer-setup-hook #'max-gc-thresh) ;(add-hook 'minibuffer-exit-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) ;; (run-with-idle-timer 5 t #'garbage-collect) ;(setq garbage-collection-messages t) diff --git a/init.el b/init.el index 1f5e87d..63ceceb 100644 --- a/init.el +++ b/init.el @@ -28,7 +28,9 @@ ;; do the things (add-hook 'server-after-make-frame-hook #'mir/graphical-setup) (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 (defvar backup-directory @@ -361,11 +363,9 @@ If the current window occupies the whole frame, split it." :init (add-hook 'emacs-lisp-mode-hook #'page-break-lines-mode)) (use-package rainbow-mode - :init - (add-hook 'prog-mode-hook #'rainbow-mode)) + :hook (prog-mode . rainbow-mode)) (use-package powershell - :init - (add-to-list 'auto-mode-alist '("\\.ps1\\'" . powershell-mode))) + :mode ("\\.ps1\\'" . powershell-mode)) ;; (message "%s" elpaca--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 :git (app-launcher :host github :repo "SebastienWae/app-launcher") - :after vertico + :commands (app-launcher-run-app emacs-run-launcher) :config ;; modified from https://www.reddit.com/r/unixporn/comments/s7p7pr/so_which_run_launcher_do_you_use_rofi_or_dmenu/ (defun emacs-run-launcher () @@ -661,7 +661,8 @@ targets." :around #'embark-hide-which-key-indicator) :custom (enable-recursive-minibuffers t)) ;; 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 (use-package el-patch) @@ -932,7 +933,8 @@ Return nil if DIR is not in a hugo project at all." ;; Better lisp highlighting? (use-package highlight-defined :hook (emacs-lisp-mode . highlight-defined-mode)) -(use-package relint) +(use-package relint + :commands relint-file) (use-package elisp-autofmt :git (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))) (uuid (seq (= 8 hex) "-" (= 3 (seq (= 4 hex) "-")) (= 12 hex))) (guid (seq uuid))) - (rxt-elisp-to-pcre (rx ,@expressions))))) + (rxt-elisp-to-pcre (rx ,@expressions)))) + :commands prx) -(use-package haskell-mode) -(use-package yuck-mode) +(use-package haskell-mode + :mode "\\.hs") +(use-package yuck-mode + :mode "\\.yuck") (use-package fretboard :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 ;kitty/sixel/catimg shit :git (:host github :repo "MitchMarq42/vidframe.el") - ) + :defer t) ;; Kitty Keyboard Protocol (use-package kkp @@ -1225,7 +1230,8 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html" (use-package eagle :git (:repo "https://codeberg.org/akib/emacs-eagle")) (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 (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)) -(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) ;; (setq esup-depth 0)