From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.bugs Subject: bug#22404: 25.1.50; Forcing `window-scroll-functions` to run. Date: Tue, 19 Jan 2016 10:49:57 -0800 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by - "") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1453229483 8970 80.91.229.3 (19 Jan 2016 18:51:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Jan 2016 18:51:23 +0000 (UTC) Cc: 22404@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 19 19:51:12 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 1aLbMz-0004qA-I6 for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Jan 2016 19:51:09 +0100 Original-Received: from localhost ([::1]:38826 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLbMz-0002pD-22 for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Jan 2016 13:51:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36489) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLbMv-0002p6-4b for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2016 13:51:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLbMr-0003lB-TB for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2016 13:51:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLbMr-0003l7-Pq for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2016 13:51:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aLbMr-0002xk-IH for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2016 13:51:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Keith David Bershatsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Jan 2016 18:51: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.145322940711313 (code B ref 22404); Tue, 19 Jan 2016 18:51:01 +0000 Original-Received: (at 22404) by debbugs.gnu.org; 19 Jan 2016 18:50:07 +0000 Original-Received: from localhost ([127.0.0.1]:54020 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aLbLy-0002wP-OU for submit@debbugs.gnu.org; Tue, 19 Jan 2016 13:50:06 -0500 Original-Received: from cobb.liquidweb.com ([50.28.13.150]:58777) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aLbLx-0002vr-9T for 22404@debbugs.gnu.org; Tue, 19 Jan 2016 13:50:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date; bh=j4P4Vyr+ukMFLelPeE4RIvGFS/MVdd+kjr9FwJRv8o8=; b=7qzhJan5WZezTtCE1O0IEVrSyjjfLgLIBPlASX4ewxOv7Si+ZcV7V9CGmPAVjZMtwTqKQRjE3vYfTlzWQnPozWEgWAFcDaTv/UqG/9By+gfyt76oFws47YvPX5PwT79S; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:50137 helo=server.local.localhost) by cobb.liquidweb.com with esmtp (Exim 4.82) (envelope-from ) id 1aLbLo-0002OE-3u; Tue, 19 Jan 2016 13:49:56 -0500 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cobb.liquidweb.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-Get-Message-Sender-Via: cobb.liquidweb.com: acl_c_relayhosts_text_entry: lawlist|lawlist.com 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:111761 Archived-At: Thank you, Eli, for taking a look at this feature request. The post-command-hook ("PCH") is only sufficient to return the correct window-start and window-end when no scrolling occurs. If I attach a function to the PCH that places overlays, then I would need to know programmatically with 100% certainty whether the window-scroll-functions ("WSF") will be running one or more times subsequent to the PCH. If the WSF will be running one or more times subsequent to the PCH, then I want to programmatically *prevent* overlays from being placed with the PCH -- i.e., so that they can instead be placed by the WSF. If the WSF will run more than once, then I want to wait until the last time it runs to place my overlays -- i.e., because start/end have changed since the first time WSF ran. E.g., point was partially visible and redisplay brings it into full vi ew. I was not able to come up with a 100% reliable test from the PCH that tells me whether WSF will be running one or more times subsequent thereto. So, I am using the following work-around to force the WSF to run all the time. The problem remaining is that I still need a reliable test to determine whether the WSF will be running more than once, so that I can delay my overlay function until the last call. The feature request is essentially: trigger WSF (similar to set-window-buffer), but there is no need to set-window-buffer and there is no need to run the window-configuration-change-hook. If there is any way you can think of to programmatically know with 100% certainty whether the WSF will be running more than one time, your help would be greatly appreciated. (setq scroll-conservatively 101) (defun pch-fn () (let ((window-configuration-change-hook nil)) (set-window-buffer (selected-window) (current-buffer) 'keep-margins))) (add-hook 'post-command-hook 'pch-fn nil 'local) (defun wsf-fn (win start) (message "win: %s | start: %s | end: %s" win start (window-end win t))) (add-hook 'window-scroll-functions 'wsf-fn nil 'local) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; At Tue, 19 Jan 2016 19:50:08 +0200, Eli Zaretskii wrote: > > * * * > > 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.