From c3bc1954b7b0427b2ab9f7563c960841c1410a55 Mon Sep 17 00:00:00 2001 Message-ID: From: Ihor Radchenko Date: Sat, 11 Jan 2025 15:33:31 +0100 Subject: [PATCH] org-agenda-later: Avoid scrolling the window past point * lisp/org-agenda.el (org-agenda-later): When previous agenda buffer is larger and its scroll position is beyond point position in the new agenda buffer, do not try to restore scroll state. (Doing otherwise, scrolls past the point, leading to unpredictable results - depending on `scroll-conservatively'. Reported-by: Michael Heerdegen Link: https://orgmode.org/list/87ttadqati.fsf@web.de --- lisp/org-agenda.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 884b9de782..2bab159795 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -8789,7 +8789,8 @@ (defun org-agenda-later (arg) (list (car args) sd span))) (org-agenda-redo) (org-agenda-find-same-or-today-or-agenda cnt)) - (set-window-start nil wstart))) + (unless (< (point) wstart) ; do no scroll past the point + (set-window-start nil wstart)))) (defun org-agenda-earlier (arg) "Go backward in time by the current span in the agenda buffer. -- 2.47.1