Subject: bug#22637: 25.1.50; `mode-line` face `:height` incompatible with `scroll-conservatively 101`.

From: Keith David Bershatsky <[email-masked]>
Date: Mon, 15 Feb 2016 18:51:26 -0800

The same situation mentioned in my email earlier today (02/15/2016) is also present in the first test case that we looked at for #22637.   I.e., after an insertion in the first test case, the `window-scroll-functions` hook never fires after `window-start` is corrected.  So a user seeking to use the `window-scroll-functions` hook following a large insertion (e.g., a large yank, and so forth) is out of luck in that situation in terms of using a correct `window-start`.  I have already dealt with it for the `window-start-end-hook` by forcing a call every command loop thereby bypassing "optimization 3"; however, the WSF has no fix at this time.

The difference between the first and second test case is as follows:  The first test case deals with a straight insertion.  The second test case uses insertion merely to populate the buffer with some text so that we can then see what happens when using `goto-char`.  I commented out the two lines of `goto-char` in the `test` function below to replicate the first test case scenario.  The prior email is the second test case scenario.

(face-spec-set 'mode-line
'((((class color) (min-colors 88))
   :box (:line-width -1 :style released-button)
   :background "grey75" :foreground "black" :height 120)
  (t
   :inverse-video t)))

(setq scroll-conservatively 101)
(global-eldoc-mode -1)
(global-font-lock-mode -1)
(blink-cursor-mode -1)

(defun test ()
 (interactive)
 (switch-to-buffer (get-buffer-create "*foo*"))
 (add-hook 'window-scroll-functions 'wsf-test-fn nil 'local)
 (buffer-disable-undo)
 (setq undo-auto-current-boundary-timer t
	timer-list (delq 'undo-auto--boundary-timer timer-list))
 (dotimes (i 200)
   (insert (format "I will not obey absurd orders %d.\n" i)))
 ;; (goto-char (point-min))
 ;; (goto-char (- (point-max) 1000))
  )

(defun wsf-test-fn (win start)
  (let* (
      (end (window-end nil t))
      (pos-visible (pos-visible-in-window-p nil win nil)) )
    (message "window-start: %s | window-end: %s | pos-visible: %s"
      start end pos-visible)))

(global-set-key [f1] 'test)