From 9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 14 Aug 2025 19:24:49 -0500 Subject: refactor(system-utils): major refactoring / adding tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Theme: Modularize system-utilities into separate modules. Clean up any typos, buts, and unused variables. Add some initial ERT tests for new modules created. Changes: - Extract file handling into its own module (file-config) - Extract keyboard macro management into its own module (keyboard-macros) - Extract buffer burying (instead of killing) into its own module (undead-buffers) - Extract all date/time config into its own module (chrono-tools) - Moved keybinding discovery functionality and help into keybindings module - Combine flyspell and abbrev (spell-check and autocorrect) to flyspell-and-abbrev.el - Rename epa-config.el to auth-config.el for auth-source and epa settings. - Refactor `cj/kill-other-window` for more accurate buffer handling. - Include "*ert*" in the default bury (don't kill) list as killing it kills test runs. - Bind C-c M-m to inhibit-mouse-mode - Remove the unused ledger-file variable in user-constants.el. - Removed obsolete C-x x m, C-x x r, and C-x x d key mappings. - C-; b r to call cj/rename-buffer-and-file instead of typo’d function - Other purely cosmetic comment changes to system-utils.el ERT tests: - Rename ERT test definitions to include module scopes (file-config, keyboard-macros) - Add an ERT test for the timer bell's existence. - Add ERT tests to cover `cj/kill-buffer-or-bury-alive`, prefix-arg behavior, window-killing commands, and bulk operations. - Add test `authinfo-file` exists Missing authinfo triggers a debug message - Add test that `gpg2` executable is on the user’s PATH - Remove outdated authinfo test. - Add “Run these tests” note where missing. --- modules/custom-functions.el | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'modules/custom-functions.el') diff --git a/modules/custom-functions.el b/modules/custom-functions.el index efc2d4e20..846475cbf 100644 --- a/modules/custom-functions.el +++ b/modules/custom-functions.el @@ -548,7 +548,6 @@ Uses `sortable-time-format' for the formatting the date/time." (message "Buffer '%s' is not visiting a file!" name) (progn (copy-file filename newname 1) (delete-file filename) (set-visited-file-name newname) (set-buffer-modified-p nil) t)))) -(global-set-key (kbd "C-x x m") 'cj/move-buffer-and-file) ;; RENAME BUFFER + FILE (defun cj/rename-buffer-and-file (new-name) @@ -566,8 +565,7 @@ Uses `sortable-time-format' for the formatting the date/time." (rename-file filename new-name 1) (rename-buffer new-name) (set-visited-file-name new-name) - (set-buffer-modified-p nil)))))) -(global-set-key (kbd "C-x x r") 'cj/rename-buffer-and-file) + (set-buffer-modified-p nil)))))) ;; DELETE BUFFER + FILE (defun cj/delete-buffer-and-file () @@ -581,7 +579,6 @@ Uses `sortable-time-format' for the formatting the date/time." (delete-file filename t) (message "Deleted file %s" filename) (kill-buffer)))))) -(global-set-key (kbd "C-x x d") 'cj/delete-buffer-and-file) ;; ------------------------------- Ordinal Suffix ------------------------------ ;; add the proper ordinal to a number (e.g., 1st, 2nd, 3rd, 4th). @@ -656,7 +653,7 @@ Uses `sortable-time-format' for the formatting the date/time." (global-set-key (kbd "C-; i t") 'cj/insert-sortable-time) (global-set-key (kbd "C-; i d") 'cj/insert-sortable-date) ;; buffer and file operations -(global-set-key (kbd "C-; b r") 'cj/renameq-buffer-and-file) +(global-set-key (kbd "C-; b r") 'cj/rename-buffer-and-file) (global-set-key (kbd "C-; b d") 'cj/delete-buffer-and-file) (global-set-key (kbd "C-; b m") 'cj/move-buffer-and-file) ;; copy link to source file -- cgit v1.2.3