Function: magit-section-cycle-diffs
magit-section-cycle-diffs is an interactive and byte-compiled function
defined in magit-diff.el.
Signature
(magit-section-cycle-diffs)
Documentation
Cycle visibility of diff-related sections in the current buffer.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-diff.el
;;;; Section Commands
(defun magit-section-cycle-diffs ()
"Cycle visibility of diff-related sections in the current buffer."
(interactive)
(when-let ((sections
(cond ((derived-mode-p 'magit-status-mode)
(mapcan (lambda (section)
(and section
(progn
(when (oref section hidden)
(magit-section-show section))
(oref section children))))
(list (magit-get-section '((staged) (status)))
(magit-get-section '((unstaged) (status))))))
((derived-mode-p 'magit-diff-mode)
(seq-filter #'magit-file-section-p
(oref magit-root-section children))))))
(if (seq-some (##oref % hidden) sections)
(dolist (s sections)
(magit-section-show s)
(magit-section-hide-children s))
(let ((children (mapcan (##copy-sequence (oref % children)) sections)))
(cond ((and (seq-some (##oref % hidden) children)
(seq-some (##oref % children) children))
(mapc #'magit-section-show-headings sections))
((seq-some #'magit-section-hidden-body children)
(mapc #'magit-section-show-children sections))
((mapc #'magit-section-hide sections)))))))