Function: majutsu-diff--update-hunk-refinement

majutsu-diff--update-hunk-refinement is a natively compiled function defined in majutsu-diff.el.

Signature

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

Documentation

Apply or remove word-level refinement overlays.

When SECTION is nil, walk all hunk sections.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-diff.el
;;; Refinement

(defun majutsu-diff--update-hunk-refinement (&optional section allow-remove)
  "Apply or remove word-level refinement overlays.
When SECTION is nil, walk all hunk sections."
  (if section
      (let ((current (eq section (magit-current-section))))
        (if (and allow-remove
                 (or (null majutsu-diff-refine-hunk)
                     (and (eq majutsu-diff-refine-hunk t)
                          (oref section refined)
                          (not current))))
            (progn
              (oset section refined nil)
              (remove-overlays (oref section start)
                               (oref section end)
                               'diff-mode 'fine))
          (unless (oref section hidden)
            (pcase (list majutsu-diff-refine-hunk
                         (oref section refined)
                         current)
              ((or `(all nil ,_) '(t nil t))
               (oset section refined t)
               (if (eq majutsu-diff-backend 'color-words)
                   (majutsu-diff--color-words-refine-hunk section)
                 (save-excursion
                   (goto-char (oref section start))
                   (let ((smerge-refine-ignore-whitespace
                          majutsu-diff-refine-ignore-whitespace)
                         (write-region-inhibit-fsync t))
                     (diff-refine-hunk)))))))))
    (cl-labels ((walk (node)
                  (if (magit-section-match 'jj-hunk node)
                      (majutsu-diff--update-hunk-refinement node t)
                    (dolist (child (oref node children))
                      (walk child)))))
      (walk magit-root-section))))