refactor: Move Emacs config from system/ to projects/dotemacs/

- 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
This commit is contained in:
2026-04-25 18:41:20 -04:00
parent 43c225a4b5
commit cc6c552d5a
75 changed files with 3263 additions and 5545 deletions

View File

@@ -1,55 +1,199 @@
#+TITLE: Emacs Core Configuration
#+property: header-args :tangle ~/.emacs.d/modules/core.el
#+TITLE: Core Emacs Configuration
#+PROPERTY: header-args :tangle yes
* early-init.el
For straight.el to pick up before package.el
* Initialization Bootstrap
#+begin_src elisp :tangle ~/.emacs.d/early-init.el
(setq package-enable-at-startup nil)
#+end_src
This section tangles directly to ~/.emacs to bootstrap the entire system.
* Straight.el Bootstrap
#+begin_src elisp :tangle ~/.emacs
;;; .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)
)
(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)
#+end_src
* Server and Performance
#+begin_src elisp :tangle ~/.emacs.d/early-init.el
(require 'server)
(unless (server-running-p) (server-start))
(defvar server-max-buffers 100)
#+end_src
* Front matter
#+begin_src elisp
;;; emacs-core.el --- Summary
;;; Commentary:
;;; Code:
;; -*- lexical-binding: t; -*-
#+end_src
* Garbage collector
Increase threshold to 500 MB to ease startup
#+begin_src elisp
(setq gc-cons-threshold (* 500 1024 1024))
#+end_src
Decrease threshold to 5 MB after init
#+begin_src elisp
(add-hook 'after-init-hook (lambda () (setq gc-cons-threshold (* 5 1024 1024))))
#+end_src
* System Information
#+begin_src elisp :tangle ~/.emacs.d/custom.el
* Straight.el and use-package
Integrate use-package and straight
#+begin_src elisp
(setq straight-use-package-by-default t)
(require 'use-package)
(straight-use-package 'diminish)
(require 'diminish)
#+end_src
Make sure Org is installed (straight.el)
#+begin_src elisp
(unless (file-directory-p (expand-file-name "~/.emacs.d/straight/versions")) (make-directory (expand-file-name "~/.emacs.d/straight/versions") t))
(use-package org)
#+end_src
* UI and Themes
#+begin_src elisp
(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)
)
#+end_src
* Custom file
#+begin_src elisp
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file) (load custom-file))
#+end_src
* System information
#+begin_src elisp
(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)
(savehist-mode)
(desktop-save-mode t)
(global-auto-revert-mode) ; simplifies syncing
#+end_src
* Persistent history
#+begin_src elisp
(savehist-mode)
#+end_src
* Disable Syntax Checkers (Diagnostic)
#+begin_src elisp
(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))))
#+end_src
* Backup and versioning
#+begin_src emacs-lisp
(use-package magit)
#+end_src
* Personal information
#+begin_src elisp
(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")
#+end_src
* Saving Emacs Sessions
Close frame when done
#+begin_src elisp
(add-hook 'server-done-hook (lambda () (delete-frame)))
#+end_src
Save desktop session
#+begin_src elisp
;; (desktop-save-mode t)
#+end_src
* Security
#+begin_src elisp
(use-package password-store)
#+end_src
#+begin_src elisp
(use-package auth-source
:config (auth-source-pass-enable)
)
#+end_src
* End matter
#+begin_src elisp
(provide 'emacs-core)
;;; emacs-core.el ends here
#+end_src