I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

171 lines
5.4 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #+TITLE: Dotfiles
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+PROPERTY: header-args:emacs-lisp :tangle init.el :comments org
  5. #+PROPERTY: header-args :results silent :eval no-export
  6. #+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  7. #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  8. #+ATTR_ORG: :width 420px
  9. #+ATTR_HTML: :width 420px
  10. #+ATTR_LATEX: :width 420px
  11. [[./docs/images/desktop-alt.png]]
  12. Portable *GNU Emacs*[fn:1] dotfiles. Built for Life, Liberty, and the Open Road.
  13. + 100% Literate
  14. + 100% Immutable
  15. + 100% Reproducible
  16. * What is it?
  17. From the documentation[fn:1]:
  18. #+begin_quote
  19. *An extensible, customizable, free/libre text editor -- and more*
  20. At its core is an interpreter for *Emacs Lisp*[fn:2], a dialect of the Lisp programming language with extensions to support text editing.
  21. #+end_quote
  22. To highlight some of the features available out of the box:
  23. + Content aware editing modes
  24. + Complete built-in documentation
  25. + Full unicode support for all human languages
  26. + Packaging sysystem for third party extensions
  27. + Wide range of functionality beyond text editing
  28. * How does it work?
  29. 1. *Emacs* reads the configuration at ~$HOME/.emacs.d/init.el~ at startup
  30. 2. *This file* outputs some startup code to that location
  31. 1. Defines all of the options for hosts
  32. 2. Runs some required startup code
  33. 3. Loads the host definition file at ~$HOME/.emacs.d/host/$HOSTNAME~
  34. 4. Lodas the enabled modules in ~dotfiles/modules~
  35. ** Options
  36. Here's a complete list of all of the options configurable for each host, and their default values. All variables prefixed with ~dotfiles/~. If you need to make configurations to another variable, consider creating a new option.
  37. #+begin_src emacs-lisp
  38. (defvar dotfiles/font
  39. "Fira Code"
  40. "Unified system font family.")
  41. (defvar dotfiles/font-size
  42. 96
  43. "Unified system font size.")
  44. (defvar dotfiles/browser
  45. (getenv "BROWSER")
  46. "Default system web browser.")
  47. (defvar dotfiles/language
  48. (getenv "LANG")
  49. "Default system dictionary language.")
  50. (defconst dotfiles/modules-p
  51. '(core
  52. editor
  53. email
  54. desktop
  55. writing
  56. website
  57. capture
  58. projects
  59. interface)
  60. "All of the available modules.")
  61. (defvar dotfiles/modules
  62. dotfiles/modules-p
  63. "All of the enabled modules.")
  64. (defvar dotfiles/home
  65. user-emacs-directory
  66. "Original value of `user-emacs-directory'.")
  67. (defvar dotfiles/cache
  68. (expand-file-name "~/.cache/emacs")
  69. "Redirection target of `user-emacs-directory'.")
  70. (defvar dotfiles/idle
  71. 0.0
  72. "Delay time before offering suggestions and completions.")
  73. (defvar dotfiles/leader-key
  74. "SPC"
  75. "All powerful leader key.")
  76. (defvar dotfiles/leader-key-global
  77. (concat "C-" dotfiles/leader-key)
  78. "Global prefix for the leader key.")
  79. (defvar dotfiles/projects
  80. (expand-file-name "~/.local/source/")
  81. "Location of source code projects.")
  82. (defvar dotfiles/passwords
  83. (expand-file-name "~/.password-store/")
  84. "Location of local password store.")
  85. (defvar dotfiles/public-key
  86. "37AB1CB72B741E478CA026D43025DCBD46F81C0F"
  87. "GPG key to encrypt org files for.")
  88. #+end_src
  89. ** Startup
  90. This project makes heavy use of modern features and libraries. Since *Babel's* used in initialization, *Org* must load prior to importing any of custom modules. This introduces a unique *chicken before the egg* problem. My solution included some initialization code in *Emacs Lisp* called before using any *Babel* APIs.
  91. #+begin_src emacs-lisp
  92. (load-file "~/.emacs.d/bin/cleanup.el")
  93. (load-file "~/.emacs.d/bin/packages.el")
  94. #+end_src
  95. * Hosts machines
  96. Each host machines configuration loaded immediately after declaring the options, before applying any configuration. This allows system to system control while remaining immutable. Override any of the available options configurations in a host file. Here's some examples to get started:
  97. + [[file:hosts/localhost.org][Termux]]
  98. + [[file:hosts/raspberry.org][Raspberry]]
  99. + [[file:hosts/acernitro.org][Acernitro]]
  100. + [[file:hosts/virtualbox.org][Virtualbox]]
  101. Begin the process by loading any host specific overrides. The host configuration tangles, and loads (if it exist) using the systems name.
  102. #+begin_src emacs-lisp
  103. (let ((host-file (concat dotfiles/home "/hosts/" system-name ".org")))
  104. (when (file-exists-p host-file)
  105. (org-babel-load-file host-file)))
  106. #+end_src
  107. * Module directory
  108. Breaking down the project into logical units or chapters to keep the code more maintainable and organized. This is also a fundamental requirement to achieve the goal of modularity. Here are all of the available modules, also listed in the variable ~dotfiles/modules-p~.
  109. + [[file:modules/core.org][Core]]
  110. + [[file:modules/editor.org][Editor]]
  111. + [[file:modules/email.org][Email]]
  112. + [[file:modules/desktop.org][Desktop]]
  113. + [[file:modules/writing.org][Writing]]
  114. + [[file:modules/website.org][Website]]
  115. + [[file:modules/capture.org][Capture]]
  116. + [[file:modules/projects.org][Projects]]
  117. + [[file:modules/interface.org][Interface]]
  118. By default all of the modules will load, override the variable ~dotfiles/modules~ in a host configuration to override this.
  119. #+begin_src emacs-lisp
  120. (dolist (m dotfiles/modules)
  121. (let ((mod-file (concat dotfiles/home "/modules/" (symbol-name m) ".org")))
  122. (when (file-exists-p mod-file)
  123. (org-babel-load-file mod-file))))
  124. #+end_src
  125. * Resources
  126. [fn:1] https://gnu.org/software/emacs
  127. [fn:2] https://gnu.org/software/emacs/manual/html_node/elisp/index.html