-
Notifications
You must be signed in to change notification settings - Fork 3
/
final-initialize.el
68 lines (59 loc) · 2.24 KB
/
final-initialize.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
;; -*- mode: emacs-lisp-mode -*-
;;; final-initialize.el --- Reinstall my Emacs configuration files -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2020 Howard X. Abrams
;;
;; Author: Howard X. Abrams <http://github/howard>
;; Maintainer: Howard X. Abrams
;; Created: September 11, 2020
;; Modified: September 11, 2020
;; Version: 0.0.1
;; Homepage: https://gitlab.com/howardabrams/hamacs
;; Package-Requires: ((emacs 27.1.50) (cl-lib "0.5"))
;;
;; This file is not part of GNU Emacs.
;;
;;; Commentary:
;;
;; Reinstall my Emacs configuration files
;;
;;; Code:
(require 'ob)
(require 'f)
;; The project source is actually defined in ~/.doom.d/hamacs-init.el
;; However, we define it here to get rid of Emacs linter warnings. ;-)
(defvar hamacs-source-dir
(f-parent (f-parent (or load-file-name (buffer-file-name))))
"My configuration's source code directory.")
;; Where should the code end up?
(defvar hamacs-private-code-dir (f-join user-emacs-directory "elisp")
"Location for most of the `hamacs' source code and configuration Lisp files.")
(defun ha/install-by-tangling (source-files)
(dolist (file source-files)
(message "Tangling: %s" file)
(org-babel-tangle-file file)))
(defun ha/install-code-from-essays ()
"Tangle select website essays into the elisp bucket."
(ha/install-by-tangling
'("~/website/Technical/Emacs/getting-more-boxes-done.org"
"~/website/Technical/Emacs/getting-even-more-boxes-done.org"
"~/website/Technical/Emacs/beep-for-emacs.org"
"~/website/Technical/Emacs/focused-work.org")))
(defun ha/install-code-from-hamacs ()
"Copy Emacs Lisp code without needing to translate."
(dolist (file (directory-files
(f-join hamacs-source-dir "elisp") t (rx bol (not "."))))
(copy-file file (file-name-as-directory hamacs-private-code-dir) t)))
(defun ha/install-configuration ()
"Two primary jobs: tangle all source configuration files and link
non-tangled files."
(interactive)
(unless (f-exists? user-emacs-directory)
(make-directory user-emacs-directory))
(unless (f-exists? hamacs-private-code-dir)
(make-directory hamacs-private-code-dir))
;; (ha/install-code-from-hamacs)
(ha/install-code-from-essays))
(ha/install-configuration)
(provide 'final-initialize)
;;; final-initialize.el ends here