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,
;; 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
;; `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
;; they are implemented.
(after! org
(setq org-hide-emphasis-markers t)
(setq org-log-done 'time)
(after!
org (setq org-hide-emphasis-markers t) (setq org-log-done 'time)
;; Collect all .org from my Org directory and subdirs
(defun load-org-agenda-files-recursively (dir) "Find all directories in DIR."
(unless (file-directory-p dir) (error "Not a directory '%s'" dir))
(unless (equal (directory-files dir nil org-agenda-file-regexp t) nil)
(add-to-list 'org-agenda-files dir)
)
(dolist (file (directory-files dir nil nil t))
(unless (member file '("." ".."))
(let ((file (concat dir file "/")))
(when (file-directory-p file)
(load-org-agenda-files-recursively file)
)
)
)
)
)
;; Collect all .org from my Org directory and subdirs
(defun load-org-agenda-files-recursively (dir)
"Find all directories in DIR."
(unless (file-directory-p dir)
(error "Not a directory '%s'" dir))
(unless (equal (directory-files dir nil org-agenda-file-regexp t) nil)
(add-to-list 'org-agenda-files dir))
(dolist (file (directory-files dir nil nil t))
(unless (member file '("." ".."))
(let ((file (concat dir 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
'((nil :maxlevel . 3)
(org-agenda-files :maxlevel . 1)))
)
(setq org-refile-targets
'((nil :maxlevel . 3) (org-agenda-files :maxlevel . 1))))
;; TODO: Find out what _actually_ needs to be set here
;; i.e. shouldn't need to set both ispell-dictionary and ispell-local-dictionary
(after! ispell
(setq ispell-dictionary "en_US")
(setq ispell-local-dictionary "en_US")
(setq ispell-extra-args '("-d" "en_US"))
(setq ispell-local-dictionary-alist
'(("en_US" "[A-Za-z]" "[^A-Za-z]" "[']" nil nil nil utf-8)))
(setq ispell-hunspell-dictionary-alist
'(("en_US"
"C:/hunspell/en_US.aff"
"C:/hunspell/en_US.dic"
nil nil 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")
)
(after!
ispell
(setq ispell-dictionary "en_US")
(setq ispell-local-dictionary "en_US")
(setq ispell-extra-args '("-d" "en_US"))
(setq ispell-local-dictionary-alist
'(("en_US" "[A-Za-z]" "[^A-Za-z]" "[']" nil nil nil utf-8)))
(setq ispell-hunspell-dictionary-alist
'(("en_US"
"C:/hunspell/en_US.aff"
"C:/hunspell/en_US.dic"
nil
nil
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
(when (eq system-type 'windows-nt)
@@ -135,9 +138,10 @@
(push "C:/Program Files/Git/usr/bin/" exec-path)
;; Update PATH from exec-path
(let ((path (mapcar 'file-truename
(append exec-path
(split-string (getenv "PATH") path-separator t)))))
(let ((path
(mapcar
'file-truename
(append exec-path (split-string (getenv "PATH") path-separator t)))))
(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
@@ -146,15 +150,19 @@
"Ensure blank lines exist after each org entry (before each heading).
With prefix, operate on whole buffer"
(interactive "P")
(org-map-entries (lambda ()
(let ((end (org-entry-end-position)))
(goto-char end)
(unless (string-equal (string (char-before)) "\n")
;; Insert blank line after entry end
(insert "\n"))
)
)
t (if prefix
nil
'tree))
)
(org-map-entries
(lambda ()
(let ((end (org-entry-end-position)))
(goto-char end)
(unless (string-equal (string (char-before)) "\n")
;; Insert blank line after entry end
(insert "\n"))))
t
(if prefix
nil
'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
;; directory (for easy access to its source code).
;; format: off
(doom! :input
;;bidi ; (tfel ot) thgir etirw uoy gnipleh
@@ -22,41 +23,41 @@
:completion
;;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
;;ido ; the other *other* search engine...
;;ivy ; a search engine for love and life
vertico ; the search engine of the future
vertico ; the search engine of the future
:ui
;;deft ; notational velocity for Emacs
doom ; what makes DOOM look the way it does
doom-dashboard ; a nifty splash screen for Emacs
doom ; what makes DOOM look the way it does
doom-dashboard ; a nifty splash screen for Emacs
;;doom-quit ; DOOM quit-message prompts when you quit Emacs
;;(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
;;ligatures ; ligatures and symbols to make your code pretty again
;;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
;;neotree ; a project drawer, like NERDTree for vim
ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows
ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows
;;smooth-scroll ; So smooth you won't believe it's not butter
;;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
(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
workspaces ; tab emulation, persistence & separate workspaces
workspaces ; tab emulation, persistence & separate workspaces
;;zen ; distraction-free coding or writing
:editor
(evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
(evil +everywhere) ; come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
;;(format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim
@@ -64,18 +65,18 @@
;;objed ; text object editing for the innocent
;;parinfer ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to
(whitespace +guess +trim) ; a butler for your whitespace
snippets ; my elves. They type so I don't have to
(whitespace +guess +trim) ; a butler for your whitespace
;;word-wrap ; soft wrapping with language-aware indent
:emacs
dired ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent
dired ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent
;;eww ; the internet is gross
;;ibuffer ; interactive buffer management
tramp ; remote files at your arthritic fingertips
undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree
tramp ; remote files at your arthritic fingertips
undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree
:term
;;eshell ; the elisp shell that works everywhere
@@ -84,7 +85,7 @@
;;vterm ; the best terminal emulation in Emacs
: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
;;grammar ; tasing grammar mistake every you make
@@ -95,23 +96,23 @@
;;debugger ; FIXME stepping through code, to help you add bugs
;;direnv
;;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
(eval +overlay) ; run code, run (also, repls)
lookup ; navigate your code and its documentation
(eval +overlay) ; run code, run (also, repls)
lookup ; navigate your code and its documentation
;;llm ; when I said you needed friends, I didn't mean...
lsp ; M-x vscode
magit ; a git porcelain for Emacs
lsp ; M-x vscode
magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
;;pass ; password manager for nerds
;;pdf ; pdf enhancements
;;terraform ; infrastructure as code
;;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
: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
:lang
@@ -123,13 +124,13 @@
;;common-lisp ; if you've seen one lisp, you've seen them all
;;coq ; proofs-as-programs
;;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
;;(dart +flutter) ; paint ui and not much else
;;dhall
;;elixir ; erlang done right
;;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
;;ess ; emacs speaks statistics
;;factor
@@ -143,21 +144,21 @@
;;(haskell +lsp) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python
;;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!
;;(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
;;kotlin ; a better, slicker Java(Script)
;;latex ; writing papers in Emacs has never been so fun
;;lean ; for folks with too much to prove
;;ledger ; be audit you can be
;;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
;;nix ; I hereby declare "nix geht mehr!"
;;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
;;plantuml ; diagrams for confusing people more
;;graphviz ; diagrams for confusing yourself even more
@@ -172,12 +173,12 @@
;;(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good
;;(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
;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance.
web ; the tubes
web ; the tubes
;;yaml ; JSON, but readable
;;zig ; C, but simpler

View File

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