#+TITLE: Emacs Core Configuration
#+property: header-args :tangle ~/.emacs.d/modules/core.el

* early-init.el
For straight.el to pick up before package.el

#+begin_src elisp :tangle ~/.emacs.d/early-init.el
  (setq package-enable-at-startup nil)
#+end_src

* Straight.el Bootstrap
#+begin_src elisp :tangle ~/.emacs
  (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)
     )
  (setq straight-use-package-by-default t)
#+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

#+begin_src elisp
  (setq gc-cons-threshold (* 500 1024 1024))
  (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
  (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)
#+end_src
