confi-emacs-actual/early-init.el
2023-04-18 01:21:36 -04:00

56 lines
2.3 KiB
EmacsLisp

;;; 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 ()
(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 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-to-list 'initial-frame-alist '(fullscreen . maximized)) ; frame inicial
;; (add-to-list 'default-frame-alist '(fullscreen . maximized)) ; Cada frame
;; (add-hook 'window-setup-hook 'toggle-frame-maximized t) ; Hacerlo mediante window-setup-hook (se maximiza al terminar de cargar la ventana)
;; Recommended by
;; https://github.com/raxod502/straight.el#getting-started to prevent
;; pacakge.el stepping on straight's toes.
(setq package-enable-at-startup nil)
;;; early-init.el ends here