diff options
author | Amin Bandali <bandali@kelar.org> | 2025-02-07 21:04:21 -0500 |
---|---|---|
committer | Amin Bandali <bandali@kelar.org> | 2025-02-07 21:09:36 -0500 |
commit | f0ad1b1cbe334c004012205fdb9af81bb7c3a538 (patch) | |
tree | 71b7266490fd11427c7e8efec82fd4e032401ce9 | |
parent | c7b47e03e0ac16d6db84d59d8cff58291b22fbaa (diff) | |
download | configs-f0ad1b1cbe334c004012205fdb9af81bb7c3a538.tar.gz configs-f0ad1b1cbe334c004012205fdb9af81bb7c3a538.tar.xz configs-f0ad1b1cbe334c004012205fdb9af81bb7c3a538.zip |
A few small Emacs-related updates
-rw-r--r-- | .Xresources.d/emacs | 9 | ||||
-rw-r--r-- | .emacs.d/early-init.el | 38 | ||||
-rw-r--r-- | .emacs.d/init.el | 39 |
3 files changed, 53 insertions, 33 deletions
diff --git a/.Xresources.d/emacs b/.Xresources.d/emacs index 424e048..3573b45 100644 --- a/.Xresources.d/emacs +++ b/.Xresources.d/emacs @@ -1,7 +1,8 @@ -!Emacs.menuBar: off -!Emacs.toolBar: off -!Emacs.verticalScrollBars: off -!Emacs.cursorBlink: off +Emacs.menuBar: off +Emacs.toolBar: off +Emacs.verticalScrollBars: off +Emacs.cursorBlink: off + Emacs.FontBackend: ftcrhb,x Emacs.font: Source Code Pro Medium-10.5 !Emacs.font: Inconsolata Medium-12:hinting=true:autohint=true diff --git a/.emacs.d/early-init.el b/.emacs.d/early-init.el index 962c724..0060280 100644 --- a/.emacs.d/early-init.el +++ b/.emacs.d/early-init.el @@ -1,8 +1,40 @@ -;; No package.el (for emacs 27 and later). See -;; https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=24acb31c04b4048b85311d794e600ecd7ce60d3b -(setq package-enable-at-startup nil) +;;; early-init.el --- bandali's early init -*- lexical-binding: t -*- + +;; Copyright (c) 2019-2025 Amin Bandali <bandali@gnu.org> + +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <https://www.gnu.org/licenses/>. + (setq load-prefer-newer t) + (menu-bar-mode -1) (tool-bar-mode -1) (scroll-bar-mode -1) (blink-cursor-mode -1) + +(defconst b/gc-cons-threshold gc-cons-threshold) +(defconst b/gc-cons-percentage gc-cons-percentage) +(defvar b/file-name-handler-alist file-name-handler-alist) +(setq + gc-cons-threshold (* 30 1024 1024) ; 30 MiB + gc-cons-percentage 0.6 + file-name-handler-alist nil) + +;; Set them back to their defaults once we're done initializing. +(defun b/post-init () + "My post-initialization function." + (setq + gc-cons-threshold b/gc-cons-threshold + gc-cons-percentage b/gc-cons-percentage + file-name-handler-alist b/file-name-handler-alist)) +(add-hook 'after-init-hook #'b/post-init) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index e79be6a..f9518c2 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -24,31 +24,19 @@ ;;; Code: -;;; Emacs initialization - -;; Temporarily increase `gc-cons-threshhold' and `gc-cons-percentage' -;; during startup to reduce garbage collection frequency. Clearing -;; `file-name-handler-alist' seems to help reduce startup time too. -(defconst b/gc-cons-threshold gc-cons-threshold) -(defconst b/gc-cons-percentage gc-cons-percentage) -(defvar b/file-name-handler-alist file-name-handler-alist) (setq - gc-cons-threshold (* 30 1024 1024) ; 30 MiB - gc-cons-percentage 0.6 - file-name-handler-alist nil) - -;; Set them back to their defaults once we're done initializing. -(defun b/post-init () - "My post-initialize function, run after loading `user-init-file'." - (setq - b/emacs-initialized t - gc-cons-threshold b/gc-cons-threshold - gc-cons-percentage b/gc-cons-percentage - file-name-handler-alist b/file-name-handler-alist) - - (require 'package) - (package-initialize)) -(add-hook 'after-init-hook #'b/post-init) + use-package-verbose init-file-debug + use-package-expand-minimally (not init-file-debug) + use-package-compute-statistics init-file-debug + debug-on-error init-file-debug + debug-on-quit init-file-debug) + +(require 'package) +(when (< emacs-major-version 29) + (unless (package-installed-p 'use-package) + (unless package-archive-contents + (package-refresh-contents)) + (package-install 'use-package))) ;; whoami (setq @@ -122,8 +110,7 @@ plain variables. This means that `setopt' will execute any ;; Separate custom file (don't want it mixing with init.el). (setopt custom-file (b/emacs.d "custom.el")) (with-eval-after-load 'custom - (when (file-exists-p custom-file) - (load custom-file))) + (load custom-file 'noerror)) ;; Start Emacs server ;; (https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html) |