mirror of
https://codeberg.org/andyscott/dotfiles.git
synced 2024-11-09 14:00:47 -05:00
122 lines
4.1 KiB
Cheetah
122 lines
4.1 KiB
Cheetah
;;; early-init.el --- GNU Emacs Early Initialization File -*- lexical-binding: t; -*-
|
|
|
|
;; Copyright (c) 2023 Andrew Scott
|
|
|
|
;; Author: Andrew Scott <andy at andyscott dot me>
|
|
;; Keywords: convenience, tools
|
|
;; URL: https://codeberg.org/andyscott/dotfiles
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;; Commentary:
|
|
|
|
;; My customizations for early Emacs initialization
|
|
|
|
;;; License:
|
|
|
|
;; MIT No Attribution
|
|
|
|
;; Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
|
;; software and associated documentation files (the "Software"), to deal in the Software
|
|
;; without restriction, including without limitation the rights to use, copy, modify,
|
|
;; merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
|
;; permit persons to whom the Software is furnished to do so.
|
|
|
|
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
;; INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
;; PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
;; OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
;;; Code:
|
|
|
|
;; Disable `package.el'
|
|
(setq package-enable-at-startup nil)
|
|
|
|
;; Ensure other defaults are loaded
|
|
(setq inhibit-default-init nil)
|
|
|
|
;; Avoid `garbage-collect' during init
|
|
(setq gc-cons-percentage 1
|
|
gc-cons-threshold most-positive-fixnum)
|
|
|
|
;; Skip regexp checking by `find-file-name-handler' during init
|
|
(defvar default-file-name-handler-alist file-name-handler-alist)
|
|
(setq file-name-handler-alist nil)
|
|
|
|
;; Restore `garbage-collect' and `file-name-handler-alist' settings
|
|
(add-hook 'emacs-startup-hook
|
|
(lambda ()
|
|
(setq file-name-handler-alist default-file-name-handler-alist
|
|
gc-cons-percentage 0.1
|
|
gc-cons-threshold (* 1024 1024 8))))
|
|
|
|
;; Relocate `emacs-user-directory' to XDG_DATA_HOME
|
|
(setq user-emacs-directory
|
|
(expand-file-name "emacs/" (or (getenv "XDG_DATA_HOME") "~/.local/share/")))
|
|
|
|
;; Set cache directory
|
|
(setq xdg_cache_home
|
|
(expand-file-name "emacs/" (or (getenv "XDG_CACHE_HOME") "~/.cache/")))
|
|
(unless (file-directory-p xdg_cache_home)
|
|
(make-directory xdg_cache_home))
|
|
|
|
;; Move `eln-cache' to XDG_CACHE_HOME
|
|
(when (fboundp 'startup-redirect-eln-cache)
|
|
(if (< emacs-major-version 29)
|
|
(push (expand-file-name "eln-cache/" xdg_cache_home) native-comp-eln-load-path)
|
|
(startup-redirect-eln-cache (expand-file-name "eln-cache/" xdg_cache_home))))
|
|
|
|
;; Load newest byte code
|
|
(setq load-prefer-newer t)
|
|
|
|
;; Enable async native compilation and suppress warnings
|
|
(when (featurep 'native-compile)
|
|
(setq native-comp-deferred-compilation t
|
|
native-comp-async-report-warnings-errors nil))
|
|
|
|
;; Don't advertise instructions for frame exit
|
|
(setq server-client-instructions nil)
|
|
|
|
;; Don't implicitly resize the frame
|
|
(setq frame-inhibit-implied-resize t)
|
|
|
|
;; Allow frames to increase/decrease by one pixel
|
|
(setq frame-resize-pixelwise t)
|
|
|
|
;; Disable startup screen
|
|
(setq inhibit-startup-screen t)
|
|
|
|
;; Start in `fundamental-mode' instead of `lisp-interaction-mode' to avoid
|
|
;; loading unnecessary packages via hooks
|
|
(setq initial-major-mode 'fundamental-mode)
|
|
|
|
;; Visible bell only
|
|
(setq visible-bell t)
|
|
|
|
;; Fonts
|
|
{{- if eq .chezmoi.hostname "helix" }}
|
|
(push '(font . "Hack-24") default-frame-alist)
|
|
(set-face-font 'default "Hack-24")
|
|
(set-face-font 'fixed-pitch "Hack-24")
|
|
(set-face-font 'variable-pitch "DejaVu Sans-24")
|
|
{{- else }}
|
|
(push '(font . "Hack-12") default-frame-alist)
|
|
(set-face-font 'default "Hack-12")
|
|
(set-face-font 'fixed-pitch "Hack-12")
|
|
(set-face-font 'variable-pitch "DejaVu Sans-12")
|
|
{{- end }}
|
|
|
|
;; Some GUI options
|
|
(push '(menu-bar-lines . 0) default-frame-alist)
|
|
(push '(tool-bar-lines . 0) default-frame-alist)
|
|
(push '(vertical-scroll-bars) default-frame-alist)
|
|
(push '(background-color . "#282828") default-frame-alist)
|
|
(push '(foreground-color . "#C6C6C6") default-frame-alist)
|
|
|
|
;; Make lsp-mode use plists
|
|
(setenv "LSP_USE_PLISTS" "true")
|
|
|
|
(provide 'early-init)
|
|
;;; early-init.el ends here
|