From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#22404: 25.1.50; Forcing `window-scroll-functions` to run. Date: Thu, 21 Jan 2016 22:28:05 +0200 Message-ID: <8337tq8yp6.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1453408161 6616 80.91.229.3 (21 Jan 2016 20:29:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Jan 2016 20:29:21 +0000 (UTC) Cc: 22404@debbugs.gnu.org To: Keith David Bershatsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 21 21:29:10 2016 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 1aMLqv-0004Tt-8Q for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Jan 2016 21:29:09 +0100 Original-Received: from localhost ([::1]:49633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMLqu-0007HZ-DG for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Jan 2016 15:29:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMLqr-0007HP-EY for bug-gnu-emacs@gnu.org; Thu, 21 Jan 2016 15:29:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMLqo-0006iI-76 for bug-gnu-emacs@gnu.org; Thu, 21 Jan 2016 15:29:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40272) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMLqo-0006iE-3A for bug-gnu-emacs@gnu.org; Thu, 21 Jan 2016 15:29:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aMLqn-0008W7-Ui for bug-gnu-emacs@gnu.org; Thu, 21 Jan 2016 15:29:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Jan 2016 20:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22404 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22404-submit@debbugs.gnu.org id=B22404.145340808232648 (code B ref 22404); Thu, 21 Jan 2016 20:29:01 +0000 Original-Received: (at 22404) by debbugs.gnu.org; 21 Jan 2016 20:28:02 +0000 Original-Received: from localhost ([127.0.0.1]:56725 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aMLpq-0008US-1Y for submit@debbugs.gnu.org; Thu, 21 Jan 2016 15:28:02 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:55252) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aMLpo-0008U4-AB for 22404@debbugs.gnu.org; Thu, 21 Jan 2016 15:28:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMLpf-0006e6-W9 for 22404@debbugs.gnu.org; Thu, 21 Jan 2016 15:27:55 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMLpf-0006e2-SX; Thu, 21 Jan 2016 15:27:51 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4577 helo=HOME-C4E4A596F7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aMLpe-0005rv-P6; Thu, 21 Jan 2016 15:27:51 -0500 In-reply-to: (message from Keith David Bershatsky on Thu, 21 Jan 2016 11:54:30 -0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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:111834 Archived-At: > Date: Thu, 21 Jan 2016 11:54:30 -0800 > From: Keith David Bershatsky > Cc: 22404@debbugs.gnu.org > > The calculations (primarily because of `vertical-motion`) are too costly time-wise to perform more than once during each command loop because it slows down performance. > > If I run the calculations from the `post-command-hook`, I will have wasted precious time IF the `window-scroll-functions` hook will be running. IF the `window-scroll-functions` hook will be running, then the `window-start` and `window-end` obtained from the `post-command-hook` will be wrong -- so there is no point using those PCH wrong numbers. > > If I run the calculations from the INITIAL run of the `window-scroll-functions` hook, I will have wasted precious time IF the WSF hook will be running a SECOND time. [WSF runs a SECOND time if point was PARTIALLY visible.] IF the WSF will be running more than one time, then the INITIAL values for `window-start` and `window-end` will be wrong -- so there is no point using those WSF wrong numbers. Instead, I have to wait until the LAST call on the WSF when the final correct values for `window-start` and `window-end` can be truly ascertained. > > Without the benefit of feature request 22404, there are a couple of options that are not ideal. What do you need from window-scroll-functions? Only the correct values of window-start and window-end? Or something else? The other thing I still don't understand is how forcing window-scroll-functions to run could fix your problem or _avoiding_ extra calculations. Where and under what conditions would you call the function that forces Emacs to run window-scroll-functions? Doesn't that waste processing in those cases where normally window-scroll-functions didn't need to be run (because window-start and window-end don't change)? IOW, aren't you running those costly calculations from window-scroll-functions? Finally, wouldn't running from pre-command-hook solve the problem? The values of window-start and window-end are known by then, and you can record the old values to compare them against new, to know when they change. No?