diff options
| author | Craig Jennings <c@cjennings.net> | 2025-08-14 19:24:49 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-08-14 19:24:49 -0500 |
| commit | 9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (patch) | |
| tree | 1105519cd55a4ebbb1e91609e6aae7cc3929ddaf /modules/chrono-tools.el | |
| parent | a878e5ae99f750ecbbb723f98ef91d3404189a32 (diff) | |
| download | dotemacs-9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b.tar.gz dotemacs-9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b.zip | |
refactor(system-utils): major refactoring / adding tests
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.
Diffstat (limited to 'modules/chrono-tools.el')
| -rw-r--r-- | modules/chrono-tools.el | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/modules/chrono-tools.el b/modules/chrono-tools.el new file mode 100644 index 00000000..ae0592f8 --- /dev/null +++ b/modules/chrono-tools.el @@ -0,0 +1,62 @@ +;;; chrono-tools.el --- Config for Date and Time-Related Utils -*- lexical-binding: t; -*- +;; author Craig Jennings <c@cjennings.net> +;;; Commentary: +;; +;; This module centralizes configuration for Emacs time-related tools: +;; +;; – world-clock: predefined city list and custom time format +;; – calendar: quick navigation keybindings by day, month, and year +;; – tmr: lightweight timer setup with sounds, notifications, and history +;; +;;; Code: + +(use-package time + :ensure nil ;; built-in + :defer 0.5 + :bind ("C-x c" . world-clock) + :config + (setq world-clock-list + '(("Pacific/Honolulu" " Honolulu") + ("America/Los_Angeles" " San Francisco, LA") + ("America/Chicago" " Chicago, New Orleans") + ("America/New_York" " New York, Boston") + ("Etc/UTC" " UTC =================") + ("Europe/London" " London, Lisbon") + ("Europe/Paris" " Paris, Berlin, Rome") + ("Europe/Athens" " Athens, Istanbul, Moscow") + ("Asia/Kolkata" " India") + ("Asia/Shanghai" " Shanghai, Singapore") + ("Asia/Tokyo" " Tokyo, Seoul"))) + (setq world-clock-time-format " %a, %d %b @ %I:%M %p %Z")) + +(use-package calendar + :ensure nil ;; built-in + :defer 0.5 + :bind (("M-#" . calendar) + :map calendar-mode-map + ("," . calendar-backward-day) + ("." . calendar-forward-day) + ("<" . calendar-backward-month) + (">" . calendar-forward-month) + ("M-," . calendar-backward-year) + ("M-." . calendar-forward-year))) + +(use-package tmr + :defer 0.5 + :bind ("M-t" . tmr-prefix-map) + :config + (setq tmr-sound-file "/usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga" + tmr-notification-urgency 'normal + tmr-descriptions-list 'tmr-description-history)) + + +(provide 'chrono-tools) +;;; chrono-tools.el ends here. + +;; --------------------------------- ERT Tests --------------------------------- +;; Run these tests with M-x ert RET t RET + +(ert-deftest chrono-tools/tmr-sound-file-exists () + "Test that `tmr-sound-file` points to an existing file." + (require 'tmr) + (should (file-exists-p tmr-sound-file))) |
