emacs optimizations

This commit is contained in:
Sakooooo 2024-07-28 00:22:13 +04:00
parent 648072338a
commit f598509830
Signed by: sako
GPG key ID: 3FD715D87D7725E0

View file

@ -44,6 +44,51 @@
(load bootstrap-file nil 'nomessage))
(setq straight-use-package-by-default t))
#+end_src
* Make Emacs faster
#+begin_src emacs-lisp
(message "Speeding up")
#+end_src
** Avoid garbage collection at startup
#+begin_src emacs-lisp
(use-package gcmh
:init
(setq gcmh-idle-delay 5)
(setq gcmh-high-cons-threshold (* 16 1024 1024))
:config
(gcmh-mode))
#+end_src
** Set garbage collection to be further back
#+begin_src emacs-lisp
(setq gc-cons-threshold most-positive-fixnum)
#+end_src
** Unset file-name-handler-alist
#+begin_src emacs-lisp
(defvar sakomacs--file-name-handler-alist file-name-handler-alist)
(setq file-name-handler-alist nil)
;; Alternatively, restore it even later:
(add-hook 'emacs-startup-hook
(lambda ()
(setq file-name-handler-alist sakomacs--file-name-handler-alist)))
#+end_src
** Reset gc once init has finished
#+begin_src emacs-lisp
(defun doom-defer-garbage-collection-h ()
"Disable garbage collection."
(setq gc-cons-threshold most-positive-fixnum))
(defun doom-restore-garbage-collection-h ()
"Restore garbage collection."
(run-at-time
1 nil (lambda () (setq gc-cons-threshold 16777216))))
(add-hook 'minibuffer-setup-hook #'doom-defer-garbage-collection-h)
(add-hook 'minibuffer-exit-hook #'doom-restore-garbage-collection-h)
#+end_src
** Read more
#+begin_src emacs-lisp
(setq read-process-output-max (* 1024 1024)) ;; 1mb
#+end_src
* Keybinds
Ill use this later eventually
#+begin_src emacs-lisp