You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

61 lines
2.5 KiB

;;; early-init.el --- Early startup code -*- lexical-binding: t -*-
;; Copyright (C) 2021 Ryan C. Thompson
;; Filename: early-init.el
;; Author: Ryan C. Thompson
;; Created: Sat Nov 27 13:40:59 2021 (-0500)
;; This file is NOT part of GNU Emacs.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;; This file contains code that must be executed early during Emacs'
;; startup for proper initialization, as described here:
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Early-Init-File.html
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; Disable GC during init
(put 'gc-cons-percentage 'original-value-before-init gc-cons-percentage)
(put 'gc-cons-percentage 'value-during-init 0.6)
(defun restore-gc-cons-percentage-after-init ()
"Restaura el garbaje collection luego de iniciar."
(let ((expected-value (get 'gc-cons-percentage 'value-during-init))
(value-to-restore (get 'gc-cons-percentage 'original-value-before-init)))
(when (and value-to-restore (equal gc-cons-percentage expected-value))
(message "Setting `gc-cons-percentage' back to starting value %s" value-to-restore)
(setq gc-cons-percentage value-to-restore))))
(add-hook 'after-init-hook #'restore-gc-cons-percentage-after-init)
(setq gc-cons-percentage (get 'gc-cons-percentage 'value-during-init))
;; Color de fondo similar al theme para evitar que se vea blanco al iniciar
;; (add-to-list 'default-frame-alist '(background-color . "#282a36"))
;; Permitir solo la búsqueda de archivos a cargar en la config en case sensitive.
(setq auto-mode-case-fold nil)
;; Personalizaciones (Tedrían que ir en init-base, pero por optimización, las pongo acá)
(push '(menu-bar-lines . 0) default-frame-alist) ; Quitar menús.
(push '(tool-bar-lines . 0) default-frame-alist) ; Quitar toolbar.
;; Iniciar emacs maximizado
;; (add-hook 'window-setup-hook 'toggle-frame-maximized t) ; Hacerlo mediante window-setup-hook (se maximiza al terminar de cargar la ventana)
;; (push '(ns-transparent-titlebar . t) default-frame-alist)
;; Resizing the Emacs frame can be a terribly expensive part of changing the
;; font. By inhibiting this, we easily halve startup times with fonts that are
;; larger than the system default.
(setq frame-inhibit-implied-resize t
frame-resize-pixelwise t)
;; Recommended by
;; https://github.com/raxod502/straight.el#getting-started to prevent
;; pacakge.el stepping on elpaca toes.
(setq package-enable-at-startup nil)
;;; early-init.el ends here