unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Oleh Krehel <ohwoeowho@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: 20100@debbugs.gnu.org
Subject: bug#20100: 24.4.91; Can't scroll a window while in minibuffer
Date: Fri, 13 Mar 2015 18:10:09 +0100	[thread overview]
Message-ID: <CAA01p3pAn2sx+yxV=E+VS22VgvsynNRUgkJrcrqnPCpjWvfiow@mail.gmail.com> (raw)
In-Reply-To: <5503171C.4070704@gmx.at>

Hi Martin,

On Fri, Mar 13, 2015 at 5:58 PM, martin rudalics <rudalics@gmx.at> wrote:
>> 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"?

You need to be in the minibuffer in order for the effect to occur,
which you're not.

See my question on Emacs Stack Exchange for a simple way to reproduce the issue:
http://emacs.stackexchange.com/questions/9967/how-to-scroll-another-buffer-while-in-minibuffer

However, what I'm actually trying to do is here:
https://raw.githubusercontent.com/abo-abo/swiper/master/ivy.el

> 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.

It is selected, only the minibufer is interfering.

>> 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'.

`set-window-start' doesn't work. The issue is that the scroll
happended and visibly the window start has changed, but `window-start`
still returns the old value.

> 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.

Thanks, I might get to that eventually, I just wanted to hear the
expert opinion, maybe this is a
known problem. My current work-around for re-computing the changed
`window-start' and `window-end'
is to call `forward-line' with the window height parameter.

Oleh





  reply	other threads:[~2015-03-13 17:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13 12:51 bug#20100: 24.4.91; Can't scroll a window while in minibuffer Oleh Krehel
2015-03-13 16:58 ` martin rudalics
2015-03-13 17:10   ` Oleh Krehel [this message]
2015-03-13 18:16     ` martin rudalics
2015-03-13 18:41       ` Oleh Krehel
2015-03-13 20:58         ` Eli Zaretskii
2015-03-14  8:17         ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA01p3pAn2sx+yxV=E+VS22VgvsynNRUgkJrcrqnPCpjWvfiow@mail.gmail.com' \
    --to=ohwoeowho@gmail.com \
    --cc=20100@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).