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: Tue, 19 Jan 2016 19:50:08 +0200 Message-ID: <83mvs1bgrz.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1453225916 12834 80.91.229.3 (19 Jan 2016 17:51:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Jan 2016 17:51:56 +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 Tue Jan 19 18:51:46 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 1aLaRP-0002Ls-Lh for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Jan 2016 18:51:39 +0100 Original-Received: from localhost ([::1]:38607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLaRP-0007xe-0L for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Jan 2016 12:51:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLaQs-0007KH-Lr for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2016 12:51:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLaQo-0004Rk-DT for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2016 12:51:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLaQo-0004Rg-9h for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2016 12:51:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aLaQo-0005qY-5C for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2016 12:51:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Jan 2016 17:51:02 +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.145322581222410 (code B ref 22404); Tue, 19 Jan 2016 17:51:02 +0000 Original-Received: (at 22404) by debbugs.gnu.org; 19 Jan 2016 17:50:12 +0000 Original-Received: from localhost ([127.0.0.1]:53965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aLaPz-0005pN-So for submit@debbugs.gnu.org; Tue, 19 Jan 2016 12:50:12 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54370) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aLaPy-0005p9-56 for 22404@debbugs.gnu.org; Tue, 19 Jan 2016 12:50:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLaPo-0003nJ-In for 22404@debbugs.gnu.org; Tue, 19 Jan 2016 12:50:04 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34647) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLaPo-0003nF-Fg; Tue, 19 Jan 2016 12:50:00 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2245 helo=HOME-C4E4A596F7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aLaPn-00052N-Rc; Tue, 19 Jan 2016 12:50:00 -0500 In-reply-to: (message from Keith David Bershatsky on Mon, 18 Jan 2016 21:49:40 -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:111754 Archived-At: > Date: Mon, 18 Jan 2016 21:49:40 -0800 > From: Keith David Bershatsky > > As a feature request, please consider adding an alternative method to force the `window-scroll-functions` hook to run -- but NOT more than it would normally run. [In other words, it shouldn't run 3 times.] I only found `(set-window-buffer (selected-window) (current-buffer))` as a viable means to achieve this goal. `run-window-scroll-functions` runs immediately and is not a viable substitute for this feature request. Some users may not wish to `set-window-buffer` or run the `window-configuration-change-hook` to achieve this feature request. > > In my particular use case, I want to run a custom function only one time per command loop that is dependent upon the new `window-start` and `window-end`, which is only reliably available to the user after the `post-command-hook` has run its course. My function is too costly time-wise to run more than once each command loop. I have tried, to no avail, to come up with a test to ascertain with 100% accuracy (from the `post-command-hook`) to guess whether the `window-scroll-functions` hook will run and/or whether it will run more than one time (e.g., when cursor/point is partially visible). I played around with `(pos-visible-in-window-p nil nil t)` and whether it returned a length of 0, 2 or 6 -- however, from the `post-command-hook`, that is insufficient to ascertain with 100% accuracy w hether the `window-scroll-functions` hook will run once or twice or not at all. The solution, I believe, is to force the `window-scroll-functions` hook to run during every redisplay -- but not more than it would normally run. > > In other words, I want the `window-scroll-functions` hook to run every command loop when my custom minor-mode is active -- or twice if point/cursor is only partially visible (at the bottom of the window) and needs to be moved up a smidgen by redisplay. > > Background: my custom function is a cross-hairs created with overlays that works with `word-wrap` -- the vertical line is XPM that matches the character and color underneath. Can you please tell more details about the problem you have? I;ve read this description several times, and couldn't figure out why are you having problems. For example, why can't you run your function from the post-command-hook directly? If you want it to run after all the hook functions finished, you can use the APPEND argument to add-hook, right? Or if the above somehow doesn't work, what about pre-command-hook? And those are just 2 random thoughts that went through my head while I was reading your request. Thanks.