Function: majutsu-conflict--find-conflict

majutsu-conflict--find-conflict is a natively compiled function defined in majutsu-conflict.el.

Signature

(majutsu-conflict--find-conflict &optional LIMIT)

Documentation

Find and match a JJ-style conflict region. Intended as a font-lock MATCHER.

Skips git-style conflicts (left to smerge-mode(var)/smerge-mode(fun)). Returns non-nil if a match is found between point and LIMIT. Sets match-data with group 0 = entire conflict.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-conflict.el
;;; Font-Lock Support

(defun majutsu-conflict--find-conflict (&optional limit)
  "Find and match a JJ-style conflict region.  Intended as a font-lock MATCHER.
Skips git-style conflicts (left to `smerge-mode').
Returns non-nil if a match is found between point and LIMIT.
Sets match-data with group 0 = entire conflict."
  (let ((found nil))
    (while (and (not found) (re-search-forward majutsu-conflict-begin-re limit t))
      (let* ((begin (match-beginning 0))
             (marker-len (length (match-string 1)))
             (end-re (format "^>\\{%d,\\}\\(?: .*\\)?$" marker-len))
             (style (majutsu-conflict--detect-style begin marker-len)))
        (when (and (memq style '(jj-diff jj-snapshot))
                   (re-search-forward end-re limit t))
          (set-match-data (list begin (match-end 0)))
          (with-silent-modifications
            (put-text-property begin (match-end 0) 'font-lock-multiline t))
          (setq found t))))
    found))