Update load process to not tangle org file at every startup
This commit is contained in:
parent
7c025b69bd
commit
12183b916a
@ -1,7 +1,12 @@
|
||||
;;; -*- lexical-binding: t; -*-
|
||||
(setq vc-follow-symlinks t)
|
||||
|
||||
;; Load straight.el here to avoid org-mode version conflict
|
||||
;; This file is meant to bootstrap ~/init.org, which tangles itself to ~/.emacs.el.
|
||||
;; Once init.org has been tangled for the first time, ~/.emacs.el should take
|
||||
;; precedence over this file so it will no longer get loaded.
|
||||
|
||||
(message "Bootstrapping init file...")
|
||||
|
||||
(defvar bootstrapping-init t)
|
||||
(defvar bootstrap-version)
|
||||
(let ((bootstrap-file
|
||||
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
|
||||
@ -16,7 +21,9 @@
|
||||
(load bootstrap-file nil 'nomessage))
|
||||
|
||||
(straight-use-package 'org-plus-contrib)
|
||||
|
||||
(require 'org)
|
||||
(org-babel-load-file (expand-file-name "~/init.org"))
|
||||
(put 'downcase-region 'disabled nil)
|
||||
|
||||
(org-babel-tangle-file
|
||||
(expand-file-name "~/init.org")
|
||||
(expand-file-name "~/.emacs.el"))
|
||||
(load-file (expand-file-name "~/.emacs.el"))
|
||||
|
@ -1,13 +1,8 @@
|
||||
-*- eval: (add-hook 'after-save-hook 'org-babel-tangle 0 t) -*-
|
||||
#+PROPERTY: header-args :results silent
|
||||
#+PROPERTY: header-args:emacs-lisp :lexical t
|
||||
#+PROPERTY: header-args:emacs-lisp :lexical t :tangle ~/.emacs.el
|
||||
|
||||
This init file is based on [[https://medium.com/@CBowdon/pinching-the-best-bits-from-spacemacs-869b8c793ad3][this blog post]].
|
||||
|
||||
It's meant to be loaded from init.el like so:
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(require 'org)
|
||||
(org-babel-load-file (expand-file-name "path/to/init.org"))
|
||||
#+END_SRC
|
||||
This is a literate init file holding my Emacs configuration. It is initially loaded by a [[file:.emacs.d/init.el::;;; -*- lexical-binding: t; -*-][bootstrap file]] that lives at ~/.emacs.d/init.el; after the initial bootstrapping it writes itself to ~/.emacs.el. Since ~/.emacs.el takes priority over ~/.emacs.d/init.el, after the initial bootstrapping process the tangled ~/.emacs.el file will get loaded without needing to load the bootstrap file first.
|
||||
|
||||
* Prelude
|
||||
Enables lexical binding for everything in init.el:
|
||||
@ -20,13 +15,33 @@ Requires:
|
||||
(require 'json)
|
||||
#+END_SRC
|
||||
|
||||
Variables:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq vc-follow-symlinks t)
|
||||
#+END_SRC
|
||||
|
||||
* Default directory
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(cd "~")
|
||||
#+END_SRC
|
||||
|
||||
* Packages
|
||||
The actual init.el file loads [[https://github.com/raxod502/straight.el][straight.el]] since we need to pull in the correct org-mode version to even load this file.
|
||||
Load [[https://github.com/raxod502/straight.el][straight.el]] to manage package installation:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defvar bootstrap-version)
|
||||
(unless (boundp 'bootstrapping-init)
|
||||
(let ((bootstrap-file
|
||||
(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
|
||||
"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)))
|
||||
#+END_SRC
|
||||
|
||||
`use-package` is a macro that simplifies installing and loading packages.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -42,20 +57,19 @@ The actual init.el file loads [[https://github.com/raxod502/straight.el][straigh
|
||||
(add-hook 'after-init-hook 'benchmark-init/deactivate))
|
||||
#+END_SRC
|
||||
|
||||
* Solarized
|
||||
Solarized is the best color scheme, objectively speaking:
|
||||
* Load org mode
|
||||
Load org-mode early to [[https://github.com/raxod502/straight.el#the-wrong-version-of-my-package-was-loaded][avoid a version clash]] (but don't load it if the bootstrap file already did):
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package solarized-theme)
|
||||
(require 'solarized-theme)
|
||||
(use-package org
|
||||
:straight org-plus-contrib)
|
||||
#+END_SRC
|
||||
|
||||
* Doom themes
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package doom-themes)
|
||||
|
||||
(use-package doom-modeline
|
||||
:init
|
||||
(doom-modeline-mode 1))
|
||||
(use-package doom-modeline)
|
||||
(doom-modeline-mode 1)
|
||||
#+END_SRC
|
||||
|
||||
* Customization File
|
||||
@ -670,7 +684,7 @@ A function to reload my init file. It reloads the major mode after the init file
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun reload-init-file ()
|
||||
(interactive)
|
||||
(load-file "~/.emacs.d/init.el")
|
||||
(load-file "~/.emacs.el")
|
||||
(funcall major-mode))
|
||||
#+END_SRC
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user