Skip to content

Conversation

JDNdeveloper
Copy link
Contributor

Fixes #893, see issue for details.

JDNdeveloper and others added 4 commits June 6, 2025 13:52
* gptel.el (gptel-auto-scroll): Move run-at-time to the "outside"
of the scroll command, to capture the condition-case.
@karthink
Copy link
Owner

karthink commented Jun 6, 2025

Using run-at-time in the condition case makes the let binding and the condition-case ineffective, since it then runs at top level.

I moved the whole function into the run-at-time, but I'm not sure if this works as intended either. Could you test the latest version and let me know?

@JDNdeveloper
Copy link
Contributor Author

Unfortunately that doesn't work correctly, the check of (point) needs to occur within the excursion otherwise it will just remain where the user's cursor is and not detect the inserted text has scrolled off the page. I tried this as well, but it didn't work either:

...
  (when-let* ((win (get-buffer-window (current-buffer) 'visible))
              ((not (pos-visible-in-window-p (point) win))))
    (run-at-time
     0 nil
     (lambda ()
       (condition-case nil
           (let ((scroll-error-top-bottom t))
             (when (window-live-p win)
               (with-selected-window win
                 (scroll-up-command))))
         (error nil))))))

@JDNdeveloper JDNdeveloper deleted the fix-auto-scroll branch August 9, 2025 10:49
@JDNdeveloper JDNdeveloper restored the fix-auto-scroll branch August 9, 2025 10:49
@JDNdeveloper JDNdeveloper reopened this Aug 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gptel-auto-scroll doesn't work at end of buffer

2 participants