Function: diff-setup-buffer-type
diff-setup-buffer-type is a byte-compiled function defined in
diff-mode.el.gz.
Signature
(diff-setup-buffer-type)
Documentation
Try to guess the diff-buffer-type from content of current Diff mode buffer.
outline-regexp is updated accordingly.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/diff-mode.el.gz
(defun diff-setup-buffer-type ()
"Try to guess the `diff-buffer-type' from content of current Diff mode buffer.
`outline-regexp' is updated accordingly."
(save-excursion
(goto-char (point-min))
(setq-local diff-buffer-type
(if (re-search-forward "^diff --git" nil t)
'git
nil)))
(when (eq diff-buffer-type 'git)
(setq diff-outline-regexp
(concat "\\(^diff --git.*\n\\|" diff-hunk-header-re "\\)")))
(setq-local outline-level #'diff--outline-level)
(setq-local outline-regexp diff-outline-regexp))