[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] ox: Prevent dispatcher from starting in scrolled window
From: |
Kyle Meyer |
Subject: |
[PATCH] ox: Prevent dispatcher from starting in scrolled window |
Date: |
Sat, 27 Jun 2020 01:03:02 +0000 |
Gustavo Barros writes:
> On Tue, Jun 09 2020 at 01:48, Kyle Meyer <kyle@kyleam.com> wrote:
>
>> I've tried to trigger it with your minimal configuration and haven't
>> observed the displacement you describe, even when making my frame
>> height
>> very small.
>
> I was afraid there might be things in the environment which could affect
> this (DE? distro? monitor size? Emacs configure options? I don't know),
> but it does reproduce every single time for me with the recipe I
> provided.
I've managed to trigger it now. Your picture gave me the hint that
maybe my "making my frame height very small" wasn't the thing to do.
Plus I should have realized that the default-frame-alist in your minimal
configuration probably isn't going to matter on my end because I use a
tiling window manager. So here's what I could trigger it:
(setq scroll-margin 1) ; or anything > 0
(setq display-buffer-base-action '(display-buffer-at-bottom))
For reasons I don't really understand, if I make my frame height small
(say half my computer screen) the issue goes away.
Anyway, I'm able to resolve the issues I see with this patch. Can you
confirm that it fixes things on your end?
-- >8 --
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 <gusbrs.2016@gmail.com>
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 @@ (defun org-export--dispatch-ui (options first-key
expertp)
(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))))
base-commit: f471768a54d8921ff383516af6a605adc061af30
--
2.26.2