bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22404: 25.1.50; Forcing `window-scroll-functions` to run.


From: Keith David Bershatsky
Subject: bug#22404: 25.1.50; Forcing `window-scroll-functions` to run.
Date: Tue, 19 Jan 2016 15:07:46 -0800

The following example uses `pos-visible-in-window-p` to guess as to whether the 
WSF will run more than one time -- i.e., if point is not fully visible, then 
WSF will run again.  [The last call to WSF is the most important so that the 
values of window-start and window-end are truly accurate.]  In addition to the 
WSF trigger feature request, a more sophisticated C-source solution to 
ascertain whether the WSF will run more than one time would be helpful.

(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 "point: %s | win: %s | start: %s | end: %s" 
    (if (pos-visible-in-window-p nil nil nil)
      "visible"
      "NOT visible")
    win start (window-end win t)))

(add-hook 'window-scroll-functions 'wsf-fn nil 'local)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]