;;; ss-core.el --- Shared core setup -*- lexical-binding: t; -*- ;;; Commentary: ;; Shared startup helpers, package bootstrap, paths, and editor defaults. ;;; Code: (require 'subr-x) (defconst ss-minimum-emacs-version "27.1" "Minimum supported Emacs version.") (defconst ss-warning-emacs-version "28.1" "Version threshold for compatibility warnings.") (defconst ss-spell-check-support-enabled nil) (defconst ss-is-windows (memq system-type '(windows-nt ms-dos cygwin))) (defconst ss-is-linux (eq system-type 'gnu/linux)) (defconst ss-is-mac (eq system-type 'darwin)) (defconst ss-org-directory (expand-file-name "~/org/") "Root directory for Org files.") (defconst ss-journal-file (expand-file-name "journal.org" ss-org-directory) "Single-file work journal for operational capture.") (defconst ss-org-projects-directory (expand-file-name "projects/" ss-org-directory) "Directory for project notes.") (defconst ss-org-areas-directory (expand-file-name "areas/" ss-org-directory) "Directory for area notes.") (defconst ss-org-resources-directory (expand-file-name "resources/" ss-org-directory) "Directory for resource notes.") (defconst ss-org-archives-directory (expand-file-name "archives/" ss-org-directory) "Directory for archived notes.") (defconst ss-moc-file (expand-file-name "moc.org" ss-org-directory) "Central MOC note.") (defconst ss-crm-file (expand-file-name "areas/people/people.org" ss-org-directory) "Single source of truth for the people CRM.") (defconst ss-journal-section-headings '("Tasks" "Notes" "Meetings") "Per-day section headings maintained under each journal datetree entry.") (defconst ss-org-agenda-directories (list ss-org-projects-directory ss-org-areas-directory ss-org-resources-directory) "Directories whose Org files feed the agenda.") (defun ss-feature-enabled-p (feature) "Return non-nil when FEATURE is enabled in `ss-enabled-features'." (memq feature ss-enabled-features)) (defun ss-require-existing-directory (directory) "Return DIRECTORY, signaling when it does not exist." (unless (file-directory-p directory) (user-error "Directory does not exist: %s" directory)) directory) (defun ss-require-existing-file (file) "Return FILE, signaling when it does not exist." (unless (file-exists-p file) (user-error "File does not exist: %s" file)) file) (defun ss-enable-prose-abbrev-mode () "Enable abbrev mode in prose buffers. We keep this mode-local so code buffers stay on their own completion rules." (abbrev-mode 1)) (defun ss-core-setup () "Initialize shared core behavior." (let ((minver ss-minimum-emacs-version)) (when (version< emacs-version minver) (error "Your Emacs is too old -- this config requires v%s or higher" minver))) (when (version< emacs-version ss-warning-emacs-version) (message (concat "Your Emacs is old, and some functionality in this config will be " "disabled. Please upgrade if possible."))) ;; Keep custom-set-variables out of the main config. (setq custom-file (expand-file-name "custom.el" user-emacs-directory)) (require 'package) (setq package-archives (append '(("melpa" . "https://melpa.org/packages/")) package-archives) package-archive-priorities '(("gnu" . 10) ("nongnu" . 8) ("melpa" . 5)) package-install-upgrade-built-in t use-package-always-ensure nil) (package-initialize) (require 'use-package) (require 'abbrev) (set-language-environment "UTF-8") (set-default-coding-systems 'utf-8) (prefer-coding-system 'utf-8) (setq abbrev-file-name (expand-file-name "abbrev_defs" user-emacs-directory) save-abbrevs 'silently) (when (file-exists-p abbrev-file-name) (quietly-read-abbrev-file abbrev-file-name)) (dolist (hook '(text-mode-hook org-mode-hook)) (add-hook hook #'ss-enable-prose-abbrev-mode)) (setq auto-save-default nil backup-inhibited t echo-keystrokes 0.1 compilation-ask-about-save nil mouse-wheel-scroll-amount '(1 ((shift) . 1)) mouse-wheel-progressive-speed nil mouse-wheel-follow-mouse t scroll-step 1 scroll-conservatively 101 enable-recursive-minibuffers t gc-cons-threshold (* 128 1024 1024) read-process-output-max (* 4 1024 1024) process-adaptive-read-buffering nil) (fset 'yes-or-no-p 'y-or-n-p) (global-auto-revert-mode 1) (delete-selection-mode 1) (setq-default indent-tabs-mode nil fill-column 80 tab-width 2 indicate-empty-lines t sentence-end-double-space nil)) (defun ss-core-load-custom-file () "Load `custom-file' when it exists." (when (file-exists-p custom-file) (load custom-file nil 'nomessage))) (provide 'ss-core) ;;; ss-core.el ends here