home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

early-init.el (3329B)


      1 ;;; early-init.el --- Early init configuration file -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (c) 2020-2023  Vincent Demeester <vincent@sbr.pm>
      4 
      5 ;; Author: Vincent Demeester <vincent@sbr.pm>
      6 ;; URL: https://git.sr.ht/~vdemeester/home
      7 ;; Version: 0.1.0
      8 ;; Package-Requires: ((emacs "29.1"))
      9 
     10 ;; This file is NOT part of GNU Emacs.
     11 
     12 ;; This file is free software: you can redistribute it and/or modify it
     13 ;; under the terms of the GNU General Public License as published by the
     14 ;; Free Software Foundation, either version 3 of the License, or (at
     15 ;; your option) any later version.
     16 ;;
     17 ;; This file is distributed in the hope that it will be useful, but
     18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
     19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     20 ;; General Public License for more details.
     21 ;;
     22 ;; You should have received a copy of the GNU General Public License
     23 ;; along with this file.  If not, see <http://www.gnu.org/licenses/>.
     24 
     25 ;;; Commentary:
     26 
     27 ;; Prior to Emacs 27, the `init.el' was supposed to handle the
     28 ;; initialisation of the package manager, by means of calling
     29 ;; `package-initialize'.  Starting with Emacs 27, the default
     30 ;; behaviour is to start the package manager before loading the init
     31 ;; file.
     32 ;;
     33 
     34 ;; See my dotfiles: https://git.sr.ht/~vdemeester/home
     35 
     36 ;;; Code:
     37 
     38 ;; Do not initialize installed packages
     39 (setopt package-enable-at-startup nil
     40 	package-archives nil
     41 	package-quickstart nil)
     42 (setopt use-package-ensure-function 'ignore)
     43 
     44 ;; Do not resize the frame at this early stage
     45 (setopt frame-inhibit-implied-resize t
     46 	frame-resize-pixelwise t
     47 	frame-title-format '("%b")) ;; do not add "GNU Emacs at …"
     48 
     49 ;; Disable GUI elements
     50 (push '(menu-bar-lines . 0) default-frame-alist)
     51 (push '(tool-bar-lines . 0) default-frame-alist)
     52 (push '(vertical-scroll-bars) default-frame-alist)
     53 (menu-bar-mode -1)
     54 (tool-bar-mode -1)
     55 (scroll-bar-mode -1)
     56 (horizontal-scroll-bar-mode -1)
     57 
     58 (setopt use-dialog-box nil   ;; never use dialog-box (no mouse)
     59 	use-file-dialog nil  ;; never use file dialog (gtk)
     60 	use-short-answers t  ;; replace defalias yes-or-no-p
     61 	read-answer-short t) ;; accepts single-character answer, similar to above
     62 
     63 (setopt inhibit-startup-message t
     64 	inhibit-startup-screen t
     65 	inhibit-startup-echo-area-message user-login-name ; read the docstring
     66 	inhibit-startup-buffer-menu t)
     67 
     68 (setq gc-cons-threshold most-positive-fixnum
     69       gc-cons-percentage 0.5)
     70 
     71 (defvar vde--file-name-handler-alist file-name-handler-alist)
     72 (defvar vde--vc-handled-backends vc-handled-backends)
     73 (setq file-name-handler-alist nil
     74       vc-handled-backends nil)
     75 
     76 
     77 ;; Ignore X resources; its settings would be redundant with the other settings
     78 ;; in this file and can conflict with later config (particularly where the
     79 ;; cursor color is concerned).
     80 (advice-add #'x-apply-session-resources :override #'ignore)
     81 (setopt inhibit-x-resources t)
     82 
     83 ;;
     84 (when (getenv-internal "DEBUG")
     85   (setq init-file-debug t
     86 	debug-on-error t))
     87 
     88 ;; - Resetting garbage collection and file-name-handler values.
     89 (add-hook 'after-init-hook
     90           `(lambda ()
     91              (setq gc-cons-threshold 67108864 ; 64mb
     92                    gc-cons-percentage 0.1
     93                    file-name-handler-alist vde--file-name-handler-alist
     94 		   vc-handled-backends vde--vc-handled-backends)
     95              (garbage-collect)) t)