Function: erc--keep-place-indicator-on-window-buffer-change

erc--keep-place-indicator-on-window-buffer-change is a byte-compiled function defined in erc-goodies.el.gz.

Signature

(erc--keep-place-indicator-on-window-buffer-change _)

Documentation

Maybe sync erc--keep-place-indicator-overlay.

Do so only when switching to a new buffer in the same window if the replaced buffer is no longer visible in another window and its window-start at the time of switching is strictly greater than the indicator's position.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-goodies.el.gz
(defun erc--keep-place-indicator-on-window-buffer-change (_)
  "Maybe sync `erc--keep-place-indicator-overlay'.
Do so only when switching to a new buffer in the same window if
the replaced buffer is no longer visible in another window and
its `window-start' at the time of switching is strictly greater
than the indicator's position."
  (when-let ((erc-keep-place-indicator-follow)
             (window (selected-window))
             ((not (eq window (active-minibuffer-window))))
             (old-buffer (window-old-buffer window))
             ((buffer-live-p old-buffer))
             ((not (eq old-buffer (current-buffer))))
             (ov (buffer-local-value 'erc--keep-place-indicator-overlay
                                     old-buffer))
             ((not (get-buffer-window old-buffer 'visible)))
             (prev (assq old-buffer (window-prev-buffers window)))
             (old-start (nth 1 prev))
             (old-inmkr (buffer-local-value 'erc-insert-marker old-buffer))
             ((< (overlay-end ov) old-start old-inmkr)))
    (with-current-buffer old-buffer
      (erc-keep-place-move old-start))))