Contain emacs config entirely within .emacs.d to enable Chemacs

This commit is contained in:
Jeremy Dormitzer 2020-08-21 13:11:52 -04:00
parent 44570b3f8a
commit 4adb945a51
2 changed files with 32 additions and 32 deletions

View File

@ -1,29 +1,32 @@
;;; -*- lexical-binding: t; -*-
;; 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.
;; If ~/.emacs.d/jdormit-init.el, just load it. Otherwise, first
;; bootstrap Straight and load Org to make sure we end up with the
;; right Org version, then tangle ~/.emacs.d/init.org to
;; ~/.emacs.d/jdormit-init.el
(message "Bootstrapping init file...")
(when (not (file-exists-p
(expand-file-name "~/.emacs.d/jdormit-init.el")))
(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))
(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))
(defvar bootstrapping-init t)
(defvar bootstrap-version)
(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))
(straight-use-package 'org-plus-contrib)
(require 'org)
(org-babel-tangle-file
(expand-file-name "~/.emacs.d/init.org")
(expand-file-name "~/.emacs.d/jdormit-init.el")))
(straight-use-package 'org-plus-contrib)
(require 'org)
(org-babel-tangle-file
(expand-file-name "~/init.org")
(expand-file-name "~/.emacs.el"))
(load-file (expand-file-name "~/.emacs.el"))
(load-file (expand-file-name "~/.emacs.d/jdormit-init.el"))

View File

@ -1,9 +1,9 @@
-*- eval: (add-hook 'after-save-hook 'org-babel-tangle 0 t) -*-
#+PROPERTY: header-args :results silent
#+PROPERTY: header-args:emacs-lisp :lexical t :tangle ~/.emacs.el
#+PROPERTY: header-args:emacs-lisp :lexical t :tangle ~/.emacs.d/jdormit-init.el
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;
initially loaded by a [[file:init.el][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
@ -853,7 +853,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.el")
(load-file "~/.emacs.d/jdormit-init.el")
(funcall major-mode))
#+END_SRC
@ -861,7 +861,7 @@ And another one to edit it:
#+BEGIN_SRC emacs-lisp
(defun find-init-file ()
(interactive)
(find-file "~/init.org"))
(find-file "~/.emacs.d/init.org"))
#+END_SRC
* Keybindings
@ -4717,13 +4717,10 @@ Or Gnus can read RSS feeds directly:
* Dired
** Dired-X
#+BEGIN_SRC emacs-lisp
(defun dired-x-load-setup ()
(require "dired-x"))
(defun dired-x-setup ()
(require 'dired-x)
(dired-omit-mode 1))
(add-hook 'dired-load-hook #'dired-x-load-setup)
(add-hook 'dired-mode-hook #'dired-x-setup)
#+END_SRC