Re: [PATCH] ox: Prevent dispatcher from starting in scrolled window

2020-09-04 Thread Bastien
Kyle Meyer  writes:

> Thanks for confirming.  Pushed (591ea3eaf).

Thanks!  Closing this on https://updates.orgmode.org.

-- 
 Bastien



Re: [PATCH] ox: Prevent dispatcher from starting in scrolled window

2020-06-26 Thread Kyle Meyer
Gustavo Barros writes:

> And I'm glad to confirm the patch fixes things on my end for the recipe 
> provided in the report.  Same as you, I don't fully understand the 
> interactions which trigger the issue, so I can only claim that "I can no 
> longer reproduce".  Which is great, of course.  But, as far as I 
> understand, the patch makes sense to me.
>
> Thank you very much for sticking with me and finding a fix.

Thanks for confirming.  Pushed (591ea3eaf).



Re: [PATCH] ox: Prevent dispatcher from starting in scrolled window

2020-06-26 Thread Gustavo Barros

Hi Kyle,

On Fri, 26 Jun 2020 at 22:03, Kyle Meyer  wrote:



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?



Nice that you could find a way to trigger it too.  Indeed, that was a 
tricky one to pin down.


And I'm glad to confirm the patch fixes things on my end for the recipe 
provided in the report.  Same as you, I don't fully understand the 
interactions which trigger the issue, so I can only claim that "I can no 
longer reproduce".  Which is great, of course.  But, as far as I 
understand, the patch makes sense to me.


Thank you very much for sticking with me and finding a fix.

Best,
Gustavo.




[PATCH] ox: Prevent dispatcher from starting in scrolled window

2020-06-26 Thread Kyle Meyer
Gustavo Barros writes:

> On Tue, Jun 09 2020 at 01:48, Kyle Meyer  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 
https://orgmode.org/list/87tv3a56vv@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