aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-20 22:23:29 -0400
committerCraig Jennings <c@cjennings.net>2026-05-20 22:23:29 -0400
commit68bbeb2fab607b7cb1842d7b3ae27741ffc14630 (patch)
treed966a1003a3f245fe04c26175649789b7e849770 /modules
parent0a8d8c1e3615262089ad531582792c48d2be95bb (diff)
downloaddotemacs-68bbeb2fab607b7cb1842d7b3ae27741ffc14630.tar.gz
dotemacs-68bbeb2fab607b7cb1842d7b3ae27741ffc14630.zip
fix(dashboard): trim padding newlines and reset window-start on open
The dashboard often opened already scrolled: content sat partly above the visible window with empty lines stranded at the bottom. There were two causes. The startupify list inserted five padding newlines that pushed the content past one screenful, and cj/dashboard-only moved point to point-min without resetting window-start, so a previously-scrolled view leaked into the next display. I trimmed the padding to one newline after the banner title and one before the items, and added a set-window-start to point-min in cj/dashboard-only so the view always starts at the top. A characterization test locks the window-start reset.
Diffstat (limited to 'modules')
-rw-r--r--modules/dashboard-config.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/dashboard-config.el b/modules/dashboard-config.el
index 93477b48c..cb97a076d 100644
--- a/modules/dashboard-config.el
+++ b/modules/dashboard-config.el
@@ -60,7 +60,10 @@ Adjust this if the title doesn't appear centered under the banner image.")
;; convenience function to redisplay dashboard and kill all other windows
(defun cj/dashboard-only ()
- "Switch to *dashboard* buffer, kill other buffers and windows, go to top."
+ "Switch to *dashboard* buffer, kill other buffers and windows, go to top.
+Reset `window-start' alongside point so a previously-scrolled view
+doesn't leak into this display when the buffer is taller than the
+window."
(interactive)
(if (get-buffer "*dashboard*")
(progn
@@ -68,7 +71,8 @@ Adjust this if the title doesn't appear centered under the banner image.")
(cj/kill-all-other-buffers-and-windows))
(when (fboundp 'dashboard-open)
(dashboard-open)))
- (goto-char (point-min)))
+ (goto-char (point-min))
+ (set-window-start (selected-window) (point-min)))
;; --------------------------------- Dashboard ---------------------------------
;; a useful startup screen for Emacs
@@ -93,13 +97,10 @@ Adjust this if the title doesn't appear centered under the banner image.")
'(dashboard-insert-banner
dashboard-insert-banner-title
dashboard-insert-newline
- dashboard-insert-newline
dashboard-insert-navigator
;; dashboard-insert-init-info ; Disabled: package count and startup time
dashboard-insert-newline
- dashboard-insert-newline
- dashboard-insert-items
- dashboard-insert-newline))
+ dashboard-insert-items))
:config
;; == general