From b520add37ae23f0411e2c6512fe6b8d7418bd525 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 4 Nov 2025 17:23:50 -0600 Subject: fix: Resolve async buffer error and improve modeline spacing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed critical "Selecting deleted buffer" error on startup - wttrin-mode-line-mode now activates after init completes - Uses after-init-hook to prevent async buffer deletion - Weather widget loads safely after Emacs finishes initializing - Improved modeline right-side spacing - Added 2 non-breaking spaces after misc-info segment - Prevents weather icon from appearing flush with edge - Non-breaking spaces survive right-align trimming 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- docs/NOTES.org | 39 ++++++++++++++++++++++++++++++++++++++- modules/modeline-config.el | 3 ++- modules/weather-config.el | 25 ++++++++++++++++++++++++- 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/docs/NOTES.org b/docs/NOTES.org index 30243dc5..7de74826 100644 --- a/docs/NOTES.org +++ b/docs/NOTES.org @@ -484,7 +484,44 @@ If Craig or Claude need more context: ** 🚀 Current Session Notes -*** 2025-11-04 Session - Complete Transcription Workflow Implementation +*** 2025-11-04 Session 2 - Emergency Bug Fixes & Modeline Polish +*Time:* ~30 minutes +*Status:* ✅ COMPLETE - Fixed async buffer error and improved modeline spacing + +*What We Completed:* + +1. ✅ **Fixed Critical Async Buffer Error on Startup** + - Problem: "Selecting deleted buffer" error in async.el during init + - Root cause: wttrin-mode-line-mode starting async HTTP request during init + - Solution: Delayed activation using after-init-hook + - Weather widget now loads AFTER Emacs finishes initializing + - Prevents async buffer from being killed before request completes + +2. ✅ **Fixed Parenthesis Error in weather-config.el** + - Removed extra closing parenthesis that prevented file from loading + - Verified with check-parens + +3. ✅ **Improved Modeline Right-Side Spacing** + - Problem: Right-most icon (weather) appeared flush with window edge + - Discovered: Regular spaces were being trimmed by right-align mechanism + - Solution: Added 2 non-breaking spaces (U+00A0) after misc-info segment + - Provides visual breathing room without being excessive + +*Key Technical Insights:* +- Async operations during init need careful timing (use after-init-hook) +- mode-line-right-align-edge 'right-margin trims trailing regular spaces +- Non-breaking spaces (U+00A0) survive trimming in modeline format + +*Files Modified:* +- modules/weather-config.el - Added after-init-hook delay for mode-line widget +- modules/modeline-config.el - Added 2 non-breaking spaces at end + +*Status:* +- Emacs launches without errors ✅ +- Weather widget appears in modeline after startup ✅ +- Modeline spacing looks clean and professional ✅ + +*** 2025-11-04 Session 1 - Complete Transcription Workflow Implementation *Time:* ~3 hours *Status:* ✅ COMPLETE - Full async transcription system with 60 passing tests diff --git a/modules/modeline-config.el b/modules/modeline-config.el index 140d21cd..b1403539 100644 --- a/modules/modeline-config.el +++ b/modules/modeline-config.el @@ -156,7 +156,8 @@ Shows only in active window.") mode-line-format-right-align cj/modeline-vc-branch " " - cj/modeline-misc-info)) + cj/modeline-misc-info + " ")) ;; Mark all segments as risky-local-variable (required for :eval forms) (dolist (construct '(cj/modeline-buffer-name diff --git a/modules/weather-config.el b/modules/weather-config.el index 31fb1b70..55eddf16 100644 --- a/modules/weather-config.el +++ b/modules/weather-config.el @@ -10,8 +10,15 @@ ;; ----------------------------------- Wttrin ---------------------------------- +;; Load wttrin from local development directory +(add-to-list 'load-path "/home/cjennings/code/wttrin") + +;; Set debug flag BEFORE loading wttrin (checked at load time) +(setq wttrin-debug t) + (use-package wttrin - :vc (:url "https://github.com/cjennings/emacs-wttrin" :rev :newest) + ;; Uncomment the next line to use vc-install instead of local directory: + ;; :vc (:url "https://github.com/cjennings/emacs-wttrin" :rev :newest) :defer t :preface ;; dependency for wttrin @@ -21,6 +28,22 @@ ("M-W" . wttrin) :custom (wttrin-unit-system "u") + (wttrin-mode-line-favorite-location "New Orleans, LA") + (wttrin-mode-line-refresh-interval 900) ; 15 minutes + :init + ;; Explicitly autoload the mode function (needed for local dev directory) + (autoload 'wttrin-mode-line-mode "wttrin" "Toggle weather display in mode-line." t) + ;; Enable mode-line widget AFTER Emacs finishes initializing + ;; (url-retrieve async needs full init to work without buffer errors) + (if (daemonp) + ;; Daemon mode: wait for first client to connect + (add-hook 'server-after-make-frame-hook + (lambda () (wttrin-mode-line-mode 1)) + t) ; append to end of hook + ;; Normal Emacs: wait for startup to complete + (add-hook 'after-init-hook + (lambda () (wttrin-mode-line-mode 1)) + t)) ; append to end of hook :config (setq wttrin-default-locations '( "New Orleans, LA" -- cgit v1.2.3