From unknown Sat Jun 21 17:32:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20100: 24.4.91; Can't scroll a window while in minibuffer Resent-From: Oleh Krehel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Mar 2015 12:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20100 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 20100@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.142625138015917 (code B ref -1); Fri, 13 Mar 2015 12:57:02 +0000 Received: (at submit) by debbugs.gnu.org; 13 Mar 2015 12:56:20 +0000 Received: from localhost ([127.0.0.1]:44615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWP8V-00048b-3o for submit@debbugs.gnu.org; Fri, 13 Mar 2015 08:56:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35318) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWP8O-00048C-Kj for submit@debbugs.gnu.org; Fri, 13 Mar 2015 08:56:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWP8I-0002rk-9a for submit@debbugs.gnu.org; Fri, 13 Mar 2015 08:56:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:51984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWP8I-0002rg-7a for submit@debbugs.gnu.org; Fri, 13 Mar 2015 08:56:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWP8G-0005Di-Oy for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2015 08:56:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWP8D-0002qZ-2m for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2015 08:56:04 -0400 Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]:39729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWP8C-0002qP-TP for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2015 08:56:01 -0400 Received: by wiwl15 with SMTP id l15so5914864wiw.4 for ; Fri, 13 Mar 2015 05:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=WT5LzJt1jX+0WcduCOucIE7rAUdJbaNMuEFMOcp2v30=; b=qvfNFCCK9E5HGJ/HJB+uHq5gwukqTTsvU9YAUTMlSvPvvC3zhLMXGAJSuy1HMz7dDU R2LFOFjB4hC5jjbYGD4dszUCQtoZx44Okb0uJHEmWtqsNrgQAo9SR35bUE0jhOmnl+cs lIFL2Jp0qqlWZHcFe1qKcjqFThRi8mzL7MvCnxysUu3DANqOanTkAAaU9Hqduuk8uXbv pjBkM4rLGoIPVdot4flFwZ8Rdq2FZETZsAZhobor9Egl16fV5M41toVr9YKIv9mVHawh 07SI9q9yZrb6hP5s6AYes0f5bHDfuk/M10oD/PvZERFWh1tGIXvM98dR+baA9WlTJyNV 2PkQ== X-Received: by 10.194.86.135 with SMTP id p7mr98331034wjz.89.1426251359683; Fri, 13 Mar 2015 05:55:59 -0700 (PDT) Received: from firefly (dyn069045.nbw.tue.nl. [131.155.69.45]) by mx.google.com with ESMTPSA id vv9sm2694744wjc.35.2015.03.13.05.55.59 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Mar 2015 05:55:59 -0700 (PDT) From: Oleh Krehel Date: Fri, 13 Mar 2015 13:51:36 +0100 Message-ID: <87h9tp6ox3.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) 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)) 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))) 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. 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. regards, Oleh From unknown Sat Jun 21 17:32:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20100: 24.4.91; Can't scroll a window while in minibuffer 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: To: Oleh Krehel , 20100@debbugs.gnu.org Received: via spool by 20100-submit@debbugs.gnu.org id=B20100.142626589419659 (code B ref 20100); Fri, 13 Mar 2015 16:59:02 +0000 Received: (at 20100) by debbugs.gnu.org; 13 Mar 2015 16:58:14 +0000 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 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 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 Message-ID: <5503171C.4070704@gmx.at> Date: Fri, 13 Mar 2015 17:58:04 +0100 From: martin rudalics MIME-Version: 1.0 References: <87h9tp6ox3.fsf@gmail.com> In-Reply-To: <87h9tp6ox3.fsf@gmail.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit 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-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > 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 From unknown Sat Jun 21 17:32:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20100: 24.4.91; Can't scroll a window while in minibuffer 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: To: martin rudalics Cc: 20100@debbugs.gnu.org Received: via spool by 20100-submit@debbugs.gnu.org id=B20100.142626661820921 (code B ref 20100); Fri, 13 Mar 2015 17:11:01 +0000 Received: (at 20100) by debbugs.gnu.org; 13 Mar 2015 17:10:18 +0000 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 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 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== MIME-Version: 1.0 X-Received: by 10.194.63.172 with SMTP id h12mr97228873wjs.48.1426266609434; Fri, 13 Mar 2015 10:10:09 -0700 (PDT) Received: by 10.27.215.194 with HTTP; Fri, 13 Mar 2015 10:10:09 -0700 (PDT) In-Reply-To: <5503171C.4070704@gmx.at> References: <87h9tp6ox3.fsf@gmail.com> <5503171C.4070704@gmx.at> Date: Fri, 13 Mar 2015 18:10:09 +0100 Message-ID: From: Oleh Krehel Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) 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 From unknown Sat Jun 21 17:32:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20100: 24.4.91; Can't scroll a window while in minibuffer Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Mar 2015 18:17: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: To: Oleh Krehel Cc: 20100@debbugs.gnu.org Received: via spool by 20100-submit@debbugs.gnu.org id=B20100.142627060428010 (code B ref 20100); Fri, 13 Mar 2015 18:17:02 +0000 Received: (at 20100) by debbugs.gnu.org; 13 Mar 2015 18:16:44 +0000 Received: from localhost ([127.0.0.1]:45422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWU8a-0007Hh-5A for submit@debbugs.gnu.org; Fri, 13 Mar 2015 14:16:44 -0400 Received: from mout.gmx.net ([212.227.17.21]:53797) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWU8Y-0007HU-Af for 20100@debbugs.gnu.org; Fri, 13 Mar 2015 14:16:42 -0400 Received: from [88.117.51.199] ([88.117.51.199]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0LiY3U-1Z97D53NPw-00ci4j; Fri, 13 Mar 2015 19:16:35 +0100 Message-ID: <55032996.3080008@gmx.at> Date: Fri, 13 Mar 2015 19:16:54 +0100 From: martin rudalics MIME-Version: 1.0 References: <87h9tp6ox3.fsf@gmail.com> <5503171C.4070704@gmx.at> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:xHV5HXxPNGIvGETJSKWvObQMfppb19hQobOoOVlP4Hit+SVVb2H xLEx05DFLUr+wEHgDfDhTLXnKLvb105BUjN9eSagfmC5gWCzx/MASDWGHnfmXACIAxIKOV/ /gRCvgy+Be6l9cfap3EFsSZm+oEYwGoRtQYf4rOcR+wPwEI+qLTY98Mq4ZsGtG5poCivOa/ gUbOwIWbL715QFVTm/9SQ== X-UI-Out-Filterresults: notjunk:1; X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > You need to be in the minibuffer in order for the effect to occur, > which you're not. I know but you didn't give a recipe. >> 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. It apparently is _not_ selected (at least not in your snippet). With emacs -Q evaluate the following code: (let ((buffer (get-buffer-create "*buffer*")) (window (selected-window)) (line 0)) (set-window-buffer nil buffer) (with-current-buffer buffer (while (< line 100) (insert (format "%02d\n" line)) (setq line (1+ line)))) (with-selected-window (minibuffer-window) (with-selected-window window (goto-char (point-min)) (forward-line 25) (recenter)) (insert "This is your minibuffer window!") (sit-for 5))) Can you see the difference? martin From unknown Sat Jun 21 17:32:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20100: 24.4.91; Can't scroll a window while in minibuffer Resent-From: Oleh Krehel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Mar 2015 18:42: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: To: martin rudalics Cc: 20100@debbugs.gnu.org Received: via spool by 20100-submit@debbugs.gnu.org id=B20100.14262721083748 (code B ref 20100); Fri, 13 Mar 2015 18:42:02 +0000 Received: (at 20100) by debbugs.gnu.org; 13 Mar 2015 18:41:48 +0000 Received: from localhost ([127.0.0.1]:45433 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWUWp-0000yO-AN for submit@debbugs.gnu.org; Fri, 13 Mar 2015 14:41:47 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:46445) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWUWm-0000y2-G7 for 20100@debbugs.gnu.org; Fri, 13 Mar 2015 14:41:45 -0400 Received: by wiwh11 with SMTP id h11so8231098wiw.5 for <20100@debbugs.gnu.org>; Fri, 13 Mar 2015 11:41:38 -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=Lf2s43ypMXnM6OqO0QM0paboZSISSqnnWtzxckTiM50=; b=DzR3ambfqyiU+DfQiR7tLapfPLpY5nhgeYwEKt8/qJ/2T3mlzv860VbeeXEWMy9QVC BUoy9PdKvAHok053861vsN1eYjyuRKkNLEJqxn02MmmVGqhUq1Ts9k2q7J2Oc9q23xPh zJbSc2x+M8sbJ7QHo7KgJW5JCsZUIuhdJA4SzPUbOiMt0i14jlvwrIFhaGCyBf6xDGc2 YxyWEYn5V+WMFlraxNRns6xMoB8Ew4u/d5uiGd1B93XUgMFU7Fah7MqiN5FC9/L2QjXH 5cyjcDHsmuX2lEjAATIEB30+Tu4WNu3aOGpQyVpyEaYJl7mm+DmB/SVcuWZKLGpvdykz KukQ== MIME-Version: 1.0 X-Received: by 10.180.77.19 with SMTP id o19mr77495501wiw.90.1426272098812; Fri, 13 Mar 2015 11:41:38 -0700 (PDT) Received: by 10.27.215.194 with HTTP; Fri, 13 Mar 2015 11:41:38 -0700 (PDT) In-Reply-To: <55032996.3080008@gmx.at> References: <87h9tp6ox3.fsf@gmail.com> <5503171C.4070704@gmx.at> <55032996.3080008@gmx.at> Date: Fri, 13 Mar 2015 19:41:38 +0100 Message-ID: From: Oleh Krehel Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) > It apparently is _not_ selected (at least not in your snippet). With > emacs -Q evaluate the following code: > > (let ((buffer (get-buffer-create "*buffer*")) > (window (selected-window)) > (line 0)) > (set-window-buffer nil buffer) > (with-current-buffer buffer > (while (< line 100) > (insert (format "%02d\n" line)) > (setq line (1+ line)))) > > (with-selected-window (minibuffer-window) > (with-selected-window window > (goto-char (point-min)) > (forward-line 25) > (recenter)) > (insert "This is your minibuffer window!") > (sit-for 5))) > > Can you see the difference? Thanks, using `with-selected-window' instead of `with-current-buffer' solved it. I thought that they should be equivalent. Apparently they are not. So the problem is solved, thanks again. Oleh From unknown Sat Jun 21 17:32:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20100: 24.4.91; Can't scroll a window while in minibuffer Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Mar 2015 20: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: To: Oleh Krehel Cc: rudalics@gmx.at, 20100@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 20100-submit@debbugs.gnu.org id=B20100.142628031420330 (code B ref 20100); Fri, 13 Mar 2015 20:59:02 +0000 Received: (at 20100) by debbugs.gnu.org; 13 Mar 2015 20:58:34 +0000 Received: from localhost ([127.0.0.1]:45481 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWWfB-0005Hp-Tm for submit@debbugs.gnu.org; Fri, 13 Mar 2015 16:58:34 -0400 Received: from mtaout26.012.net.il ([80.179.55.182]:56499) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWWf8-0005HR-KK for 20100@debbugs.gnu.org; Fri, 13 Mar 2015 16:58:31 -0400 Received: from conversion-daemon.mtaout26.012.net.il by mtaout26.012.net.il (HyperSendmail v2007.08) id <0NL600N004QAWG00@mtaout26.012.net.il> for 20100@debbugs.gnu.org; Fri, 13 Mar 2015 22:59:05 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout26.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NL600E9A4YDOO80@mtaout26.012.net.il>; Fri, 13 Mar 2015 22:59:05 +0200 (IST) Date: Fri, 13 Mar 2015 22:58:18 +0200 From: Eli Zaretskii In-reply-to: X-012-Sender: halo1@inter.net.il Message-id: <83fv983991.fsf@gnu.org> References: <87h9tp6ox3.fsf@gmail.com> <5503171C.4070704@gmx.at> <55032996.3080008@gmx.at> X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > Date: Fri, 13 Mar 2015 19:41:38 +0100 > From: Oleh Krehel > Cc: 20100@debbugs.gnu.org > > Thanks, using `with-selected-window' instead of `with-current-buffer' > solved it. I thought that they should be equivalent. Apparently they are not. with-current-buffer makes the buffer current for the purposes of editing, but not for the purposes of redisplay. By contrast, 'recenter' needs a window to do its job, so it must have the buffer selected in the current window. From unknown Sat Jun 21 17:32:01 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Oleh Krehel Subject: bug#20100: closed (Re: bug#20100: 24.4.91; Can't scroll a window while in minibuffer) Message-ID: References: <5503EE80.8030400@gmx.at> <87h9tp6ox3.fsf@gmail.com> X-Gnu-PR-Message: they-closed 20100 X-Gnu-PR-Package: emacs Reply-To: 20100@debbugs.gnu.org Date: Sat, 14 Mar 2015 08:18:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1426321082-27154-1" This is a multi-part message in MIME format... ------------=_1426321082-27154-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #20100: 24.4.91; Can't scroll a window while in minibuffer which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 20100@debbugs.gnu.org. --=20 20100: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D20100 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1426321082-27154-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 20100-done) by debbugs.gnu.org; 14 Mar 2015 08:17:19 +0000 Received: from localhost ([127.0.0.1]:45641 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWhG3-000735-Be for submit@debbugs.gnu.org; Sat, 14 Mar 2015 04:17:19 -0400 Received: from mout.gmx.net ([212.227.17.22]:57241) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWhG0-00072w-FQ for 20100-done@debbugs.gnu.org; Sat, 14 Mar 2015 04:17:17 -0400 Received: from [91.113.6.194] ([91.113.6.194]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0Maa3B-1Yq90y2F0T-00KAMk; Sat, 14 Mar 2015 09:17:13 +0100 Message-ID: <5503EE80.8030400@gmx.at> Date: Sat, 14 Mar 2015 09:17:04 +0100 From: martin rudalics MIME-Version: 1.0 To: Oleh Krehel Subject: Re: bug#20100: 24.4.91; Can't scroll a window while in minibuffer References: <87h9tp6ox3.fsf@gmail.com> <5503171C.4070704@gmx.at> <55032996.3080008@gmx.at> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:YaUrqJ2uc+XvcdKCOxeA6JJzcssf/NZU6qbhkfRHV6x7bhhQqgQ k8zRGUmZyHWmBdGf4+fRRrJcBd7b8DaDpo9upAGr39RSGDAnOJUDt5Y2y6kMj3nQTEGgLNu p6iLsfTkkoj0eHYuRAuNa3DDkfwrgxKJ/7TgGuarq4S56/jOJ+p6c1RxU0xzQTZG24xYG7+ eO4vjgMSJUhHEWTSigGVA== X-UI-Out-Filterresults: notjunk:1; X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20100-done Cc: 20100-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > Thanks, using `with-selected-window' instead of `with-current-buffer' > solved it. I thought that they should be equivalent. Apparently they are not. It's a trap. Commands that implicitly work on the selected window should not be used programmatically. Such commands are `recenter', `enlarge-window', `shrink-window', `split-window-below' and `split-window-right'. When used in applications the only way to make them behave is to wrap them in `with-selected-window' :-( There are also more specialized commands like `recenter-top-bottom' or `move-to-window-line-top-bottom' whose doc-strings don't explain what they do. Never use them in programs! martin, closing this bug ------------=_1426321082-27154-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 13 Mar 2015 12:56:20 +0000 Received: from localhost ([127.0.0.1]:44615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWP8V-00048b-3o for submit@debbugs.gnu.org; Fri, 13 Mar 2015 08:56:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35318) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YWP8O-00048C-Kj for submit@debbugs.gnu.org; Fri, 13 Mar 2015 08:56:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWP8I-0002rk-9a for submit@debbugs.gnu.org; Fri, 13 Mar 2015 08:56:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:51984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWP8I-0002rg-7a for submit@debbugs.gnu.org; Fri, 13 Mar 2015 08:56:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWP8G-0005Di-Oy for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2015 08:56:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWP8D-0002qZ-2m for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2015 08:56:04 -0400 Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]:39729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWP8C-0002qP-TP for bug-gnu-emacs@gnu.org; Fri, 13 Mar 2015 08:56:01 -0400 Received: by wiwl15 with SMTP id l15so5914864wiw.4 for ; Fri, 13 Mar 2015 05:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=WT5LzJt1jX+0WcduCOucIE7rAUdJbaNMuEFMOcp2v30=; b=qvfNFCCK9E5HGJ/HJB+uHq5gwukqTTsvU9YAUTMlSvPvvC3zhLMXGAJSuy1HMz7dDU R2LFOFjB4hC5jjbYGD4dszUCQtoZx44Okb0uJHEmWtqsNrgQAo9SR35bUE0jhOmnl+cs lIFL2Jp0qqlWZHcFe1qKcjqFThRi8mzL7MvCnxysUu3DANqOanTkAAaU9Hqduuk8uXbv pjBkM4rLGoIPVdot4flFwZ8Rdq2FZETZsAZhobor9Egl16fV5M41toVr9YKIv9mVHawh 07SI9q9yZrb6hP5s6AYes0f5bHDfuk/M10oD/PvZERFWh1tGIXvM98dR+baA9WlTJyNV 2PkQ== X-Received: by 10.194.86.135 with SMTP id p7mr98331034wjz.89.1426251359683; Fri, 13 Mar 2015 05:55:59 -0700 (PDT) Received: from firefly (dyn069045.nbw.tue.nl. [131.155.69.45]) by mx.google.com with ESMTPSA id vv9sm2694744wjc.35.2015.03.13.05.55.59 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Mar 2015 05:55:59 -0700 (PDT) From: Oleh Krehel To: bug-gnu-emacs@gnu.org Subject: 24.4.91; Can't scroll a window while in minibuffer Date: Fri, 13 Mar 2015 13:51:36 +0100 Message-ID: <87h9tp6ox3.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) 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)) 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))) 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. 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. regards, Oleh ------------=_1426321082-27154-1--