From 2ef0a538812d50e48cf1935f40a5c001c24cfc0c Mon Sep 17 00:00:00 2001 From: ashincoder Date: Mon, 7 Jun 2021 00:07:50 +0000 Subject: [PATCH 1/3] Added configs to make emacs more faster --- .emacs.d.gnu/config.org | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/.emacs.d.gnu/config.org b/.emacs.d.gnu/config.org index c7c0e42..60f28c8 100644 --- a/.emacs.d.gnu/config.org +++ b/.emacs.d.gnu/config.org @@ -102,6 +102,42 @@ Install use-package and enable ':ensure t' globally. The ':ensure' keyword caus (setq use-package-always-ensure t) #+end_src +* STARTUP PERFORMANCE + This section is where it make emacs faster to load. +** Garbage collection +Makes startup faster by reducing the frequency of garbage collection +#+begin_src emacs-lisp +;; Using garbage magic hack. + (use-package gcmh + :config + (gcmh-mode 1)) +;; Setting garbage collection threshold +(setq gc-cons-threshold 402653184 + gc-cons-percentage 0.6) + +;; Profile emacs startup +(add-hook 'emacs-startup-hook + (lambda () + (message "*** Emacs loaded in %s with %d garbage collections." + (format "%.2f seconds" + (float-time + (time-subtract after-init-time before-init-time))) + gcs-done))) + +;; Silence compiler warnings as they can be pretty disruptive (setq comp-async-report-warnings-errors nil) +#+end_src +** Native Compil +#+begin_src emacs-lisp +;; Silence compiler warnings as they can be pretty disruptive +(if (boundp 'comp-deferred-compilation) + (setq comp-deferred-compilation nil) + (setq native-comp-deferred-compilation nil)) +;; In noninteractive sessions, prioritize non-byte-compiled source files to +;; prevent the use of stale byte-code. Otherwise, it saves us a little IO time +;; to skip the mtime checks on every *.elc file. +(setq load-prefer-newer noninteractive) +#+end_src + ** Evil Mode Evil is an extensible 'vi' layer for Emacs. It emulates the main features of Vim, and provides facilities for writing custom extensions. Evil Collection is also installed since it adds 'evil' bindings to parts of Emacs that the standard Evil package does not cover, such as: calenda, help-mode adn ibuffer. @@ -886,6 +922,13 @@ Which-key is a minor mode for Emacs that displays the key bindings following you which-key-allow-imprecise-window-fit t which-key-separator " → " )) (which-key-mode) +#+e + +* RUNTIME PERFORMANCE +Dial the GC threshold back down so that garbage collection happens more frequently but in less time. +#+begin_src emacs-lisp +;; Make gc pauses faster by decreasing the threshold. +(setq gc-cons-threshold (* 2 1000 1000)) #+end_src * WRITEROOM MODE From f08b049e20625894b3a8b749ee2d9be70cfddcbe Mon Sep 17 00:00:00 2001 From: ashincoder Date: Mon, 7 Jun 2021 00:10:22 +0000 Subject: [PATCH 2/3] Changed table of contents --- .emacs.d.gnu/config.org | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.emacs.d.gnu/config.org b/.emacs.d.gnu/config.org index 60f28c8..e7e00ed 100644 --- a/.emacs.d.gnu/config.org +++ b/.emacs.d.gnu/config.org @@ -14,6 +14,9 @@ - [[#use-package][Use-Package]] - [[#evil-mode][Evil Mode]] - [[#general-keybindings][General Keybindings]] +- [[#startup-performance][STARTUP PERFORMANCE]] + - [[#garbage-collection][Garbage collection]] + - [[#native-compil][Native Compil]] - [[#all-the-icons][ALL THE ICONS]] - [[#buffers-and-bookmarks][BUFFERS AND BOOKMARKS]] - [[#dashboard][DASHBOARD]] @@ -66,6 +69,7 @@ - [[#splits-and-window-controls][SPLITS AND WINDOW CONTROLS]] - [[#theme][THEME]] - [[#which-key][WHICH KEY]] +- [[#runtime-performance][RUNTIME PERFORMANCE]] - [[#writeroom-mode][WRITEROOM MODE]] * IMPORTANT! PUT THIS IN YOUR INIT.EL From 5d63fe1a4550fa335aeb33f92494b0492281b667 Mon Sep 17 00:00:00 2001 From: ashincoder Date: Mon, 7 Jun 2021 00:23:47 +0000 Subject: [PATCH 3/3] Changed the error in arrangement --- .emacs.d.gnu/config.org | 56 ++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.emacs.d.gnu/config.org b/.emacs.d.gnu/config.org index e7e00ed..f0e5a05 100644 --- a/.emacs.d.gnu/config.org +++ b/.emacs.d.gnu/config.org @@ -106,6 +106,34 @@ Install use-package and enable ':ensure t' globally. The ':ensure' keyword caus (setq use-package-always-ensure t) #+end_src +** Evil Mode +Evil is an extensible 'vi' layer for Emacs. It emulates the main features of Vim, and provides facilities for writing custom extensions. Evil Collection is also installed since it adds 'evil' bindings to parts of Emacs that the standard Evil package does not cover, such as: calenda, help-mode adn ibuffer. + +#+begin_src emacs-lisp +(use-package evil + :init ;; tweak evil's configuration before loading it + (setq evil-want-integration t) ;; This is optional since it's already set to t by default. + (setq evil-want-keybinding nil) + (setq evil-vsplit-window-right t) + (setq evil-split-window-below t) + (evil-mode)) +(use-package evil-collection + :after evil + :config + (setq evil-collection-mode-list '(dashboard dired ibuffer)) + (evil-collection-init)) +(use-package evil-tutor) +#+end_src + +** General Keybindings +General.el allows us to set keybindings. As a longtime Doom Emacs user, I have grown accustomed to using SPC as the prefix key. General makes setting keybindings (especially with SPC) much easier. All of the keybindings we set later in the config depend on general being loaded. + +#+begin_src emacs-lisp +(use-package general + :config + (general-evil-setup t)) +#+end_src + * STARTUP PERFORMANCE This section is where it make emacs faster to load. ** Garbage collection @@ -142,34 +170,6 @@ Makes startup faster by reducing the frequency of garbage collection (setq load-prefer-newer noninteractive) #+end_src -** Evil Mode -Evil is an extensible 'vi' layer for Emacs. It emulates the main features of Vim, and provides facilities for writing custom extensions. Evil Collection is also installed since it adds 'evil' bindings to parts of Emacs that the standard Evil package does not cover, such as: calenda, help-mode adn ibuffer. - -#+begin_src emacs-lisp -(use-package evil - :init ;; tweak evil's configuration before loading it - (setq evil-want-integration t) ;; This is optional since it's already set to t by default. - (setq evil-want-keybinding nil) - (setq evil-vsplit-window-right t) - (setq evil-split-window-below t) - (evil-mode)) -(use-package evil-collection - :after evil - :config - (setq evil-collection-mode-list '(dashboard dired ibuffer)) - (evil-collection-init)) -(use-package evil-tutor) -#+end_src - -** General Keybindings -General.el allows us to set keybindings. As a longtime Doom Emacs user, I have grown accustomed to using SPC as the prefix key. General makes setting keybindings (especially with SPC) much easier. All of the keybindings we set later in the config depend on general being loaded. - -#+begin_src emacs-lisp -(use-package general - :config - (general-evil-setup t)) -#+end_src - * ALL THE ICONS This is an icon set that can be used with dashboard, dired, ibuffer and other Emacs programs.