From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleh Krehel Newsgroups: gmane.emacs.bugs Subject: bug#20100: 24.4.91; Can't scroll a window while in minibuffer Date: Fri, 13 Mar 2015 18:10:09 +0100 Message-ID: References: <87h9tp6ox3.fsf@gmail.com> <5503171C.4070704@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1426266692 9595 80.91.229.3 (13 Mar 2015 17:11:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Mar 2015 17:11:32 +0000 (UTC) Cc: 20100@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 13 18:11:19 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YWT7D-0005fn-Qg for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Mar 2015 18:11:16 +0100 Original-Received: from localhost ([::1]:37772 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWT7D-0001n4-6E for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Mar 2015 13:11:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWT77-0001lK-NO for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2015 13:11:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWT70-0006zt-I2 for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2015 13:11:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46761) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWT70-0006zX-Eu for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2015 13:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YWT6z-0005SW-Te for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2015 13:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Oleh Krehel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Mar 2015 17:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20100 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20100-submit@debbugs.gnu.org id=B20100.142626661820921 (code B ref 20100); Fri, 13 Mar 2015 17:11:01 +0000 Original-Received: (at 20100) by debbugs.gnu.org; 13 Mar 2015 17:10:18 +0000 Original-Received: from localhost ([127.0.0.1]:45329 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWT6H-0005RM-9R for submit@debbugs.gnu.org; Fri, 13 Mar 2015 13:10:17 -0400 Original-Received: from mail-we0-f169.google.com ([74.125.82.169]:34943) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWT6E-0005R7-Vv for 20100@debbugs.gnu.org; Fri, 13 Mar 2015 13:10:15 -0400 Original-Received: by wesw55 with SMTP id w55so24692572wes.2 for <20100@debbugs.gnu.org>; Fri, 13 Mar 2015 10:10:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=J58w3kNSAP/eATiFBtY2TTCQ4ebesiErSw6Xw+ZsYXg=; b=XM+YB0U4XXzweAyUEgxvQGfIeLyxVrvXW4ZT/jkTO3pt/PjOjRkq3rNfmcPkrBzekR rsNRb6+r3Wcb6Tp1Mxpn7rzjXw7azyz8xxgBJefs4aWNkJJoHvN6noNyfdd7+Zsaj6jV Izf4GK2+tMFIZM4feVd5dw63j7CujgC21r9AfLoXMAarBUdHONPvuBp/Zxo8a58/3P1v +cf+40k0BANS+qxE/b+MuoQiU4npFykOggAQ0p81tfOfii8iHV5NrCLu/c4ySFQ/rfA8 AtEgAEeKhUcvsd7iiwoPc15zKgcPveekHmW9lDpJRHQL66+bpk9s/xrq2M65DezOHmSi b5lQ== X-Received: by 10.194.63.172 with SMTP id h12mr97228873wjs.48.1426266609434; Fri, 13 Mar 2015 10:10:09 -0700 (PDT) Original-Received: by 10.27.215.194 with HTTP; Fri, 13 Mar 2015 10:10:09 -0700 (PDT) In-Reply-To: <5503171C.4070704@gmx.at> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:100447 Archived-At: Hi Martin, On Fri, Mar 13, 2015 at 5:58 PM, martin rudalics 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