confi-emacs-actual/early-init.el

64 lines
2.6 KiB
EmacsLisp
Raw Normal View History

;;; 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 blanco al iniciar
;; (add-to-list 'default-frame-alist '(background-color . "#282a36"))
2023-04-18 07:21:36 +02:00
2023-04-13 21:53:15 +02:00
;; 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.
2023-04-18 07:21:36 +02:00
2023-04-13 21:53:15 +02:00
;; Iniciar emacs maximizado
2023-04-30 18:45:46 +02:00
;; (add-to-list 'initial-frame-alist '(fullscreen . maximized)) ; frame inicial
2023-04-13 21:53:15 +02:00
;; (add-to-list 'default-frame-alist '(fullscreen . maximized)) ; Cada frame
2023-04-30 18:45:46 +02:00
(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)
2023-04-13 21:53:15 +02:00
;; 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