Function: follow-window-size-change

follow-window-size-change is a byte-compiled function defined in follow.el.gz.

Signature

(follow-window-size-change FRAME)

Documentation

Redraw all windows in FRAME, when in Follow mode.

Source Code

;; Defined in /usr/src/emacs/lisp/follow.el.gz
;;; Window size change

;; The functions in `window-size-change-functions' are called every
;; time a window in a frame changes size, most notably after the frame
;; has been resized.  We call `follow-post-command-hook' for every
;; Follow mode buffer visible in any window in the resized frame.
;;
;; Since `follow-window-size-change' can be called indirectly from
;; `follow-post-command-hook' we have a potential infinite loop.  To
;; avoid this, we simply do not do anything in this situation.  The
;; variable `follow-inside-post-command-hook-call' contains
;; information about whether the execution actually is inside the
;; post-command-hook or not.

(defun follow-window-size-change (frame)
  "Redraw all windows in FRAME, when in Follow mode."
  ;; Below, we call `post-command-hook'.  Avoid an infloop.
  (unless follow-inside-post-command-hook-call
    (save-current-buffer
      (let ((orig-frame (selected-frame)))
        (select-frame frame)
        (let ((picked-window (selected-window))   ; Note: May change below.
              (seen-buffers '()))
          (unwind-protect
              (walk-windows
               (lambda (win)
                 (let ((buf (window-buffer win)))
                   (unless (memq buf seen-buffers)
                     (set-buffer buf)
                     (when follow-mode
                       (let ((windows (follow-all-followers win)))
                         (if (not (memq picked-window windows))
                             (follow-redisplay windows win)
                           ;; Make sure we're redrawing around the selected
                           ;; window.
                           (select-window picked-window 'norecord)
                           (follow-post-command-hook)
                           (setq picked-window (selected-window))))
                       (push buf seen-buffers)))))
               'no-minibuf)
            (select-window picked-window 'norecord)))
        (select-frame orig-frame)))))