Compare commits

..

6 Commits

Author SHA1 Message Date
Micheal Smith
45afbf9517 Moved general section into its own file. 2025-10-29 20:02:19 -05:00
Micheal Smith
ee8212779c Moved profiling section into its own file. 2025-10-29 19:56:50 -05:00
Micheal Smith
c5e87681a4 Moved path section into its own file. 2025-10-29 19:54:59 -05:00
Micheal Smith
b512e64fcb Moved auth section to its own configuration file. 2025-10-29 19:53:28 -05:00
Micheal Smith
1679ca1e19 Moved tidy section into its own org file. 2025-10-29 19:50:32 -05:00
Micheal Smith
28dc7d9039 Moved garbage collection into its own file. 2025-10-29 19:49:18 -05:00
8 changed files with 193 additions and 183 deletions

View File

@@ -72,6 +72,7 @@ warnings.
(setq native-comp-async-report-warnings-errors nil) (setq native-comp-async-report-warnings-errors nil)
(setenv "LSP_USE_PLISTS" "true") (setenv "LSP_USE_PLISTS" "true")
(setq lsp-use-plists t)
#+end_src #+end_src
** Appearance ** Appearance
@@ -204,7 +205,6 @@ configuration I do *indeed* use it as an editor.
(setq-default tab-width 2) (setq-default tab-width 2)
(editorconfig-mode) (editorconfig-mode)
#+end_src #+end_src
* Garbage Collection * Garbage Collection
There's a lot of clashes that can happen with regards to performance, and There's a lot of clashes that can happen with regards to performance, and
@@ -1509,6 +1509,7 @@ the package.
(clojure-ts-mode . lsp-deferred) (clojure-ts-mode . lsp-deferred)
(elixir-ts-mode . lsp-deferred) (elixir-ts-mode . lsp-deferred)
(gleam-ts-mode . lsp-deferred) (gleam-ts-mode . lsp-deferred)
(python-ts-mode . lsp-deferred)
(rust-ts-mode . lsp-deferred) (rust-ts-mode . lsp-deferred)
(slint-mode . lsp-deferred) (slint-mode . lsp-deferred)
(zig-mode . lsp-deferred) (zig-mode . lsp-deferred)

View File

