From 312d7598385d6cd620e88852c9e47f74fc759c23 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 5 Nov 2025 01:00:38 -0600 Subject: feat: Configure scratch buffer for org-mode with cursor at end - Set initial-major-mode to org-mode for *scratch* buffer - Add emacs-startup-hook to position cursor at end of buffer - Update greeting message comment syntax from ;; to # for org-mode - Re-enable debug flag reset on startup in early-init.el This makes the scratch buffer immediately ready for org-mode note-taking with cursor positioned for typing, eliminating manual mode switching and cursor movement. --- docs/NOTES.org | 34 ++++++++++++++++++++++++++++++++++ early-init.el | 8 ++++---- modules/system-utils.el | 13 +++++++++++-- 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/docs/NOTES.org b/docs/NOTES.org index a9913bfac..f04d03d07 100644 --- a/docs/NOTES.org +++ b/docs/NOTES.org @@ -515,6 +515,40 @@ If Craig or Claude need more context: ** 🚀 Current Session Notes +*** 2025-11-05 Session 2 - Scratch Buffer Configuration +*Time:* ~5 minutes +*Status:* ✅ COMPLETE - Scratch buffer opens in org-mode with cursor at end + +*Problem:* +- Scratch buffer opened in lisp-interaction-mode +- Cursor positioned at beginning of buffer +- Craig wanted org-mode with cursor ready to type at end + +*Solution:* +1. **Set scratch buffer to org-mode** - `(setopt initial-major-mode 'org-mode)` +2. **Move cursor to end on startup** - Added `emacs-startup-hook` to position cursor +3. **Updated comment syntax** - Changed `;;` to `#` in greeting messages for org-mode + +*Files Modified:* +- modules/system-utils.el:186-203 + - Added `initial-major-mode` configuration + - Added startup hook for cursor positioning + - Updated greeting message comment syntax for org-mode compatibility + +*Technical Details:* +- Used `emacs-startup-hook` to run after init completes +- Buffer name check ensures we only affect *scratch* buffer +- Greeting message now uses org-mode comment syntax (#) + +*Testing:* +- Configuration updated in modules/system-utils.el:197-203 +- Requires restart or eval-buffer to take effect + +*Next Steps:* +- Restart Emacs or evaluate modules/system-utils.el +- Verify scratch buffer opens in org-mode +- Verify cursor positioned at end of buffer + *** 2025-11-05 Session 1 - Fix Google Calendar Password Prompts *Time:* ~15 minutes *Status:* ✅ COMPLETE - Fixed irritating password prompts every 10 minutes diff --git a/early-init.el b/early-init.el index 6fa3e0b2a..c1cd54c8b 100644 --- a/early-init.el +++ b/early-init.el @@ -51,10 +51,10 @@ (setq debug-on-error t) ;; default nil. turn on to debug issues only. (setq debug-on-quit t) ;; debug on C-g (breaking out of hangs/freezes) -;; (add-hook 'emacs-startup-hook -;; (lambda () -;; (setq debug-on-error nil) -;; (setq debug-on-quit nil))) +(add-hook 'emacs-startup-hook + (lambda () + (setq debug-on-error nil) + (setq debug-on-quit nil))) ;; ------------------------------ Bug Workarounds ------------------------------ diff --git a/modules/system-utils.el b/modules/system-utils.el index 2b39d8625..e96867771 100644 --- a/modules/system-utils.el +++ b/modules/system-utils.el @@ -186,13 +186,22 @@ Logs output and exit code to buffer *external-open.log*." ;;; -------------------------- Scratch Buffer Happiness ------------------------- (defvar scratch-emacs-version-and-system - (concat ";; Emacs " emacs-version + (concat "# Emacs " emacs-version " on " system-configuration ".\n")) (defvar scratch-greet - (concat ";; Emacs ♥ you, " user-login-name ". Happy Hacking!\n\n")) + (concat "# Emacs ♥ you, " user-login-name ". Happy Hacking!\n\n")) (setopt initial-scratch-message (concat scratch-emacs-version-and-system scratch-greet)) +;; Set scratch buffer to org-mode +(setopt initial-major-mode 'org-mode) + +;; Move cursor to end of scratch buffer on startup +(add-hook 'emacs-startup-hook + (lambda () + (when (string= (buffer-name) "*scratch*") + (goto-char (point-max))))) + ;;; --------------------------------- Dictionary -------------------------------- (use-package quick-sdcv -- cgit v1.2.3