From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#20100: 24.4.91; Can't scroll a window while in minibuffer Date: Fri, 13 Mar 2015 17:58:04 +0100 Message-ID: <5503171C.4070704@gmx.at> References: <87h9tp6ox3.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1426266037 30713 80.91.229.3 (13 Mar 2015 17:00:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Mar 2015 17:00:37 +0000 (UTC) To: Oleh Krehel , 20100@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 13 18:00:25 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 1YWSva-000423-Ru for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Mar 2015 17:59:15 +0100 Original-Received: from localhost ([::1]:37731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWSva-0004fW-Ey for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Mar 2015 12:59:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWSvS-0004Zu-6Z for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2015 12:59:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWSvO-0001Cg-S8 for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2015 12:59:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46757) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWSvO-0001CZ-Li for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2015 12:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YWSvO-00058Q-Cm for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2015 12:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Mar 2015 16:59:02 +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.142626589419659 (code B ref 20100); Fri, 13 Mar 2015 16:59:02 +0000 Original-Received: (at 20100) by debbugs.gnu.org; 13 Mar 2015 16:58:14 +0000 Original-Received: from localhost ([127.0.0.1]:45324 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWSub-000570-PR for submit@debbugs.gnu.org; Fri, 13 Mar 2015 12:58:14 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:56288) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWSua-00056Z-4S for 20100@debbugs.gnu.org; Fri, 13 Mar 2015 12:58:12 -0400 Original-Received: from [88.117.51.199] ([88.117.51.199]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0MCxfb-1YeTGg41DP-009jTe; Fri, 13 Mar 2015 17:58:06 +0100 In-Reply-To: <87h9tp6ox3.fsf@gmail.com> X-Provags-ID: V03:K0:D6o7OOSdIrMzFCUkUewxLAnt7ZpAmhv+fGpOUENfzFAGpVVSaPv Gam2EgqJBkUojE0/NGE6aQsIHbMq+1n1Aa+0qFp8z/6w+WuZ9SKA6q2l06pVDgVek6ojPAp rgOgrhog/trGd7c+j4Oph4NlM1+r3o7HEtsXdF0hb3kCIuT63irAQum0rqrOCXuj0eIPjGn G3bMiDHJKSC4F/TOmC2Bg== X-UI-Out-Filterresults: notjunk:1; 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:100446 Archived-At: > 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