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 <gusbrs.2016@gmail.com>
https://orgmode.org/list/87tv3a56vv.fsf@gmail.com
This commit is contained in:
Kyle Meyer 2020-06-27 01:03:02 +00:00
parent f471768a54
commit 591ea3eafb
1 changed files with 4 additions and 2 deletions

View File

@ -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))))