aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README45
-rw-r--r--early-init.el20
-rw-r--r--init.el73
-rw-r--r--lisp/core/init-defaults.el56
-rw-r--r--lisp/core/init-packages.el52
5 files changed, 246 insertions, 0 deletions
diff --git a/README b/README
index e69de29..ba3ce9c 100644
--- a/README
+++ b/README
@@ -0,0 +1,45 @@
+GNU Emacs Configuration
+=======================
+
+Personal GNU Emacs configuration.
+
+Requirements
+------------
+
+GNU Emacs 29 or later
+Git
+
+Package Management
+------------------
+
+package.el
+use-package
+
+Package Archives
+----------------
+
+GNU ELPA
+NonGNU ELPA
+MELPA
+
+Directory Structure
+-------------------
+
+early-init.el Early initialization
+init.el Main configuration entry point
+lisp/ Configuration modules
+site-lisp/ Custom Emacs Lisp extensions
+snippets/ Code snippets
+templates/ File templates
+tests/ Configuration tests
+var/ Runtime data
+
+License
+-------
+
+Copyright (C) 2026 Richard Qin
+
+This configuration is distributed under the terms of the
+GNU General Public License, version 3 or later.
+
+See the COPYING file for details.
diff --git a/early-init.el b/early-init.el
index e69de29..c5d4d1c 100644
--- a/early-init.el
+++ b/early-init.el
@@ -0,0 +1,20 @@
+;;; early-init.el --- Early initialization -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Richard Qin
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;; Author: Richard Qin
+;; This file is not part of GNU Emacs.
+
+;;; Commentary:
+
+;; Early initialization of Emacs.
+;; Configure startup behavior before loading init.el.
+
+;;; Code:
+
+;; Disable automatic package initialization.
+;; Package initialization is handled by init-packages.el.
+(setq package-enable-at-startup nil)
+
+;;; early-init.el ends here
diff --git a/init.el b/init.el
index e69de29..77f06a0 100644
--- a/init.el
+++ b/init.el
@@ -0,0 +1,73 @@
+;;; init.el --- Main Emacs configuration -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Richard Qin
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;; Author: Richard Qin
+;; This file is not part of GNU Emacs.
+
+;;; Commentary:
+
+;; Main entry point for the Emacs configuration.
+;; Configure load paths and initialize configuration modules.
+
+;;; Code:
+
+;; ------------------------------------------------------------
+;; Load paths
+;; ------------------------------------------------------------
+
+(defvar my/config-directories
+ '("core"
+ "ui"
+ "completion"
+ "editing"
+ "development"
+ "languages"
+ "writing"
+ "tools")
+ "Directories containing Emacs configuration modules.")
+
+(dolist (dir my/config-directories)
+ (add-to-list
+ 'load-path
+ (expand-file-name
+ (concat "lisp/" dir)
+ user-emacs-directory)))
+
+;; Custom Emacs Lisp extensions.
+(add-to-list
+ 'load-path
+ (expand-file-name "site-lisp" user-emacs-directory))
+
+
+;; ------------------------------------------------------------
+;; Customize
+;; ------------------------------------------------------------
+
+(setq custom-file
+ (expand-file-name
+ "var/custom.el"
+ user-emacs-directory))
+
+(make-directory
+ (file-name-directory custom-file)
+ t)
+
+
+;; ------------------------------------------------------------
+;; Core modules
+;; ------------------------------------------------------------
+
+(require 'init-packages)
+(require 'init-defaults)
+
+
+;; ------------------------------------------------------------
+;; Custom settings
+;; ------------------------------------------------------------
+
+(when (file-exists-p custom-file)
+ (load custom-file nil 'nomessage))
+
+;;; init.el ends here
diff --git a/lisp/core/init-defaults.el b/lisp/core/init-defaults.el
new file mode 100644
index 0000000..259a9c6
--- /dev/null
+++ b/lisp/core/init-defaults.el
@@ -0,0 +1,56 @@
+;;; init-defaults.el --- Basic Emacs settings -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Richard Qin
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;; Author: Richard Qin
+;; This file is not part of GNU Emacs.
+
+;;; Commentary:
+
+;; Configure basic Emacs behavior and built-in features.
+;; Settings in this module are shared across the environment.
+
+;;; Code:
+
+;; ------------------------------------------------------------
+;; Startup
+;; ------------------------------------------------------------
+
+;; (setq inhibit-startup-screen t)
+
+
+;; ------------------------------------------------------------
+;; User interaction
+;; ------------------------------------------------------------
+
+(setq use-short-answers t)
+
+(column-number-mode 1)
+
+(show-paren-mode 1)
+
+
+;; ------------------------------------------------------------
+;; Basic editing
+;; ------------------------------------------------------------
+
+(delete-selection-mode 1)
+
+
+;; ------------------------------------------------------------
+;; History
+;; ------------------------------------------------------------
+
+(setq savehist-file
+ (expand-file-name "var/savehist" user-emacs-directory))
+
+(setq save-place-file
+ (expand-file-name "var/places" user-emacs-directory))
+
+(savehist-mode 1)
+(save-place-mode 1)
+
+(provide 'init-defaults)
+
+;;; init-defaults.el ends here
diff --git a/lisp/core/init-packages.el b/lisp/core/init-packages.el
new file mode 100644
index 0000000..b7d56cf
--- /dev/null
+++ b/lisp/core/init-packages.el
@@ -0,0 +1,52 @@
+;;; init-packages.el --- Package management -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Richard Qin
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;; Author: Richard Qin
+;; This file is not part of GNU Emacs.
+
+;;; Commentary:
+
+;; Configure package archives and initialize package.el.
+;; Use use-package for declarative package configuration.
+
+;;; Code:
+
+;; ------------------------------------------------------------
+;; Package archives
+;; ------------------------------------------------------------
+
+(require 'package)
+
+(setq package-archives
+ '(("gnu" . "https://elpa.gnu.org/packages/")
+ ("nongnu" . "https://elpa.nongnu.org/nongnu/")
+ ("melpa" . "https://melpa.org/packages/")))
+
+;; Prefer GNU ELPA and NonGNU ELPA.
+(setq package-archive-priorities
+ '(("gnu" . 30)
+ ("nongnu" . 20)
+ ("melpa" . 10)))
+
+
+;; ------------------------------------------------------------
+;; Initialize package.el
+;; ------------------------------------------------------------
+
+(package-initialize)
+
+
+;; ------------------------------------------------------------
+;; use-package
+;; ------------------------------------------------------------
+
+(require 'use-package)
+
+;; Enable package loading diagnostics.
+(setq use-package-verbose t)
+
+(provide 'init-packages)
+
+;;; init-packages.el ends here