From 64ad922548bfc68c67875248e54361bcebf47a8b Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 7 May 2025 09:31:01 +0300 Subject: [PATCH] Update the default value of 'diff-outline-regexp'. * lisp/vc/diff-mode.el (diff-outline-regexp): Change the default value to match the diff command name in recursive diff. Move after 'diff-hunk-header-re' variable definition used in the new value. (diff-setup-buffer-type): Change setq of 'diff-outline-regexp' to buffer-local (bug#78269). (cherry picked from commit 47b075e24b65b0c07ea3e887b9c6d46ba8fbaa78) --- lisp/vc/diff-mode.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 194b0f5cb55..7070e71fc78 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -174,8 +174,6 @@ The default \"-b\" means to ignore whitespace-only changes, (defvar-local diff-default-directory nil "The default directory where the current Diff buffer was created.") -(defvar diff-outline-regexp - "\\([*+][*+][*+] [^0-9]\\|@@ ...\\|\\*\\*\\* [0-9].\\|--- [0-9]..\\)") ;;;; ;;;; keymap, menu, ... @@ -613,6 +611,9 @@ See https://lists.gnu.org/r/emacs-devel/2007-11/msg01990.html") (defconst diff-separator-re "^--+ ?$") +(defvar diff-outline-regexp + (concat "\\(^diff.*\\|" diff-hunk-header-re "\\)")) + (defvar diff-narrowed-to nil) (defun diff-hunk-style (&optional style) @@ -1718,7 +1719,7 @@ modified lines of the diff." 'hg nil)))) (when (eq diff-buffer-type 'git) - (setq diff-outline-regexp + (setq-local diff-outline-regexp (concat "\\(^diff --git.*\\|" diff-hunk-header-re "\\)"))) (setq-local outline-level #'diff--outline-level) (setq-local outline-regexp diff-outline-regexp)) -- 2.39.5