diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-18 20:56:18 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-18 20:56:18 -0500 |
| commit | a8aa91a257796695d0fbbf471e90bd4ea74c70a8 (patch) | |
| tree | bb3bf51e5f0e0e95efad7feb39cb4606b99bdc13 /modules | |
| parent | 5cca052ceafd635ac6be54e3e1d90b55e3dc25aa (diff) | |
| download | dotemacs-a8aa91a257796695d0fbbf471e90bd4ea74c70a8.tar.gz dotemacs-a8aa91a257796695d0fbbf471e90bd4ea74c70a8.zip | |
refactor(ui): remove buffer-state coloring of the buffer name
The modeline colored the buffer name by write and modification state (red read-only, green modified, gold overwrite) through a classifier in user-constants.el. I removed it, the same way the matching cursor coloring was removed earlier for being more confusing than useful. The classifier had no other live user, so it and its two test files go with it. The buffer name now renders in the normal mode-line color.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/modeline-config.el | 8 | ||||
| -rw-r--r-- | modules/ui-config.el | 7 | ||||
| -rw-r--r-- | modules/user-constants.el | 41 |
3 files changed, 5 insertions, 51 deletions
diff --git a/modules/modeline-config.el b/modules/modeline-config.el index f6b8ef4eb..d669425d3 100644 --- a/modules/modeline-config.el +++ b/modules/modeline-config.el @@ -15,7 +15,6 @@ ;; No external packages = no buffer issues, no native-comp errors. ;; Features: -;; - Buffer status (modified, read-only) ;; - Buffer name ;; - Major mode ;; - Version control status @@ -75,11 +74,9 @@ Example: `my-very-long-name.el' → `my-ver...me.el'" ;; -------------------------- Modeline Segments -------------------------------- (defvar-local cj/modeline-buffer-name - '(:eval (let* ((color (cj/buffer-status-color (cj/buffer-status-state))) - (name (buffer-name)) + '(:eval (let* ((name (buffer-name)) (truncated-name (cj/modeline-string-cut-middle name))) (propertize truncated-name - 'face `(:foreground ,color) 'mouse-face 'mode-line-highlight 'help-echo (concat name "\n" @@ -89,8 +86,7 @@ Example: `my-very-long-name.el' → `my-ver...me.el'" (define-key map [mode-line mouse-1] 'previous-buffer) (define-key map [mode-line mouse-3] 'next-buffer) map)))) - "Buffer name colored by modification and read-only status. -White = unmodified, Green = modified, Red = read-only, Gold = overwrite. + "Buffer name in the mode line. Truncates in narrow windows. Click to switch buffers.") (defvar-local cj/modeline-position diff --git a/modules/ui-config.el b/modules/ui-config.el index 05448b3c5..32bd393f5 100644 --- a/modules/ui-config.el +++ b/modules/ui-config.el @@ -94,10 +94,9 @@ When `cj/enable-transparency' is nil, reset alpha to fully opaque." (if cj/enable-transparency "enabled" "disabled"))) ;; ----------------------------------- Cursor ---------------------------------- -;; The cursor uses the theme's cursor face. Buffer-state cursor coloring was -;; removed -- a cursor that changed color by buffer state was confusing. The -;; cj/buffer-status-state / cj/buffer-status-color classifier stays in -;; user-constants.el; the modeline buffer-name indicator still uses it. +;; The cursor uses the theme's cursor face. Buffer-state coloring (both the +;; cursor and the modeline buffer-name) was removed -- changing color by buffer +;; write state was more confusing than useful. ;; Don’t show a cursor in non-selected windows: (setq cursor-in-non-selected-windows nil) diff --git a/modules/user-constants.el b/modules/user-constants.el index 1ee8ecda3..dab12dcbe 100644 --- a/modules/user-constants.el +++ b/modules/user-constants.el @@ -53,47 +53,6 @@ mail, chime, etc." (defvar user-mail-address "c@cjennings.net" "The user's email address.") -;; ---------------------------- Buffer Status Colors --------------------------- - -(defconst cj/buffer-status-faces - '((read-only . error) ; can't edit - (overwrite . warning) ; overwrite mode - (modified . warning) ; writeable, with unsaved changes - (unmodified . success)) ; clean and writeable - "Alist mapping a buffer state to the theme face whose foreground colors it. -Shared by the cursor color (ui-config.el) and the modeline buffer-status -indicator (modeline-config.el) so the two stay in sync and follow the active -theme, rather than hard-coding hex colors.") - -(defun cj/buffer-status-state () - "Return the buffer-state symbol for the current buffer. -One of `read-only', `overwrite', `modified', or `unmodified' -- the keys of -`cj/buffer-status-faces'. - -A live ghostel terminal (in `ghostel-mode' and an input mode that forwards keys --- semi-char / char / line) reports `unmodified' even though the buffer is -read-only: keystrokes go to the terminal process, so from the user's side it is -writeable and the read-only state would be misleading. ghostel's `copy' and -`emacs' input modes are the exception -- there the buffer really is a read-only -Emacs buffer the user navigates, so it falls through to `read-only'." - (cond - ((and (eq major-mode 'ghostel-mode) - (not (memq (bound-and-true-p ghostel--input-mode) '(copy emacs)))) - 'unmodified) - (buffer-read-only 'read-only) - (overwrite-mode 'overwrite) - ((buffer-modified-p) 'modified) - (t 'unmodified))) - -(defun cj/buffer-status-color (state) - "Return the foreground color of the theme face mapped to buffer STATE. -Resolves STATE through `cj/buffer-status-faces' against the active theme. Nil -when the state is unknown or its face has no concrete foreground (face-attribute -returns the symbol `unspecified' there), so callers can skip cleanly." - (when-let* ((face (alist-get state cj/buffer-status-faces)) - (fg (face-attribute face :foreground nil t))) - (and (stringp fg) fg))) - ;; --------------------------- Media File Extensions --------------------------- (defvar cj/audio-file-extensions |
