Fixed issue where emacs was crashing

This commit is contained in:
Joseph Ferano 2022-08-20 17:38:20 +07:00
parent 73679a610d
commit 3a15c740fd
2 changed files with 56 additions and 32 deletions

View File

@ -5,14 +5,14 @@
#+TOC: true
** Early Init
*** Garbage Collection
The default Garbage Collector is triggered at 800 KB, way too conservative, let's bump to 512 MB.
Garbage collection is a big contributor to startup times. This fends it off, then is reset later by
enabling `gcmh-mode'. Not resetting it will cause stuttering/freezes.
Garbage collection is a big contributor to startup times. This fends it off, then is reset later by enabling `gcmh-mode'. Not resetting it will cause stuttering/freezes.
#+begin_src emacs-lisp :tangle ./early-init.el
;; -*- lexical-binding: t; -*-
;; -*- lexical-binding: t -*-
(defvar default-file-name-handler-alist file-name-handler-alist)
(setq file-name-handler-alist nil)
(setq gc-cons-threshold (expt 2 32))
@ -28,22 +28,24 @@ enabling `gcmh-mode'. Not resetting it will cause stuttering/freezes.
(garbage-collect))))
(add-hook 'focus-out-hook 'garbage-collect))))
(setq native-comp-deferred-compilation nil)
(setq native-comp-async-report-warnings-errors nil)
(setq native-comp-deferred-compilation t)
#+end_src
Disabling these classic visual options during early-init seems to net a 0.04 ms boost in init time
#+begin_src emacs-lisp :tangle ./early-init.el
(setq max-specpdl-size 1200)
(setq max-lisp-eval-depth 800)
(add-hook 'window-setup-hook
(lambda ()
(setq-default inhibit-redisplay nil
inhibit-message nil)
(redisplay)))
(scroll-bar-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1)
(tooltip-mode -1)
#+end_src
*** Setup
*** Straight.el Prep
Disable package.el, since we will be using straight.el. According to the straight.el
documentation;
@ -64,11 +66,10 @@ Prioritize old byte-compiled source files over newer sources. It saves us a litt
#+begin_src emacs-lisp :tangle ./early-init.el
(setq load-prefer-newer nil)
#+end_src
*** UTF-8 Support
#+begin_src emacs-lisp :tangle ./early-init.el
(set-language-environment "UTF-8")
(setq default-input-method nil)
;;; early-init.el ends here
#+end_src
@ -94,17 +95,23 @@ Then bootstrap
(load bootstrap-file nil 'nomessage))
#+END_SRC
** Misc Stuff
#+begin_SRC emacs-lisp
** Benchmarking
This is commented out since it adds ever so slightly to init time, but keep it around in case we
need to benchmark slow init times later.
#+begin_src emacs-lisp
;; (straight-use-package 'benchmark-init)
;; (require 'benchmark-init)
;; (add-hook 'after-init-hook 'benchmark-init/deactivate)
#+end_src
** Misc Stuff
#+begin_SRC emacs-lisp
(setq vc-follow-symlinks t) ; Visit real file when editing a symlink without prompting.
(global-auto-revert-mode t) ; Revert buffer's file when the file changes on disk
(setq confirm-kill-emacs 'y-or-n-p)
;; (setq confirm-kill-emacs 'y-or-n-p)
(setq use-dialog-box nil)
(fset 'yes-or-no-p 'y-or-n-p)
@ -153,10 +160,10 @@ Setup other stuff
(global-hl-line-mode +1)
(column-number-mode +1)
(scroll-bar-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1)
(tooltip-mode -1)
;; (scroll-bar-mode -1)
;; (tool-bar-mode -1)
;; (menu-bar-mode -1)
;; (tooltip-mode -1)
(modify-all-frames-parameters
'((right-divider-width . 5)
@ -197,15 +204,17 @@ Setup other stuff
** Org Mode
#+begin_src emacs-lisp
(require 'org)
(setq org-todo-keywords '((sequence "TODO" "IN-PROGRESS" "|" "DONE" "BACKLOG")))
(setq org-agenda-files '("~/todo.org"))
(straight-use-package 'org-bullets)
(defun joe/org-hook () (org-bullets-mode) (org-indent-mode))
(add-hook 'org-mode-hook 'joe/org-hook)
(require 'org-tempo)
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(setq org-edit-src-content-indentation 0)
(eval-after-load 'org (lambda ()
(setq org-todo-keywords '((sequence "TODO" "IN-PROGRESS" "|" "DONE" "BACKLOG")))
(setq org-agenda-files '("~/todo.org"))
(straight-use-package 'org-bullets)
(org-bullets-mode)
(org-indent-mode)
(require 'org-tempo)
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(setq org-edit-src-content-indentation 0)))
#+end_src
** VEMCO (Vertico Embark Marginalia Consult Orderless)
@ -272,7 +281,12 @@ Setup other stuff
(setq undo-tree-history-directory-alist `(("." . ,(expand-file-name "undo" user-emacs-directory))))
#+end_src
** Text Editor
#+begin_src emacs-lisp
Emacs is an amazing operating system, if only it had a good text editor...
Meow
#+begin_src emacs-lisp :tangle no
(straight-use-package 'meow)
(require 'meow)
(defun meow-setup ()
@ -361,12 +375,22 @@ Setup other stuff
'("'" . repeat)
'("<escape>" . ignore)))
(meow-setup)
;; (meow-global-mode t)
(meow-global-mode t)
#+end_src
Boon
#+begin_src emacs-lisp
(straight-use-package boon)
#+end_src
** Magit
#+begin_src emacs-lisp
(straight-use-package 'magit)
#+end_src
** Finish up
#+begin_src emacs-lisp
#+end_src
* COMMENT Local variables
;; Local Variables:
;; eval: (add-hook 'after-save-hook '(lambda () (org-babel-tangle)) nil t)

View File

@ -132,7 +132,7 @@ all of the evil keybindings in buffers like magit, without compromises."
nil t)))
'(org-agenda-files '("~/todo.org"))
'(package-selected-packages
'(org-kanban embark-consult embark olivetti vertico-posframe orderless vertico eglot-fsharp consult-eglot eglot nano-modeline mini-modeline pdf-tools consult all-the-icons-completion kind-icon mini-modeline shelldon pcomplete-extension corfu-doc esh-autosuggest fish-completion cape corfu highlight-quoted dirvish ranger magit multi-vterm evil-collection smartparens vterm all-the-icons org-bullets fsharp-mode fish-mode find-file-in-project helpful ahk-mode rainbow-delimiters doom-themes marginalia avy evil-commentary evil-surround undo-tree which-key dashboard))
'(macrostep org-kanban embark-consult embark olivetti vertico-posframe orderless vertico eglot-fsharp consult-eglot eglot nano-modeline mini-modeline pdf-tools consult all-the-icons-completion kind-icon mini-modeline shelldon pcomplete-extension corfu-doc esh-autosuggest fish-completion cape corfu highlight-quoted dirvish ranger magit multi-vterm evil-collection smartparens vterm all-the-icons org-bullets fsharp-mode fish-mode find-file-in-project helpful ahk-mode rainbow-delimiters doom-themes marginalia avy evil-commentary evil-surround undo-tree which-key dashboard))
'(safe-local-variable-values
'((eval add-hook 'after-save-hook
'(lambda nil