Subject: Delayed window positioning after buffer display

From: Juri Linkov <[email-masked]>
Date: Wed, 22 May 2019 23:32:13 +0300

There are commands that set point while the buffer is not displayed,
and after displaying the buffer point remains at an old position,
not where it was moved while the buffer was undisplayed.

One solution is to generalize the variable 'help-window-point-marker'
currently described as:

  ;; `help-window-point-marker' is a marker you can move to a valid
  ;; position of the buffer shown in the help window in order to override
  ;; the standard positioning mechanism (`point-min') chosen by
  ;; `with-output-to-temp-buffer' and `with-temp-buffer-window'.
  ;; `with-help-window' has this point nowhere before exiting.  Currently
  ;; used by `view-lossage' to assert that the last keystrokes are always
  ;; visible.
  (defvar help-window-point-marker (make-marker)
    "Marker to override default `window-point' in help windows.")

A general name could be e.g. 'window-point-marker'.  Its counterpart is
also necessary with the name 'window-start-marker'.

Beside the recently occurred need in bug#35624 to use a new buffer-local
variable for window-start, other modes require this feature as well,
e.g. vc-annotate takes a long time to finish and set window point, but
after switching forth and back, it doesn't set point to the right line
after the buffer becomes visible.