"Recursively tangle the Org files within a directory."
"Recursively tangle the Org files within a directory."
(interactive)
(let ((org-files (directory-files-recursively dir "org")))
(let ((org-files (directory-files-recursively dir "org")))
(dolist (f org-files)
(dolist (f org-files)
(org-babel-tangle-file f))))
(org-babel-tangle-file f))))
#+end_src
#+end_src
Configure the system font with a single ~font-family~ and define the size, of which variations to the font size are relative to this value.
#+begin_src emacs-lisp
(defvar dotfiles/font "Fira Code")
(defvar dotfiles/font-size 96)
#+end_src
* Core
:PROPERTIES:
:header-args: :tangle init.el :results silent
:END:
Functionality like =completion= and =hints= can be delayed to avoid popups for common manuevers. Adjust this value to your personal taste.
Emacs creates a lot of files relative to ~user-emacs-directory~, these files are not part of this immutable configuration and do not belong in the emacs directory.
#+begin_src emacs-lisp
#+begin_src emacs-lisp
(defvar dotfiles/idle 0.0)
(defvar dotfiles/home user-emacs-directory)
#+end_src
#+end_src
Avoid the infamous *Emacs pinky* by binding =SPC= as a leader key, utilizing the thumb instead of the weaker pinky finger. You may change this value if you want to use something else.
How can we solve this issue?
#+begin_src emacs-lisp
#+begin_src emacs-lisp
(defvar dotfiles/leader-key "SPC")
(defvar dotfiles/cache "~/.cache/emacs")
#+end_src
#+end_src
Stored source projects are in ~~/.local/source/~.
Shortly after initialization, before most packages are loaded, we change the value to ~dotfiles/cache~.
Emacs creates a lot of files relative to ~user-emacs-directory~, these files are not part of this immutable configuration and do not belong in the emacs directory. To solve this issue, and to retain hermetic evaluation of the Emacs directory, we it to ~~/.cache/emacs~ shortly after initialization, before most packages are loaded.
Because this project uses version-control, we can disable more unwanted features:
+ Lock files
+ Backup files
#+begin_src emacs-lisp
#+begin_src emacs-lisp
(defvar dotfiles/home user-emacs-directory)
(defvar dotfiles/cache "~/.cache/emacs")
(setq create-lockfiles nil
(setq create-lockfiles nil
make-backup-files nil
user-emacs-directory dotfiles/cache)
make-backup-files nil)
#+end_src
#+end_src
** Packages
** Packages
https://github.com/raxod502/straight.el
Download and install packages using [[https://github.com/raxod502/straight.el][straight.el]], a functional package manager that integrates with =use-package=, giving us more control over where packages are sourced from.
+ Use the development branch
+ Use the development branch
+ Integrate with ~use-package~
+ Integrate with ~use-package~
Apply the configurations prior to bootstrapping the package manager, by setting (writing) to the variables that =straight= will ultimately read from.
Apply the configurations prior to bootstrapping the package manager, by setting (writing) to the variables that =straight= will ultimately read from.
#+begin_src emacs-lisp
#+begin_src emacs-lisp
(setq straight-repository-branch "develop"
(setq straight-repository-branch "develop"
straight-use-package-by-default t)
straight-use-package-by-default t)
#+end_src
#+end_src
Bootstrap the package manager, downloading, installing, or configuring depending on the state of the configuration. All packages are downloaded and built from source, and can be pinned to specific git commit hashes.
Bootstrap the package manager, downloading, installing, or configuring depending on the state of the configuration. All packages are downloaded and built from source, and can be pinned to specific git commit hashes.
@ -88,21 +90,43 @@ Bootstrap the package manager, downloading, installing, or configuring depending
(goto-char (point-max))
(goto-char (point-max))
(eval-print-last-sexp)))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(load bootstrap-file nil 'nomessage))
#+end_src
#+end_src
Complete the integration with ~use-package~ by installing it with =straight=.
Complete the integration with ~use-package~ by installing it with =straight=.
#+begin_src emacs-lisp
#+begin_src emacs-lisp
(straight-use-package 'use-package)
(straight-use-package 'use-package)
#+end_src
#+end_src
** Cleanup
Despite having our *stateful* and *immutable* configurations seperate, it's good practice to make efforts to reduce the trash created by Emacs.
Install [[https://github.com/emacscollective/no-littering][no-littering]] to reduce the files created by Emacs.
#+begin_src emacs-lisp
(use-package no-littering)
#+end_src
Emacs' default user interface is horrendous, but with less than 10 lines of code we can change that.
#+begin_src emacs-lisp
(setq inhibit-startup-message t)
(global-prettify-symbols-mode)
(scroll-bar-mode -1)
(menu-bar-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)
#+end_src
** Babel
*Organize your plain life in plain text*
*Organize your plain life in plain text*
=Org-mode= is one of the hallmark features of Emacs, and provides the basis for my Literate Programming platform. It's essentially a markdown language with rich features for project management, scheduling, development, and writing. It's hard to convey everything within its capabilities.
[[https://orgmode.org][Org-mode]] is one of the hallmark features of Emacs, and provides the basis for my Literate Programming platform. It's essentially a markdown language with rich features for project management, scheduling, development, and writing. It's hard to convey everything within its capabilities.
+ Display the currently incomplete keybinding in a mini-buffer.
Download [[https://github.com/justbur/emacs-which-key][which-key]], a package that displays the current incomplete keybinding input in a mini-buffer, showing available completion options.
Avoid the infamous *Emacs pinky* by binding =SPC= as a leader key, utilizing the thumb instead of the weaker pinky finger. You may change this value if you want to use something else.
#+begin_src emacs-lisp
(defvar dotfiles/leader-key "SPC")
#+end_src
Implement the *leader* key mentioned above using [[https://github.com/noctuid/general.el][general.el]], letting us easily configure prefixed keybindings in a much cleaner manner than the default methods.
Again cherry picked from =Doom=, I want to continue utilizing the muscle memory I have developed from a year of mainlining the framework.
Again cherry picked from =Doom=, I want to continue utilizing the muscle memory I have developed from a year of mainlining the framework.
@ -265,6 +247,8 @@ Again cherry picked from =Doom=, I want to continue utilizing the muscle memory
"." '(find-file :which-key "File"))
"." '(find-file :which-key "File"))
#+end_src
#+end_src
**** Quit
Quit emacs with =SPC q=.
Quit emacs with =SPC q=.
+ Saving =q=
+ Saving =q=
+ Without =w=
+ Without =w=
@ -278,6 +262,8 @@ Quit emacs with =SPC q=.
"qf" '(delete-frame :which-key "Frame"))
"qf" '(delete-frame :which-key "Frame"))
#+end_src
#+end_src
**** Windows
Window management with =SPC w=.
Window management with =SPC w=.
+ Swap with =w=
+ Swap with =w=
+ Close with =c=
+ Close with =c=
@ -300,66 +286,55 @@ Window management with =SPC w=.
"wsl" '(split-window-right :which-key "Right"))
"wsl" '(split-window-right :which-key "Right"))
#+end_src
#+end_src
** Editor
* Editor
:PROPERTIES:
:header-args: :tangle init.el :results silent
:END:
Relative line numbers are important when using =VI= emulation keys. You can prefix most commands with a *number*, allowing you to jump up / down by a line count.
*Bring Emacs out of the eighties*
#+begin_example
5:
4:
3:
2:
1:
156: << CURRENT LINE >>
1:
2:
3:
4:
5:
#+end_example
** Git
https://github.com/emacsmirror/linum-relative
+ Integrate with ~display-line-numbers-mode~ for performance
Another hallmark feature is [[https://github.com/magit/magit][Magit]], a complete git porcelain within Emacs.
While not a traditional terminal emulator, =eshell= provides me with all of the functionality I expect and require from one. Some users may be left wanting more, I would recommend they look into =vterm=.
https://github.com/zwild/eshell-prompt-extras
+ Enable lambda shell prompt
#+begin_src emacs-lisp
#+begin_src emacs-lisp
(use-package forge)
(use-package eshell-prompt-extras
:config (setq eshell-highlight-prompt nil
eshell-prompt-function 'epe-theme-lambda))
#+end_src
#+end_src
Open the *status* page for the current repository with =SPC g=.
Open an =eshell= buffer with =SPC e=.
#+begin_src emacs-lisp
#+begin_src emacs-lisp
(dotfiles/leader
(dotfiles/leader
"g" '(magit-status :which-key "Magit"))
"e" '(eshell :which-key "Shell"))
#+end_src
#+end_src
** Files
** Files
@ -394,24 +369,77 @@ Open a dired buffer with =SPC d=.
"d" '(dired-jump :which-key "Dired"))
"d" '(dired-jump :which-key "Dired"))
#+end_src
#+end_src
**Shell
**Fonts
While not a traditional terminal emulator, =eshell= provides me with all of the functionality I expect and require from one. Some users may be left wanting more, I would recommend they look into =vterm=.
Configure the system font with a single ~font-family~ and define the size, of which variations to the font size are relative to this value.
https://github.com/zwild/eshell-prompt-extras
+ Enable lambda shell prompt
#+begin_src emacs-lisp
(defvar dotfiles/font "Fira Code")
(defvar dotfiles/font-size 96)
#+end_src
Write out to all *3* of Emacs' default font faces.
Define a transient keybinding for scaling the text.
#+begin_src emacs-lisp
(defhydra hydra-text-scale (:timeout 4)
"Scale"
("j" text-scale-increase "Increase")
("k" text-scale-decrease "Decrease")
("f" nil "Finished" :exit t))
#+end_src
Increase the font size in buffers with =SPC f=.
+ Increase =j=
+ Decrease =k=
+ Finish =f=
#+begin_src emacs-lisp
#+begin_src emacs-lisp
(dotfiles/leader
(dotfiles/leader
"e" '(eshell :which-key "Shell"))
"f" '(hydra-text-scale/body :which-key "Font"))
#+end_src
** Lines
Relative line numbers are important when using =VI= emulation keys. You can prefix most commands with a *number*, allowing you to jump up / down by a line count.
#+begin_example
5:
4:
3:
2:
1:
156: << CURRENT LINE >>
1:
2:
3:
4:
5:
#+end_example
https://github.com/emacsmirror/linum-relative
+ Integrate with ~display-line-numbers-mode~ for performance
Pass makes managing passwords extremely easy, encrypring them in a file structure and providing easy commands for generating, modify, and copying passwords. =password-store.el= provides a wrapper for the functionality within Emacs.
#+begin_src emacs-lisp
(use-package password-store
:custom (password-store-dir dotfiles/pass))
#+end_src
* Development
* Development
:PROPERTIES:
:PROPERTIES:
:header-args: :tangle init.el :results silent
:header-args: :tangle init.el :results silent
:END:
:END:
An IDE like experience (or better) can be achieved in Emacs using two *Microsoft* open source initiatives.
An IDE like experience (or better) can be achieved in Emacs using two *Microsoft* open source initiatives.
Turn Emacs into an *IDE* (or better) with the [[https://microsoft.github.io/language-server-protocol/][Language Server Protocol]], an open source initiative from *Microsoft* for the *VSCode* editor.
[[https://emacs-lsp.github.io/lsp-mode/][Lsp-mode]] brings support for language servers into Emacs.
Pass makes managing passwords extremely easy, encrypring them in a file structure and providing easy commands for generating, modify, and copying passwords. =password-store.el= provides a wrapper for the functionality within Emacs.
Handled through the [[https://microsoft.github.io/debug-adapter-protocol/][Debug Adapter Protocol]], an open source initiative from *Microsoft* for the *VSCode* editor.
[[https://emacs-lsp.github.io/dap-mode/][Dap-mode]] adds support for the protocol to Emacs.
#+begin_src emacs-lisp
#+begin_src emacs-lisp
(use-package dap-mode)
(use-package dap-mode)
#+end_src
#+end_src
** Completion
Text completion framework via =company= aka *Complete Anything*.
Text completion framework via =company= aka *Complete Anything*.
@ -574,27 +610,24 @@ GO111MODULE=on go get golang.org/x/tools/gopls@latest
:header-args: :tangle init.el :results silent
:header-args: :tangle init.el :results silent
:END:
:END:
I am using [[https://orgmode.org][Org-mode]] extensively for writing projects for different purposes. Improvements beyond what are required for my Literate Programming platform include:
https://github.com/integral-dw/org-superstar-mode
+ Make the headline stars more *super*
[[https://github.com/integral-dw/org-superstar-mode][Org-superstar-mode]] for making headline stars more *super*.
#+begin_src emacs-lisp
#+begin_src emacs-lisp
(use-package org-superstar
(use-package org-superstar
:hook (org-mode . org-superstar-mode))
:hook (org-mode . org-superstar-mode))
#+end_src
#+end_src
https://github.com/org-roam/org-roam
+ Rudimentary roam replica with =org-mode=
[[https://github.com/org-roam/org-roam][Org-roam]] is a rudimentary roam replica built on =Org mode=.
[[https://github.com/org-roam/org-roam-server][Org-roam-server]] is a web application that visualizes the =Org roam= database, available when Emacs' running at [[http://localhost:8080][localhost:8080]].
#+begin_src emacs-lisp
#+begin_src emacs-lisp
(use-package org-roam-server
(use-package org-roam-server
@ -711,8 +744,9 @@ Open an agenda buffer with =SPC a=.
** Blogging
** Blogging
https://github.com/kaushalmodi/ox-hugo
+ Configure for =one-post-per-file=
I use [[https://gohugo.io][Hugo]] for my personal [[https://chrishayward.xyz][website]], which I write in =Org-mode= before compiling to =hugo-markdown=.
[[https://github.com/kaushalmodi/ox-hugo][Ox-hugo]], configured for =one-post-per-file= is my technique for managing my blog.
#+begin_src emacs-lisp
#+begin_src emacs-lisp
(use-package ox-hugo
(use-package ox-hugo
@ -731,10 +765,9 @@ Creaate a capture template for blog posts in the =posts= sub directory.
** Presentations
** Presentations
Produce high quality presentations that work anywhere with =HTML/JS=via the =reveal.js= package.
Produce high quality presentations that work anywhere with =HTML/JS=and the [[https://revealjs.com][Reveal.js]] package.
https://github.com/hexmode/ox-reveal
+ Configure to use =cdn=
[[https://github.com/hexmode/ox-reveal][Ox-reveal]], configured to use a =cdn= allows us to produce ones that are not dependent on a local version of =Reveal.js=.