From d535478afe2d959e950cf50ecad5c060e7ed49b4 Mon Sep 17 00:00:00 2001 From: Taryel Hlontsi Date: Sun, 12 Jan 2025 16:16:47 +0100 Subject: [PATCH] Improve loading time --- init.el | 58 +++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/init.el b/init.el index 5bd71f4..693e454 100644 --- a/init.el +++ b/init.el @@ -1,4 +1,7 @@ (setq gc-cons-threshold (* 100 1000 1000)) +(add-hook 'after-init-hook #'(lambda () + ;; restore after startup + (setq gc-cons-threshold 800000))) (defun my/dired-open-current-file-directory () "Open the current file's directory in Dired, if possible." @@ -46,10 +49,6 @@ (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (package-initialize) -(unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package)) - (use-package which-key :ensure t :config (which-key-mode)) @@ -77,7 +76,9 @@ :commands dockerfile-mode) (use-package flycheck - :ensure t) + :ensure t + :defer t + :hook (prog-mode . flycheck-mode)) (use-package dired :config @@ -99,7 +100,11 @@ ;;"M+1Code Nerd Font" ;;"Lekton Nerd Font" -(set-face-attribute 'default nil :font "Lekton" :height 120) +;; Agave Nerd Font +;; EnvyCodeR Nerd Font +;; Binchotan_Sharp +;; Ubuntu Mono +(set-face-attribute 'default nil :font "Binchotan_Sharp" :height 130) ;;(set-fontset-font t nil (font-spec :size 20 :name "VictorMono Nerd Font Mono")) ;;(set-face-attribute 'default nil :font "VictorMono Nerd Font Mono" :height 110) @@ -128,8 +133,6 @@ (add-hook 'before-save-hook 'whitespace-cleanup) -(add-hook 'prog-mode-hook 'flycheck-mode) - (setq-default frame-title-format '(:eval (format "%s" @@ -142,8 +145,7 @@ :ensure t :defer t :commands (elpy-enable) - :init - (add-hook 'python-mode-hook 'elpy-enable) + :hook (python-mode . elpy-enable) :config (setq elpy-modules (delq 'elpy-module-flymake elpy-modules))) @@ -164,11 +166,24 @@ (lambda () (setq gud-pdb-command-name "python3 -m pdb"))) (use-package yasnippet + :hook (prog-mode . yas-minor-mode) :config (setq yas-snippet-dirs '("~/.emacs.d/snippets")) - (yas-reload-all) - (add-hook 'prog-mode-hook 'yas-minor-mode)) + (yas-reload-all)) +(use-package org-superstar + :ensure t + :defer t + :hook (org-mode . org-superstar-mode)) + +(defface my-org-face + '((t :family "Liberation Sans" :height 120)) + "Face for Org mode.") + +(defun my-org-font-setup () + (face-remap-add-relative 'default 'my-org-face)) + +(add-hook 'org-mode-hook 'my-org-font-setup) ;; my keybindings @@ -280,10 +295,13 @@ Exempt major modes are defined in `display-line-numbers-exempt-modes'." ;; :config ;; (load-theme 'doom-monokai-pro)) +(use-package gruber-darker-theme + :ensure t) + (use-package modus-themes :ensure t) -(modus-themes-select 'modus-operandi-tinted) +;; (modus-themes-select 'modus-operandi-tinted) (setq modus-themes-to-toggle '(modus-operandi-tinted modus-vivendi-tinted)) (use-package ef-themes @@ -305,9 +323,17 @@ Exempt major modes are defined in `display-line-numbers-exempt-modes'." (setq ef-themes-mixed-fonts t ef-themes-variable-pitch-ui t) -;; (mapc #'disable-theme custom-enabled-themes) +(defun my-setup-display-based-on-type () + "Load different themes and disable menu bar for console mode." + (if (display-graphic-p) + (progn + (ef-themes-select 'ef-elea-light) + (menu-bar-mode 1)) + (progn + (load-theme 'gruber-darker t) + (menu-bar-mode -1)))) -;; (ef-themes-select 'ef-maris-light) +(add-hook 'after-init-hook 'my-setup-display-based-on-type) ;; theming stops here @@ -316,7 +342,7 @@ ef-themes-variable-pitch-ui t) :defer t :bind (("C-x g" . magit-status)) :commands (magit-status magit-dispatch magit-file-dispatch) - :init + :config (setq magit-auto-revert-mode nil)) (use-package doom-modeline