GNU bug report logs -
#20100
24.4.91; Can't scroll a window while in minibuffer
Previous Next
Reported by: Oleh Krehel <ohwoeowho <at> gmail.com>
Date: Fri, 13 Mar 2015 12:57:02 UTC
Severity: normal
Found in version 24.4.91
Done: martin rudalics <rudalics <at> gmx.at>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 20100 <at> debbugs.gnu.org (full text, mbox):
> I'm trying to write a completion package using `read-from-minibuffer'
> combined with `post-command-hook'.
>
> Everything is working OK, except when I want to sync the current
> completion candidate (one of buffer's lines) with the corresponding line
> in the buffer.
>
> This code, specifically `recenter', doesn't work:
>
> (with-current-buffer buf
> (goto-char (point-min))
> (forward-line (1- num))
> (recenter))
I suppose that at the time you invoke `recenter', the selected window
doesn't show `buf'. When with emacs -Q I do
(let ((buffer (get-buffer-create "*buffer*"))
(line 0))
(set-window-buffer nil buffer)
(with-current-buffer buffer
(while (< line 100)
(insert (format "%02d\n" line))
(setq line (1+ line))))
(with-current-buffer buffer
(goto-char (point-min))
(forward-line 25)
(recenter)))
then I see the line starting with "25" centered in the selected window.
Can you try modifying my example such that it "doesn't work for you"?
> However, this code will scroll the window (`buf' and `wnd' correspond to
> each other):
>
> (with-current-buffer buf
> (goto-char (point-min))
> (forward-line (1- num))
> (setf (window-point wnd)
> (point)))
The fact that you apparently have to
(setf (window-point wnd) (point))
seems to suport my claim above, namely that `wnd' is not selected at
that time.
> Still, it's not a perfect solution, since even after setting
> `window-point', (window-start wnd) and (window-end wnd t) will not
> return the correct thing.
What is the wrong thing and what would the correct thing be? The only
function that should work "correctly" here is `set-window-start'.
> I'm pretty sure it's a bug and the code above should work as is, but I'd
> also appreciate pointers for achieving the scrolling and window bounds
> re-calculation for the current Emacs.
Beyond what you can read in the documentations, explaining `recenter' is
hardly possible without explaining redisplay as well. You have to look
at its implementation.
martin
This bug report was last modified 10 years and 90 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.