- Delete deprecated system/ configuration files - Update projects/dotemacs/modules/ with reorganized config - Add .opencode/ directory for agent state - Clean up attachments and unused documentation files
5.3 KiB
5.3 KiB
Core Emacs Configuration
- Initialization Bootstrap
- Front matter
- Garbage collector
- Straight.el and use-package
- UI and Themes
- Custom file
- System information
- Persistent history
- Disable Syntax Checkers (Diagnostic)
- Backup and versioning
- Personal information
- Saving Emacs Sessions
- Security
- End matter
Initialization Bootstrap
This section tangles directly to ~/.emacs to bootstrap the entire system.
;;; .emacs --- Global settings -*- lexical-binding: t; -*-
(setq gc-cons-threshold (* 500 1024 1024))
(add-hook 'after-init-hook (lambda () (setq gc-cons-threshold (* 5 1024 1024))))
(setq straight-repository-branch "develop")
(eval-and-compile
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el"
(or (bound-and-true-p straight-base-dir)
user-emacs-directory)))
(bootstrap-version 7))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" 'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(straight-use-package 'org))
(setq straight-use-package-by-default t)
(require 'ob-tangle)
;; Load the modular configuration starting from dotemacs.org
(org-babel-load-file (expand-file-name "~/memex/projects/dotemacs/dotemacs.org"))
(provide '.emacs)
Front matter
;;; emacs-core.el --- Summary
;;; Commentary:
;;; Code:
;; -*- lexical-binding: t; -*-
Garbage collector
Increase threshold to 500 MB to ease startup
(setq gc-cons-threshold (* 500 1024 1024))
Decrease threshold to 5 MB after init
(add-hook 'after-init-hook (lambda () (setq gc-cons-threshold (* 5 1024 1024))))
Straight.el and use-package
Integrate use-package and straight
(setq straight-use-package-by-default t)
(require 'use-package)
(straight-use-package 'diminish)
(require 'diminish)
Make sure Org is installed (straight.el)
(unless (file-directory-p (expand-file-name "~/.emacs.d/straight/versions")) (make-directory (expand-file-name "~/.emacs.d/straight/versions") t))
(use-package org)
UI and Themes
(use-package ef-themes
:config
;; If you like two specific themes and want to switch between them, you
;; can specify them in `ef-themes-to-toggle' and then invoke the command
;; `ef-themes-toggle'. All the themes are included in the variable
;; `ef-themes-collection'.
(setq ef-themes-to-toggle '(ef-summer ef-winter))
(setq ef-themes-headings ; read the manual's entry or the doc string
'((0 variable-pitch light 1.9)
(1 variable-pitch light 1.8)
(2 variable-pitch regular 1.7)
(3 variable-pitch regular 1.6)
(4 variable-pitch regular 1.5)
(5 variable-pitch 1.4) ; absence of weight means `bold'
(6 variable-pitch 1.3)
(7 variable-pitch 1.2)
(t variable-pitch 1.1)))
;; They are nil by default...
(setq ef-themes-mixed-fonts t)
(setq ef-themes-variable-pitch-ui t)
;; Disable all other themes to avoid awkward blending:
(mapc #'disable-theme custom-enabled-themes)
;; Load the theme of choice:
(load-theme 'ef-winter :no-confirm)
)
Custom file
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file) (load custom-file))
System information
(defvar my-laptop-p (equal (system-name) "lilitop"))
(defvar my-server-p (and (equal (system-name) "localhost") (equal user-login-name "root")))
(defvar my-phone-p (not (null (getenv "ANDROID_ROOT")))
"If non-nil, GNU Emacs is running on Termux.")
(when my-phone-p (defvar gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))
(global-auto-revert-mode) ; simplifies syncing
Persistent history
(savehist-mode)
Disable Syntax Checkers (Diagnostic)
(when (fboundp 'flycheck-mode)
(setq flycheck-global-modes nil)
(global-flycheck-mode -1))
(when (fboundp 'flymake-mode)
(setq help-at-pt-display-when-idle t)
;; Disable flymake in all buffers
(add-hook 'find-file-hook (lambda () (flymake-mode -1))))
Backup and versioning
(use-package magit)
Personal information
(setq user-full-name "Amr Gharbeia")
(defvar email-address "amr@gharbeia.net")
(defvar calendar-latitude 39.0)
(defvar calendar-longitude -77.1)
(defvar calendar-location-name "Washington, DC")
(defvar calendar-time-zone -300)
(defvar calendar-standard-time-zone-name "EST")
(defvar calendar-daylight-time-zone-name "EDT")
Saving Emacs Sessions
Close frame when done
(add-hook 'server-done-hook (lambda () (delete-frame)))
Save desktop session
;; (desktop-save-mode t)
Security
(use-package password-store)
(use-package auth-source
:config (auth-source-pass-enable)
)
End matter
(provide 'emacs-core)
;;; emacs-core.el ends here