@@ -72,6 +72,7 @@ warnings.
(setq native-comp-async-report-warnings-errors nil) (setq native-comp-async-report-warnings-errors nil)
(setenv "LSP_USE_PLISTS" "true") (setenv "LSP_USE_PLISTS" "true")
(setq lsp-use-plists t)
#+end_src #+end_src
** Appearance ** Appearance
@@ -195,192 +196,15 @@ features.
#+INCLUDE: "config/editing.org" :minlevel 1 #+INCLUDE: "config/editing.org" :minlevel 1
* Garbage Collection #+INCLUDE: "config/gc.org" :minlevel 1
There's a lot of clashes that can happen with regards to performance, and #+INCLUDE: "config/tidy.org" :minlevel 1
garbage collection. There are a lot of [[https://emacsredux.com/blog/2025/03/28/speed-up-emacs-startup-by-tweaking-the-gc-settings/][settings]] improvements that can make
a huge difference in this regard. Especially when it comes to LSPs,
completion, and the like. I've chosen to let GCCH (Garbage Collector
Magic Hack) to handle this. It seems to work pretty well.
#+begin_src emacs-lisp #+INCLUDE: "config/auth.org" :minlevel 1
;; Garbage collection
(use-package gcmh
:ensure t
:hook (after-init . gcmh-mode)
:custom
(gcmh-idle-delay 'auto)
(gcmh-auto-idle-delay-factor 10))
#+end_src
* Keeping things tidy #+INCLUDE: "config/profiling.org" :minlevel 1
I'd like to keep all of my configuration, and emacs files in one place. I've found #+INCLUDE: "config/general.org" :minlevel 1
the [[https://github.com/emacscollective/no-littering][no-littering]] package does this well. This keeps everything under the .emacs.d
directory rather than littering $HOME.
#+begin_src emacs-lisp
(use-package no-littering
:ensure t
:config
(no-littering-theme-backups)
(let ((dir (no-littering-expand-var-file-name "lock-files/")))
(make-directory dir t)
(setq lock-file-name-transforms `((".*" ,dir t))))
(setq custom-file (expand-file-name "custom.el" user-emacs-directory)))
#+end_src
* Auth sources
I make sure the auth sources are within the emacs directory. I use gpg, but in case there's
a plain text one laying around I'll use that too. Finally as I use pass I've enabled
password-store as well; Though I'm not sure this actually works currently.
#+begin_src emacs-lisp
(auth-source-pass-enable)
(setq auth-sources '("~/.emacs.d/.authinfo.gpg" "~/.emacs.d/.authinfo"
"password-store"))
#+end_src
* Path
Rather than having to manage potential paths in the configuration I'll use the
[[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] package. This pulls in =$PATH= from various different shells
and operating systems. At least BSD, Linux, and MacOS are supported anyway.
#+BEGIN_SRC emacs-lisp
(use-package exec-path-from-shell
:ensure t
:config
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize)))
#+end_src
* Profiling
Sometimes if I experience slow start times I've found [[https://github.com/jschaf/esup][esup]] does this quickly and
without having to quit Emacs.
#+begin_src emacs-lisp
(use-package esup
:ensure t
:config
(setq esup-depth 0))
#+end_src
* General Settings
I have some configuration tweaks on existing features in emacs.
** Fancy Compile Output
Just want to add a bit of color to compilation output. This also will scroll
to the first error if there is one.
#+begin_src emacs-lisp
(use-feature compile
:commands (compile recompile)
:custom (compilation-scroll-output 'first-error)
:config
(defun +compilation-colorize ()
"Colorize from `compilation-filter-start' to `point'."
(require 'ansi-color)
(let ((inhibit-read-only t))
(ansi-color-apply-on-region (point-min) (point-max))))
(add-hook 'compilation-filter-hook #'+compilation-colorize))
#+end_src
** General Emacs Settings
These are my overall emacs settings. More settings could be moved here. Though
keep the loading order in mind when doing so.
#+begin_src emacs-lisp
(use-feature emacs
:demand t
:config
(epa-file-enable)
(setq epg-pinentry-mode 'loopback)
(setq epa-file-encrypt-to '("xulfer@cheapbsd.net"))
:custom
(scroll-conservatively 101 "Scroll just enough to bring text into view")
(enable-recursive-minibuffers t "Allow minibuffer commands in minibuffer")
(frame-title-format '(buffer-file-name "%f" ("%b"))
"Make frame title current file's name.")
(find-library-include-other-files nil)
(indent-tabs-mode nil "Use spaces, not tabs")
(inhibit-startup-screen t)
(history-delete-duplicates t "Don't clutter history")
(pgtk-use-im-context-on-new-connection nil "Prevent GTK from stealing Shift + Space")
(sentence-end-double-space nil "Double space sentence demarcation breaks sentence navigation in Evil")
(tab-stop-list (number-sequence 2 120 2))
(tab-width 2 "Shorter tab widths")
(completion-styles '(flex basic partial-completion emacs22))
(report-emacs-bug-no-explanations t)
(report-emacs-bug-no-confirmation t)
(setq shr-use-xwidgets-for-media t))
#+end_src
** Diffs
I have a slight tweak to diff output here. Mainly making the diff horizontally
split by default.
#+begin_src emacs-lisp
(use-feature ediff
:defer t
:custom
(ediff-window-setup-function #'ediff-setup-windows-plain)
(ediff-split-window-function #'split-window-horizontally)
:config
(add-hook 'ediff-quit-hook #'winner-undo))
#+end_src
** Minibuffer
The minibuffer is already pretty well sorted by other packages that will be
discussed later. However, there is still a bit of tidying that can be done
with long paths, and some helpful file based completion.
#+begin_src emacs-lisp
(use-feature minibuffer
:custom (read-file-name-completion-ignore-case t)
:config
(defun +minibuffer-up-dir ()
"Trim rightmost directory component of `minibuffer-contents'."
(interactive)
(unless (minibufferp) (user-error "Minibuffer not selected"))
(let* ((f (directory-file-name (minibuffer-contents)))
(s (file-name-directory f)))
(delete-minibuffer-contents)
(when s (insert s))))
(define-key minibuffer-local-filename-completion-map
(kbd "C-h") #'+minibuffer-up-dir)
(minibuffer-depth-indicate-mode))
#+end_src
** Remote Editing
There are a lot of solutions for editing files, and projects remotely. At the moment
[[https://www.gnu.org/software/tramp/][tramp]] still seems to work perfectly well... albeit somewhat slower than I'd like.
#+begin_src emacs-lisp
(use-feature tramp
:config
;; Enable full-featured Dirvish over TRAMP on ssh connections
;; https://www.gnu.org/software/tramp/#Improving-performance-of-asynchronous-remote-processes
(connection-local-set-profile-variables
'remote-direct-async-process
'((tramp-direct-async-process . t)))
(connection-local-set-profiles
'(:application tramp :protocol "ssh")
'remote-direct-async-process)
;; Tips to speed up connections
(setq tramp-verbose 0)
(setq tramp-chunksize 2000)
(setq tramp-ssh-controlmaster-options nil))
#+end_src
* Blocks, Parentheses and Formatting Oh My! * Blocks, Parentheses and Formatting Oh My!
@@ -1293,6 +1117,7 @@ the package.
(clojure-ts-mode . lsp-deferred) (clojure-ts-mode . lsp-deferred)
(elixir-ts-mode . lsp-deferred) (elixir-ts-mode . lsp-deferred)
(gleam-ts-mode . lsp-deferred) (gleam-ts-mode . lsp-deferred)
(python-ts-mode . lsp-deferred)
(rust-ts-mode . lsp-deferred) (rust-ts-mode . lsp-deferred)
(slint-mode . lsp-deferred) (slint-mode . lsp-deferred)
(zig-mode . lsp-deferred) (zig-mode . lsp-deferred)

11
config/auth.org Normal file
View File

@@ -0,0 +1,11 @@
* Auth sources
I make sure the auth sources are within the emacs directory. I use gpg, but in case there's
a plain text one laying around I'll use that too. Finally as I use pass I've enabled
password-store as well; Though I'm not sure this actually works currently.
#+begin_src emacs-lisp
(auth-source-pass-enable)
(setq auth-sources '("~/.emacs.d/.authinfo.gpg" "~/.emacs.d/.authinfo"
"password-store"))
#+end_src

18
config/gc.org Normal file
View File

@@ -0,0 +1,18 @@
* Garbage Collection
There's a lot of clashes that can happen with regards to performance, and
garbage collection. There are a lot of [[https://emacsredux.com/blog/2025/03/28/speed-up-emacs-startup-by-tweaking-the-gc-settings/][settings]] improvements that can make
a huge difference in this regard. Especially when it comes to LSPs,
completion, and the like. I've chosen to let GCCH (Garbage Collector
Magic Hack) to handle this. It seems to work pretty well.
#+begin_src emacs-lisp
;; Garbage collection
(use-package gcmh
:ensure t
:hook (after-init . gcmh-mode)
:custom
(gcmh-idle-delay 'auto)
(gcmh-auto-idle-delay-factor 10))
#+end_src

112
config/general.org Normal file
View File

@@ -0,0 +1,112 @@
* General Settings
I have some configuration tweaks on existing features in emacs.
** Fancy Compile Output
Just want to add a bit of color to compilation output. This also will scroll
to the first error if there is one.
#+begin_src emacs-lisp
(use-feature compile
:commands (compile recompile)
:custom (compilation-scroll-output 'first-error)
:config
(defun +compilation-colorize ()
"Colorize from `compilation-filter-start' to `point'."
(require 'ansi-color)
(let ((inhibit-read-only t))
(ansi-color-apply-on-region (point-min) (point-max))))
(add-hook 'compilation-filter-hook #'+compilation-colorize))
#+end_src
** General Emacs Settings
These are my overall emacs settings. More settings could be moved here. Though
keep the loading order in mind when doing so.
#+begin_src emacs-lisp
(use-feature emacs
:demand t
:config
(epa-file-enable)
(setq epg-pinentry-mode 'loopback)
(setq epa-file-encrypt-to '("xulfer@cheapbsd.net"))
:custom
(scroll-conservatively 101 "Scroll just enough to bring text into view")
(enable-recursive-minibuffers t "Allow minibuffer commands in minibuffer")
(frame-title-format '(buffer-file-name "%f" ("%b"))
"Make frame title current file's name.")
(find-library-include-other-files nil)
(indent-tabs-mode nil "Use spaces, not tabs")
(inhibit-startup-screen t)
(history-delete-duplicates t "Don't clutter history")
(pgtk-use-im-context-on-new-connection nil "Prevent GTK from stealing Shift + Space")
(sentence-end-double-space nil "Double space sentence demarcation breaks sentence navigation in Evil")
(tab-stop-list (number-sequence 2 120 2))
(tab-width 2 "Shorter tab widths")
(completion-styles '(flex basic partial-completion emacs22))
(report-emacs-bug-no-explanations t)
(report-emacs-bug-no-confirmation t)
(setq shr-use-xwidgets-for-media t))
#+end_src
** Diffs
I have a slight tweak to diff output here. Mainly making the diff horizontally
split by default.
#+begin_src emacs-lisp
(use-feature ediff
:defer t
:custom
(ediff-window-setup-function #'ediff-setup-windows-plain)
(ediff-split-window-function #'split-window-horizontally)
:config
(add-hook 'ediff-quit-hook #'winner-undo))
#+end_src
** Minibuffer
The minibuffer is already pretty well sorted by other packages that will be
discussed later. However, there is still a bit of tidying that can be done
with long paths, and some helpful file based completion.
#+begin_src emacs-lisp
(use-feature minibuffer
:custom (read-file-name-completion-ignore-case t)
:config
(defun +minibuffer-up-dir ()
"Trim rightmost directory component of `minibuffer-contents'."
(interactive)
(unless (minibufferp) (user-error "Minibuffer not selected"))
(let* ((f (directory-file-name (minibuffer-contents)))
(s (file-name-directory f)))
(delete-minibuffer-contents)
(when s (insert s))))
(define-key minibuffer-local-filename-completion-map
(kbd "C-h") #'+minibuffer-up-dir)
(minibuffer-depth-indicate-mode))
#+end_src
** Remote Editing
There are a lot of solutions for editing files, and projects remotely. At the moment
[[https://www.gnu.org/software/tramp/][tramp]] still seems to work perfectly well... albeit somewhat slower than I'd like.
#+begin_src emacs-lisp
(use-feature tramp
:config
;; Enable full-featured Dirvish over TRAMP on ssh connections
;; https://www.gnu.org/software/tramp/#Improving-performance-of-asynchronous-remote-processes
(connection-local-set-profile-variables
'remote-direct-async-process
'((tramp-direct-async-process . t)))
(connection-local-set-profiles
'(:application tramp :protocol "ssh")
'remote-direct-async-process)
;; Tips to speed up connections
(setq tramp-verbose 0)
(setq tramp-chunksize 2000)
(setq tramp-ssh-controlmaster-options nil))
#+end_src

14
config/path.org Normal file
View File

@@ -0,0 +1,14 @@
* Path
Rather than having to manage potential paths in the configuration I'll use the
[[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] package. This pulls in =$PATH= from various different shells
and operating systems. At least BSD, Linux, and MacOS are supported anyway.
#+BEGIN_SRC emacs-lisp
(use-package exec-path-from-shell
:ensure t
:config
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize)))
#+end_src

12
config/profiling.org Normal file
View File

@@ -0,0 +1,12 @@
* Profiling
Sometimes if I experience slow start times I've found [[https://github.com/jschaf/esup][esup]] does this quickly and
without having to quit Emacs.
#+begin_src emacs-lisp
(use-package esup
:ensure t
:config
(setq esup-depth 0))
#+end_src

17
config/tidy.org Normal file
View File

@@ -0,0 +1,17 @@
* Keeping things tidy
I'd like to keep all of my configuration, and emacs files in one place. I've found
the [[https://github.com/emacscollective/no-littering][no-littering]] package does this well. This keeps everything under the .emacs.d
directory rather than littering $HOME.
#+begin_src emacs-lisp
(use-package no-littering
:ensure t
:config
(no-littering-theme-backups)
(let ((dir (no-littering-expand-var-file-name "lock-files/")))
(make-directory dir t)
(setq lock-file-name-transforms `((".*" ,dir t))))
(setq custom-file (expand-file-name "custom.el" user-emacs-directory)))
#+end_src