Function: magit-diff-update-hunk-refinement

magit-diff-update-hunk-refinement is a byte-compiled function defined in magit-diff.el.

Signature

(magit-diff-update-hunk-refinement &optional SECTION ALLOW-REMOVE)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-diff.el
(defun magit-diff-update-hunk-refinement (&optional section allow-remove)
  (if section
      (unless (oref section hidden)
        (pcase (list magit-diff-refine-hunk
                     (oref section refined)
                     (eq section (magit-current-section)))
          ((or `(all nil ,_) '(t nil t))
           (oset section refined t)
           (save-excursion
             (goto-char (oref section start))
             ;; `diff-refine-hunk' does not handle combined diffs.
             (unless (looking-at "@@@")
               (let ((smerge-refine-ignore-whitespace
                      magit-diff-refine-ignore-whitespace)
                     ;; Avoid fsyncing many small temp files.
                     (write-region-inhibit-fsync t))
                 (diff-refine-hunk)))))
          ((and (guard allow-remove)
                (or `(nil t ,_) '(t t nil)))
           (oset section refined nil)
           (remove-overlays (oref section start)
                            (oref section end)
                            'diff-mode 'fine))))
    (named-let update ((section magit-root-section))
      (if (magit-section-match 'hunk section)
          (magit-diff-update-hunk-refinement section t)
        (dolist (child (oref section children))
          (update child))))))