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-20260822.1158/magit-diff.el
;;;; Section Commands

(defun magit-section-cycle-diffs ()
  "Cycle visibility of diff-related sections in the current buffer."
  (interactive)
  (cond-let*
    [[sections
      (cond ((derived-mode-p 'magit-status-mode)
             (mapcan (lambda (section)
                       (and section
                            (progn
                              (when (oref section hidden)
                                (magit-section-show section))
                              (copy-sequence (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))))]]
    ((not sections))
    ((seq-some (##oref % hidden) sections)
     (dolist (s sections)
       (magit-section-show s)
       (magit-section-hide-children s)))
    [[children (mapcan (##copy-sequence (oref % children)) sections)]]
    ((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))))