Function: majutsu-conflict-ensure-mode

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

Signature

(majutsu-conflict-ensure-mode)

Documentation

Enable conflict mode based on marker style in the buffer.

Prefer majutsu-conflict-mode(var)/majutsu-conflict-mode(fun) for JJ-style conflicts. If only Git-style markers are present, enable smerge-mode(var)/smerge-mode(fun).

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-conflict.el
;;;###autoload
(defun majutsu-conflict-ensure-mode ()
  "Enable conflict mode based on marker style in the buffer.

Prefer `majutsu-conflict-mode' for JJ-style conflicts.  If only Git-style
markers are present, enable `smerge-mode'."
  (let* ((styles (majutsu-conflict--scan-styles))
         (jj-style (cl-some (lambda (style)
                              (memq style '(jj-diff jj-snapshot)))
                            styles))
         (git-style (cl-some (lambda (style)
                               (eq style 'git))
                             styles)))
    (cond
     (jj-style
      (when (bound-and-true-p smerge-mode)
        (smerge-mode -1))
      (majutsu-conflict-mode 1))
     (git-style
      (when (bound-and-true-p majutsu-conflict-mode)
        (majutsu-conflict-mode -1))
      (smerge-mode 1)))))