Function: magit--refresh-buffer-set-positions
magit--refresh-buffer-set-positions is a byte-compiled function
defined in magit-mode.el.
Signature
(magit--refresh-buffer-set-positions POSITIONS)
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-mode.el
(defun magit--refresh-buffer-set-positions (positions)
(pcase-dolist
(`(,window ,section ,line ,char ,ws-section ,ws-line ,window-start)
positions)
(if window
(with-selected-window window
(magit-section-goto-successor section line char)
(cond-let
((derived-mode-p 'magit-log-mode))
((or (not window-start)
(> window-start (point))))
((magit-section-equal ws-section (magit-section-at window-start))
(set-window-start window window-start t))
([pos (save-excursion
(and (magit-section-goto-successor--same
ws-section ws-line 0)
(point)))]
(set-window-start window pos t))))
;; We must make sure this does not call `set-window-start',
;; which the HUNK METHOD does by calling `magit-section-goto'
;; because that runs the `magit-section-goto-successor-hook'
;; and thus `magit-hunk-set-window-start'. The window does
;; not display this buffer, so the window start would be set
;; for the wrong buffer. Originally reported in #4196 and
;; fixed with 482c25a3204468a4f6c2fe12ff061666b61f5f4d.
(let ((magit-section-movement-hook nil))
(magit-section-goto-successor section line char)
;; To store the point value for the selected window, it isn't
;; enough for it to be current, the window has to "display" it.
;; The effect of `goto-char', used by the above function, is not
;; preserved, and using just `set-window-point' would affect the
;; wrong buffer.
(unless (eq (window-dedicated-p) t)
(let ((restore (window-buffer))
(window-scroll-functions nil)
(window-configuration-change-hook nil))
(unwind-protect
(progn
(set-window-buffer nil (current-buffer) t)
(set-window-point nil (point)))
(set-window-buffer nil restore t))))))))