From 591ea3eafb91be2ece88162107f024044df00a10 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 27 Jun 2020 01:03:02 +0000 Subject: [PATCH] ox: Prevent dispatcher from starting in scrolled window * lisp/ox.el (org-export--dispatch-ui): Restore buffer position after inserting text to avoid auto-scrolling at start. When filling in the dispatch buffer, point ends up at the end of the buffer, which can cause the buffer to be re-centered on point when org-fit-window-to-buffer is called, in particular if scroll-margin is above zero and there is a vertical split. Avoid this by putting point where it was before the buffer was refreshed. Reported-by: Gustavo Barros https://orgmode.org/list/87tv3a56vv.fsf@gmail.com --- lisp/ox.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index 869164737..456dd9bef 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -6878,10 +6878,12 @@ back to standard interface." (with-current-buffer "*Org Export Dispatcher*" ;; Refresh help. Maintain display continuity by re-visiting ;; previous window position. - (let ((pos (window-start))) + (let ((pt (point)) + (wstart (window-start))) (erase-buffer) (insert help) - (set-window-start nil pos))) + (goto-char pt) + (set-window-start nil wstart))) (org-fit-window-to-buffer) (org-export--dispatch-action standard-prompt allowed-keys entries options first-key expertp))))