Add elisp autoformatter

Add README
This commit is contained in:
Emma Turner
2026-03-13 11:37:03 -06:00
parent a014d30451
commit 1fa1c1b89b
5 changed files with 116 additions and 92 deletions

0
.elisp-autofmt Normal file
View File

13
README.org Normal file
View File

@@ -0,0 +1,13 @@
* Prerequisites
- Git (Required on windows so Emacs can use the included Linux tools)
- hunspell
- ~en_US.aff~ and ~en_US.dic~ files from [[https://cgit.freedesktop.org/libreoffice/dictionaries/tree/en][LibreOffice Dictionaries]] (required for hunspell)
- Python 3.10 or newer (required for ~elisp-autofmt~)
#+begin_src powershell
winget install Git.Git FSFhu.Hunspell Python.Python.3.14
#+end_src
Additionally the personal dictionary file for hunspell must be created before it can be written to.
The default path is ~$HOME/.hunspell_en_US~

118
config.el
View File

@@ -45,7 +45,9 @@
;; If you use `org' and don't want your org files in the default location below, ;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads! ;; change `org-directory'. It must be set before org loads!
(setq! org-directory "C:/Users/EmmaTurner/OneDrive - Exponential Technology Group, Inc/Documents/Notes/") (setq!
org-directory
"C:/Users/EmmaTurner/OneDrive - Exponential Technology Group, Inc/Documents/Notes/")
;; Whenever you reconfigure a package, make sure to wrap your config in an ;; Whenever you reconfigure a package, make sure to wrap your config in an
;; `after!' block, otherwise Doom's defaults may override your settings. E.g. ;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
@@ -78,51 +80,52 @@
;; ;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how ;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented. ;; they are implemented.
(after! org (after!
(setq org-hide-emphasis-markers t) org (setq org-hide-emphasis-markers t) (setq org-log-done 'time)
(setq org-log-done 'time)
;; Collect all .org from my Org directory and subdirs ;; Collect all .org from my Org directory and subdirs
(defun load-org-agenda-files-recursively (dir) "Find all directories in DIR." (defun load-org-agenda-files-recursively (dir)
(unless (file-directory-p dir) (error "Not a directory '%s'" dir)) "Find all directories in DIR."
(unless (equal (directory-files dir nil org-agenda-file-regexp t) nil) (unless (file-directory-p dir)
(add-to-list 'org-agenda-files dir) (error "Not a directory '%s'" dir))
) (unless (equal (directory-files dir nil org-agenda-file-regexp t) nil)
(dolist (file (directory-files dir nil nil t)) (add-to-list 'org-agenda-files dir))
(unless (member file '("." "..")) (dolist (file (directory-files dir nil nil t))
(let ((file (concat dir file "/"))) (unless (member file '("." ".."))
(when (file-directory-p file) (let ((file (concat dir file "/")))
(load-org-agenda-files-recursively file) (when (file-directory-p file)
) (load-org-agenda-files-recursively file))))))
)
)
)
)
(load-org-agenda-files-recursively org-directory) ; trailing slash required (load-org-agenda-files-recursively org-directory) ; trailing slash required
(setq org-refile-targets (setq org-refile-targets
'((nil :maxlevel . 3) '((nil :maxlevel . 3) (org-agenda-files :maxlevel . 1))))
(org-agenda-files :maxlevel . 1)))
)
;; TODO: Find out what _actually_ needs to be set here ;; TODO: Find out what _actually_ needs to be set here
;; i.e. shouldn't need to set both ispell-dictionary and ispell-local-dictionary ;; i.e. shouldn't need to set both ispell-dictionary and ispell-local-dictionary
(after! ispell (after!
(setq ispell-dictionary "en_US") ispell
(setq ispell-local-dictionary "en_US") (setq ispell-dictionary "en_US")
(setq ispell-extra-args '("-d" "en_US")) (setq ispell-local-dictionary "en_US")
(setq ispell-local-dictionary-alist (setq ispell-extra-args '("-d" "en_US"))
'(("en_US" "[A-Za-z]" "[^A-Za-z]" "[']" nil nil nil utf-8))) (setq ispell-local-dictionary-alist
(setq ispell-hunspell-dictionary-alist '(("en_US" "[A-Za-z]" "[^A-Za-z]" "[']" nil nil nil utf-8)))
'(("en_US" (setq ispell-hunspell-dictionary-alist
"C:/hunspell/en_US.aff" '(("en_US"
"C:/hunspell/en_US.dic" "C:/hunspell/en_US.aff"
nil nil nil "utf-8"))) "C:/hunspell/en_US.dic"
;; This is the default hunspell personal dictionary nil
;; Hunspell won't create it, and ispell needs this file specified to work nil
(setq ispell-personal-dictionary "~/hunspell_en_US") nil
) "utf-8")))
;; This is the default hunspell personal dictionary
;; Hunspell won't create it, and ispell needs this file specified to work
(setq ispell-personal-dictionary "~/.hunspell_en_US"))
(use-package!
elisp-autofmt
:commands (elisp-autofmt-mode elisp-autofmt-buffer)
:hook (emacs-lisp-mode . elisp-autofmt-mode))
;; Windows path ;; Windows path
(when (eq system-type 'windows-nt) (when (eq system-type 'windows-nt)
@@ -135,9 +138,10 @@
(push "C:/Program Files/Git/usr/bin/" exec-path) (push "C:/Program Files/Git/usr/bin/" exec-path)
;; Update PATH from exec-path ;; Update PATH from exec-path
(let ((path (mapcar 'file-truename (let ((path
(append exec-path (mapcar
(split-string (getenv "PATH") path-separator t))))) 'file-truename
(append exec-path (split-string (getenv "PATH") path-separator t)))))
(setenv "PATH" (mapconcat 'identity (delete-dups path) path-separator)))) (setenv "PATH" (mapconcat 'identity (delete-dups path) path-separator))))
;; Based off https://github.com/alphapapa/unpackaged.el#ensure-blank-lines-between-headings-and-before-contents ;; Based off https://github.com/alphapapa/unpackaged.el#ensure-blank-lines-between-headings-and-before-contents
@@ -146,15 +150,19 @@
"Ensure blank lines exist after each org entry (before each heading). "Ensure blank lines exist after each org entry (before each heading).
With prefix, operate on whole buffer" With prefix, operate on whole buffer"
(interactive "P") (interactive "P")
(org-map-entries (lambda () (org-map-entries
(let ((end (org-entry-end-position))) (lambda ()
(goto-char end) (let ((end (org-entry-end-position)))
(unless (string-equal (string (char-before)) "\n") (goto-char end)
;; Insert blank line after entry end (unless (string-equal (string (char-before)) "\n")
(insert "\n")) ;; Insert blank line after entry end
) (insert "\n"))))
) t
t (if prefix (if prefix
nil nil
'tree)) 'tree)))
)
;; For elisp-autofmt
;; Local variables:
;; elisp-autofmt-load-packages-local: ("use-package" "use-package-core")
;; end:

75
init.el
View File

@@ -13,6 +13,7 @@
;; ;;
;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its ;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
;; directory (for easy access to its source code). ;; directory (for easy access to its source code).
;; format: off
(doom! :input (doom! :input
;;bidi ; (tfel ot) thgir etirw uoy gnipleh ;;bidi ; (tfel ot) thgir etirw uoy gnipleh
@@ -22,41 +23,41 @@
:completion :completion
;;company ; the ultimate code completion backend ;;company ; the ultimate code completion backend
(corfu +orderless) ; complete with cap(f), cape and a flying feather! (corfu +orderless) ; complete with cap(f), cape and a flying feather!
;;helm ; the *other* search engine for love and life ;;helm ; the *other* search engine for love and life
;;ido ; the other *other* search engine... ;;ido ; the other *other* search engine...
;;ivy ; a search engine for love and life ;;ivy ; a search engine for love and life
vertico ; the search engine of the future vertico ; the search engine of the future
:ui :ui
;;deft ; notational velocity for Emacs ;;deft ; notational velocity for Emacs
doom ; what makes DOOM look the way it does doom ; what makes DOOM look the way it does
doom-dashboard ; a nifty splash screen for Emacs doom-dashboard ; a nifty splash screen for Emacs
;;doom-quit ; DOOM quit-message prompts when you quit Emacs ;;doom-quit ; DOOM quit-message prompts when you quit Emacs
;;(emoji +unicode) ; 🙂 ;;(emoji +unicode) ; 🙂
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
;;indent-guides ; highlighted indent columns ;;indent-guides ; highlighted indent columns
;;ligatures ; ligatures and symbols to make your code pretty again ;;ligatures ; ligatures and symbols to make your code pretty again
;;minimap ; show a map of the code on the side ;;minimap ; show a map of the code on the side
modeline ; snazzy, Atom-inspired modeline, plus API modeline ; snazzy, Atom-inspired modeline, plus API
;;nav-flash ; blink cursor line after big motions ;;nav-flash ; blink cursor line after big motions
;;neotree ; a project drawer, like NERDTree for vim ;;neotree ; a project drawer, like NERDTree for vim
ophints ; highlight the region an operation acts on ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows (popup +defaults) ; tame sudden yet inevitable temporary windows
;;smooth-scroll ; So smooth you won't believe it's not butter ;;smooth-scroll ; So smooth you won't believe it's not butter
;;tabs ; a tab bar for Emacs ;;tabs ; a tab bar for Emacs
treemacs ; a project drawer, like neotree but cooler treemacs ; a project drawer, like neotree but cooler
;;unicode ; extended unicode support for various languages ;;unicode ; extended unicode support for various languages
(vc-gutter +pretty) ; vcs diff in the fringe (vc-gutter +pretty) ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB vi-tilde-fringe ; fringe tildes to mark beyond EOB
;;window-select ; visually switch windows ;;window-select ; visually switch windows
workspaces ; tab emulation, persistence & separate workspaces workspaces ; tab emulation, persistence & separate workspaces
;;zen ; distraction-free coding or writing ;;zen ; distraction-free coding or writing
:editor :editor
(evil +everywhere); come to the dark side, we have cookies (evil +everywhere) ; come to the dark side, we have cookies
file-templates ; auto-snippets for empty files file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding fold ; (nigh) universal code folding
;;(format +onsave) ; automated prettiness ;;(format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys ;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim ;;lispy ; vim for lisp, for people who don't like vim
@@ -64,18 +65,18 @@
;;objed ; text object editing for the innocent ;;objed ; text object editing for the innocent
;;parinfer ; turn lisp into python, sort of ;;parinfer ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates ;;rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to snippets ; my elves. They type so I don't have to
(whitespace +guess +trim) ; a butler for your whitespace (whitespace +guess +trim) ; a butler for your whitespace
;;word-wrap ; soft wrapping with language-aware indent ;;word-wrap ; soft wrapping with language-aware indent
:emacs :emacs
dired ; making dired pretty [functional] dired ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent electric ; smarter, keyword-based electric-indent
;;eww ; the internet is gross ;;eww ; the internet is gross
;;ibuffer ; interactive buffer management ;;ibuffer ; interactive buffer management
tramp ; remote files at your arthritic fingertips tramp ; remote files at your arthritic fingertips
undo ; persistent, smarter undo for your inevitable mistakes undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree vc ; version-control and Emacs, sitting in a tree
:term :term
;;eshell ; the elisp shell that works everywhere ;;eshell ; the elisp shell that works everywhere
@@ -84,7 +85,7 @@
;;vterm ; the best terminal emulation in Emacs ;;vterm ; the best terminal emulation in Emacs
:checkers :checkers
syntax ; tasing you for every semicolon you forget syntax ; tasing you for every semicolon you forget
(spell +flyspell +hunspell) ; tasing you for misspelling mispelling (spell +flyspell +hunspell) ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make ;;grammar ; tasing grammar mistake every you make
@@ -95,23 +96,23 @@
;;debugger ; FIXME stepping through code, to help you add bugs ;;debugger ; FIXME stepping through code, to help you add bugs
;;direnv ;;direnv
;;docker ;;docker
editorconfig ; let someone else argue about tabs vs spaces editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs ;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls) (eval +overlay) ; run code, run (also, repls)
lookup ; navigate your code and its documentation lookup ; navigate your code and its documentation
;;llm ; when I said you needed friends, I didn't mean... ;;llm ; when I said you needed friends, I didn't mean...
lsp ; M-x vscode lsp ; M-x vscode
magit ; a git porcelain for Emacs magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs ;;make ; run make tasks from Emacs
;;pass ; password manager for nerds ;;pass ; password manager for nerds
;;pdf ; pdf enhancements ;;pdf ; pdf enhancements
;;terraform ; infrastructure as code ;;terraform ; infrastructure as code
;;tmux ; an API for interacting with tmux ;;tmux ; an API for interacting with tmux
tree-sitter ; syntax and parsing, sitting in a tree... tree-sitter ; syntax and parsing, sitting in a tree...
;;upload ; map local to remote projects via ssh/ftp ;;upload ; map local to remote projects via ssh/ftp
:os :os
(:if (featurep :system 'macos) macos) ; improve compatibility with macOS (:if (featurep :system 'macos) macos) ; improve compatibility with macOS
;;tty ; improve the terminal Emacs experience ;;tty ; improve the terminal Emacs experience
:lang :lang
@@ -123,13 +124,13 @@
;;common-lisp ; if you've seen one lisp, you've seen them all ;;common-lisp ; if you've seen one lisp, you've seen them all
;;coq ; proofs-as-programs ;;coq ; proofs-as-programs
;;crystal ; ruby at the speed of c ;;crystal ; ruby at the speed of c
(csharp +tree-sitter) ; unity, .NET, and mono shenanigans (csharp +tree-sitter) ; unity, .NET, and mono shenanigans
;;data ; config/data formats ;;data ; config/data formats
;;(dart +flutter) ; paint ui and not much else ;;(dart +flutter) ; paint ui and not much else
;;dhall ;;dhall
;;elixir ; erlang done right ;;elixir ; erlang done right
;;elm ; care for a cup of TEA? ;;elm ; care for a cup of TEA?
emacs-lisp ; drown in parentheses emacs-lisp ; drown in parentheses
;;erlang ; an elegant language for a more civilized age ;;erlang ; an elegant language for a more civilized age
;;ess ; emacs speaks statistics ;;ess ; emacs speaks statistics
;;factor ;;factor
@@ -143,21 +144,21 @@
;;(haskell +lsp) ; a language that's lazier than I am ;;(haskell +lsp) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python ;;hy ; readability of scheme w/ speed of python
;;idris ; a language you can depend on ;;idris ; a language you can depend on
json ; At least it ain't XML (json +tree-sitter) ; At least it ain't XML
;;janet ; Fun fact: Janet is me! ;;janet ; Fun fact: Janet is me!
;;(java +lsp) ; the poster child for carpal tunnel syndrome ;;(java +lsp) ; the poster child for carpal tunnel syndrome
(javascript +tree-sitter) ; all(hope(abandon(ye(who(enter(here)))))) (javascript +tree-sitter) ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB ;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script) ;;kotlin ; a better, slicker Java(Script)
;;latex ; writing papers in Emacs has never been so fun ;;latex ; writing papers in Emacs has never been so fun
;;lean ; for folks with too much to prove ;;lean ; for folks with too much to prove
;;ledger ; be audit you can be ;;ledger ; be audit you can be
;;lua ; one-based indices? one-based indices ;;lua ; one-based indices? one-based indices
(markdown +tree-sitter) ; writing docs for people to ignore (markdown +tree-sitter) ; writing docs for people to ignore
;;nim ; python + lisp at the speed of c ;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!" ;;nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel ;;ocaml ; an objective camel
(org +roam) ; organize your plain life in plain text (org +roam) ; organize your plain life in plain text
;;php ; perl's insecure younger brother ;;php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more ;;plantuml ; diagrams for confusing people more
;;graphviz ; diagrams for confusing yourself even more ;;graphviz ; diagrams for confusing yourself even more
@@ -172,12 +173,12 @@
;;(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() ;;(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good ;;scala ; java, but good
;;(scheme +guile) ; a fully conniving family of lisps ;;(scheme +guile) ; a fully conniving family of lisps
(sh +powershell) ; she sells {ba,z,fi}sh shells on the C xor (sh +powershell) ; she sells {ba,z,fi}sh shells on the C xor
;;sml ;;sml
;;solidity ; do you need a blockchain? No. ;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables? ;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance. ;;terra ; Earth and Moon in alignment for performance.
web ; the tubes web ; the tubes
;;yaml ; JSON, but readable ;;yaml ; JSON, but readable
;;zig ; C, but simpler ;;zig ; C, but simpler

View File

@@ -52,3 +52,5 @@
;; (unpin! pinned-package another-pinned-package) ;; (unpin! pinned-package another-pinned-package)
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) ;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
;; (unpin! t) ;; (unpin! t)
(package! elisp-autofmt)