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.

155 lines
6.7 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
  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-example.png]]
  12. Portable [[https://gnu.org/software/emacs][GNU/Emacs]][fn:1] dotfiles. Built for Life, Liberty, and the Open Road.
  13. + 100% Literate
  14. + 100% Immutable
  15. + 100% Reproducible
  16. * Options
  17. All of the options available for configuration are defined here. They may be overriden in a host configuration, and are read by the definitions in the modules. All of the variables are prefixed with ~dotfiles/~ to avoid name collision with other functions and packages. All of the available modules are defined in ~dotfiles/modules-p~. The variable is constant, meaning it cannot be modified. Each time a new module is added, it must be included in this list.
  18. #+begin_src emacs-lisp
  19. (defconst dotfiles/modules-p
  20. '(org trash
  21. editor
  22. shell
  23. email
  24. feeds
  25. media
  26. terminal
  27. passwords pinentry
  28. desktop
  29. roam agenda spelling grammar
  30. presentations
  31. website
  32. capture
  33. projects
  34. development
  35. interface
  36. dashboard)
  37. "All of the available modules.")
  38. #+end_src
  39. After the host configuration has loaded, the modules defined in ~dotfiles/modules~ are loaded sequentially. By default, the value of ~dotfiles/modules~ is equal to ~dotfiles/modules-p~. This means that all of the modules will load by default. Remove symbols from this list in a host configuration, or override it entirely to modify this behaviour.
  40. #+begin_src emacs-lisp
  41. (defvar dotfiles/modules dotfiles/modules-p
  42. "All of the enable modules, default value equal to `dotfiles/modules-p'.")
  43. #+end_src
  44. ** Environment variables
  45. Some of the behaviour in Emacs depends on the values of mutable environment variables. To reduce confusion in my own configuration, the values are read when Emacs starts, and then written to once the configuration has loaded. This allows the values to be overriden in a host configuration, without modifying the environment variable prior to starting.
  46. #+begin_src emacs-lisp
  47. (defvar dotfiles/browser (getenv "BROWSER")
  48. "Default system web browser.")
  49. (defvar dotfiles/language (getenv "LANG")
  50. "Default system dictionary language.")
  51. #+end_src
  52. ** Look and feel
  53. Define the options for the unified system font. The default is =Fira Code= due to its readability and support for ligatures. All font faces will be set with this value. Any variations to the font sizes are based on the value defined here as well, reducing the number of places to make modifications to when changing fonts.
  54. #+begin_src emacs-lisp
  55. (defvar dotfiles/font "Fira Code"
  56. "Unified system font family.")
  57. (defvar dotfiles/font-size 96
  58. "Unified system font size.")
  59. #+end_src
  60. Certain actions like code completions, or binding suggestions, can be configured to wait for a specific delay before offering their respective choices. I prefer to keep this value low, so that suggestions are shown immediately. This can have an affect on the performance of Emacs on older hardware. Adjust accordingly.
  61. #+begin_src emacs-lisp
  62. (defvar dotfiles/idle 0.0
  63. "Delay time before offering suggestions and completions.")
  64. #+end_src
  65. Prefix all of the custom keybinding actions with =SPC=, a tehcnique that comes from Doom / Spacemacs. In some situations, namely when using the [[file:modules/desktop.org][Desktop]] module, the leader key may not always be available. The global prefix should be used in these circumstances.
  66. #+begin_src emacs-lisp
  67. (defvar dotfiles/leader-key "SPC"
  68. "The all-powerful leader key.")
  69. (defvar dotfiles/leader-key-global
  70. (concat "C-" dotfiles/leader-key)
  71. "Global prefix for the all-powerful leader key.")
  72. #+end_src
  73. ** Productivity
  74. The location of source code projects for indexing in the [[file:modules/projects.org][Projects]] module are defined here. These projects will integrate their TODOs with the local Agenda. Override this setting in a host configuration, with the =DOTFILES_PROJECTS= environment variable, or use the default value of =~/.local/source/= in compliance with the XDG Base Directory specification.
  75. #+begin_src emacs-lisp
  76. (defvar dotfiles/projects
  77. (or (getenv "DOTFILES_PROJECTS")
  78. (expand-file-name "~/.local/source"))
  79. "Location of source code projects.")
  80. #+end_src
  81. ** Security
  82. The local password store should be cloned prior to initialization. Override this setting in a host configuration, with the =DOTFILES_PASSWORDS= environment variable, or use the default value of =~/.password-store=, which is what GNU pass will assume.
  83. #+begin_src emacs-lisp
  84. (defvar dotfiles/passwords
  85. (or (getenv "DOTFILES_PASSWORDS")
  86. (expand-file-name "~/.password-store"))
  87. "Location of the local password store.")
  88. #+end_src
  89. Since I keep all of my writing in this repository, I encrypt *most* of my Org files with GPG. Define the key to encrypt them for / to. Override this in a host configuration file.
  90. #+begin_src emacs-lisp
  91. (defvar dotfiles/public-key "37AB1CB72B741E478CA026D43025DCBD46F81C0F"
  92. "GPG kley to encrpy org files for/to.")
  93. #+end_src
  94. * Hosts
  95. 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. Begin the process by loading any host specific option overrides. The host configuration tangles, and loads (if it exist) using the systems name. If a host definition doesn't exist the default values remain.
  96. #+begin_src emacs-lisp
  97. (let ((host-file (concat dotfiles/home "/hosts/" system-name ".org")))
  98. (when (file-exists-p host-file)
  99. (org-babel-load-file host-file)))
  100. #+end_src
  101. * Modules
  102. 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. All of the modules in ~dotfiles/modules~ load after the host overrides. By default, all of the packages defined in ~dotfiles/modules-p~ load. Override this behaviour in a host configuration file.
  103. #+begin_src emacs-lisp
  104. (dolist (m dotfiles/modules)
  105. (let ((mod-file (concat dotfiles/home "/modules/" (symbol-name m) ".org")))
  106. (when (file-exists-p mod-file)
  107. (org-babel-load-file mod-file))))
  108. #+end_src
  109. * Footnotes
  110. [fn:1] https://gnu.org/software/emacs
  111. [fn:2] https://orgmode.org/worg/org-contrib/babel/intro.html
  112. [fn:3] https://orgmode.org
  113. [fn:4] https://gnu.org/software/emacs/manual/html_node/elisp/index.html