2020-01-21

This commit is contained in:
Case Duckworth 2021-01-21 21:48:38 -06:00
parent 3514f0b408
commit 92e86ff0ca
3 changed files with 864 additions and 246 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,53 +1,70 @@
;; early-init.el -*- no-byte-compile: t; -*-
;; This file is automatically tangled from config.org.
;; Hand edits will be overwritten!
;; BOOTSTRAP PACKAGE MANAGEMENT
(let ((win-app-dir "~/Applications"))
(dolist (path (list
;; Windows
(expand-file-name "Git/bin" win-app-dir)
(expand-file-name "Git/usr/bin" win-app-dir)
(expand-file-name "Git/mingw64/bin" win-app-dir)
;; Linux
(expand-file-name "bin"
user-emacs-directory)
(expand-file-name "~/bin")
(expand-file-name "~/.local/bin")
(expand-file-name "~/Scripts")
))
(when (file-exists-p path)
(add-to-list 'exec-path path :append))))
;; Set $PATH
(setenv "PATH" (mapconcat #'identity exec-path path-separator))
(setq package-enable-at-startup nil)
(defun acdw/bootstrap-straight ()
"Bootstrap straight.el."
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name
"straight/repos/straight.el/bootstrap.el"
user-emacs-directory))
(bootstrap-version 5))
(expand-file-name
"straight/repos/straight.el/bootstrap.el"
user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
(concat
"https://raw.githubusercontent.com/"
"raxod502/straight.el/develop/install.el")
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(url-retrieve-synchronously
(concat
"https://raw.githubusercontent.com/"
"raxod502/straight.el/develop/install.el")
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage)))
(unless (ignore-errors (acdw/bootstrap-straight))
(let ((msg "Straight.el didn't bootstrap correctly. Cloning directly"))
(message "%s..." msg)
(call-process "git" nil
(get-buffer-create "*bootstrap-straight-messages*") nil
"clone"
"https://github.com/raxod502/straight.el"
(expand-file-name "straight/repos/straight.el"
user-emacs-directory))
(message "%s...Done." msg)
(acdw/bootstrap-straight)))
(setq-default frame-inhibit-implied-resize t)
(setq-default frame-resize-pixelwise t)
(when (executable-find "git")
(unless (ignore-errors (acdw/bootstrap-straight))
(let ((msg "Straight.el didn't bootstrap correctly. Cloning directly"))
(message "%s..." msg)
(call-process "git" nil
(get-buffer-create "*bootstrap-straight-messages*") nil
"clone"
"https://github.com/raxod502/straight.el"
(expand-file-name "straight/repos/straight.el"
user-emacs-directory))
(message "%s...Done." msg)
(acdw/bootstrap-straight))))
;; SETUP FRAME
(add-to-list 'default-frame-alist
'(tool-bar-lines . 0))
'(tool-bar-lines . 0))
(tool-bar-mode -1)
(add-to-list 'default-frame-alist
'(menu-bar-lines . 0))
'(menu-bar-lines . 0))
(menu-bar-mode -1)
(add-to-list 'default-frame-alist
'(vertical-scroll-bars . nil)
'(horizontal-scroll-bars . nil))
'(vertical-scroll-bars . nil)
'(horizontal-scroll-bars . nil))
(scroll-bar-mode -1)
(horizontal-scroll-bar-mode -1)
(setq-default frame-inhibit-implied-resize t
frame-resize-pixelwise t)

47
init.el
View File

@ -4,26 +4,51 @@
(setq-default load-prefer-newer t)
(defmacro when-at (conditions &rest commands)
"Run COMMANDS, or let the user know, when at a specific place.
CONDITIONS are one of `:work', `:home', or a list beginning with
those and other conditions to check. COMMANDS are only run if
all CONDITIONS are met.
If COMMANDS is empty or nil, simply return the result of CONDITIONS."
(declare (indent 1))
(let ((at-work '(memq system-type '(ms-dos windows-nt)))
(at-home '(memq system-type '(gnu gnu/linux gnu/kfreebsd))))
(pcase conditions
(:work (if commands `(when ,at-work ,@commands) at-work))
(:home (if commands `(when ,at-home ,@commands) at-home))
((guard (eq (car conditions) :work))
(if commands
`(when (and ,at-work ,@(cdr conditions))
,@commands)
`(and ,at-work ,@(cdr conditions))))
((guard (eq (car conditions) :home))
(if commands
`(when (and ,at-home ,@(cdr conditions))
,@commands)
`(and ,at-work ,@(cdr conditions)))))))
(let* (;; Speed up init
(gc-cons-threshold most-positive-fixnum)
(file-name-handler-alist nil)
;; Config file names
(config (expand-file-name "config"
user-emacs-directory))
user-emacs-directory))
(config.el (concat config ".el"))
(config.org (concat config ".org"))
(straight-org-dir (expand-file-name "straight/build/org"
user-emacs-directory)))
user-emacs-directory)))
;; Unless config.org is /newer/ than config.el, *or* the config
;; is able to be loaded without errors, load the config from
;; config.org.
(unless (or (file-newer-than-file-p config.org config.el)
(load config 'no-error))
;; A plain require here just loads the older `org'
;; in Emacs' install dir. We need to add the newer
;; one to the `load-path', hopefully that's all.
(when (file-exists-p straight-org-dir)
(add-to-list 'load-path straight-org-dir))
;; Load config.org
(require 'org)
(org-babel-load-file config.org)))
(load config 'no-error))
;; A plain require here just loads the older `org'
;; in Emacs' install dir. We need to add the newer
;; one to the `load-path', hopefully that's all.
(when (file-exists-p straight-org-dir)
(add-to-list 'load-path straight-org-dir))
;; Load config.org
(require 'org)
(org-babel-load-file config.org)))