aboutsummaryrefslogtreecommitdiff
path: root/modules/user-constants.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-11-14 01:53:30 -0600
committerCraig Jennings <c@cjennings.net>2025-11-14 01:53:30 -0600
commit48d9f1e416a6327c7d27c4501651ed1410c53e96 (patch)
treebd96a430d6ab23df17e885786b291ede173ed60f /modules/user-constants.el
parent53b17cc1ad453de3d245456cb421d7615cac1d30 (diff)
downloaddotemacs-48d9f1e416a6327c7d27c4501651ed1410c53e96.tar.gz
dotemacs-48d9f1e416a6327c7d27c4501651ed1410c53e96.zip
feat(ui): Add buffer modification state to color indicators
Change modeline filename and cursor colors to indicate buffer modification status, not just read-only/overwrite state. Color scheme changes: - White (#ffffff): Unmodified writeable buffer - Green (#64aa0f): Modified writeable buffer (unsaved changes) - Red (#f06a3f): Read-only buffer - Gold (#c48702): Overwrite mode active Previously: All writeable buffers were green regardless of modification Now: White when clean, green when dirty (better visual feedback) Implementation: - Updated cj/buffer-status-colors in user-constants.el: - Changed 'normal' → 'unmodified' (white) - Added new 'modified' state (green) - Updated state detection in modeline-config.el: - Now checks (buffer-modified-p) before defaulting to unmodified - Updated cursor color logic in ui-config.el: - Same state detection as modeline for consistency - Added after-change-functions hook for real-time updates - Added after-save-hook to update on save Priority order (highest to lowest): 1. Read-only (red) - takes precedence over everything 2. Overwrite mode (gold) - takes precedence over modified state 3. Modified (green) - buffer has unsaved changes 4. Unmodified (white) - default for clean writeable buffers Tests: - 18 comprehensive tests in test-ui-buffer-status-colors.el - Tests state detection logic and priority order - Tests color constant definitions and mappings - Tests integration with cursor and modeline - All tests passing
Diffstat (limited to 'modules/user-constants.el')
-rw-r--r--modules/user-constants.el7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/user-constants.el b/modules/user-constants.el
index 2a6d0ca2b..eafd08e8f 100644
--- a/modules/user-constants.el
+++ b/modules/user-constants.el
@@ -41,9 +41,10 @@ Example: (setq cj/debug-modules '(org-agenda mail))
;; ---------------------------- Buffer Status Colors ---------------------------
(defconst cj/buffer-status-colors
- '((read-only . "#f06a3f") ; red – buffer is read-only
- (overwrite . "#c48702") ; gold – overwrite mode
- (normal . "#64aa0f")) ; green – insert & read/write
+ '((read-only . "#f06a3f") ; red – buffer is read-only
+ (overwrite . "#c48702") ; gold – overwrite mode
+ (modified . "#64aa0f") ; green – modified & writeable
+ (unmodified . "#ffffff")) ; white – unmodified & writeable
"Alist mapping buffer states to their colors.
Used by cursor color, modeline, and other UI elements.")