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
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. ** Startup
  36. 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.
  37. #+begin_src emacs-lisp
  38. (load-file "~/.emacs.d/bin/cleanup.el")
  39. (load-file "~/.emacs.d/bin/packages.el")
  40. #+end_src
  41. ** Options
  42. 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.
  43. #+begin_src emacs-lisp
  44. (defvar dotfiles/font
  45. "Fira Code"
  46. "Unified system font family.")
  47. (defvar dotfiles/font-size
  48. 96
  49. "Unified system font size.")
  50. (defvar dotfiles/browser
  51. (getenv "BROWSER")
  52. "Default system web browser.")
  53. (defvar dotfiles/language
  54. (getenv "LANG")
  55. "Default system dictionary language.")
  56. (defconst dotfiles/modules-p
  57. '(core
  58. editor
  59. email
  60. desktop
  61. writing
  62. website
  63. capture
  64. projects
  65. interface)
  66. "All of the available modules.")
  67. (defvar dotfiles/modules
  68. dotfiles/modules-p
  69. "All of the enabled modules.")
  70. (defvar dotfiles/home
  71. user-emacs-directory
  72. "Original value of `user-emacs-directory'.")
  73. (defvar dotfiles/cache
  74. (expand-file-name "~/.cache/emacs")
  75. "Redirection target of `user-emacs-directory'.")
  76. (defvar dotfiles/idle
  77. 0.0
  78. "Delay time before offering suggestions and completions.")
  79. (defvar dotfiles/leader-key
  80. "SPC"
  81. "All powerful leader key.")
  82. (defvar dotfiles/leader-key-global
  83. (concat "C-" dotfiles/leader-key)
  84. "Global prefix for the leader key.")
  85. (defvar dotfiles/projects
  86. (expand-file-name "~/.local/source/")
  87. "Location of source code projects.")
  88. (defvar dotfiles/passwords
  89. (expand-file-name "~/.password-store/")
  90. "Location of local password store.")
  91. (defvar dotfiles/public-key
  92. "37AB1CB72B741E478CA026D43025DCBD46F81C0F"
  93. "GPG key to encrypt org files for.")
  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