]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix computation of outline heading level for non-git diff
authorMatthias Meulien <orontee@gmail.com>
Mon, 14 Feb 2022 21:29:49 +0000 (22:29 +0100)
committerJuri Linkov <juri@linkov.net>
Wed, 16 Feb 2022 19:19:45 +0000 (21:19 +0200)
* lisp/vc/diff-mode.el (diff-setup-buffer-type): Compute outline heading level
using diff-hunk-header-re (bug#51809).
(diff--font-lock-prettify): Disable prettify in non-git diff.

lisp/vc/diff-mode.el

index 0bf78992460543af694424b5c8fe36fa246afd34..d0c05d32044ffde12b3e8f8f206f2a9996f7f3d7 100644 (file)
@@ -1596,8 +1596,8 @@ modified lines of the diff."
                   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))
+          (concat "\\(^diff --git.*\n\\|" diff-hunk-header-re "\\)")))
+  (setq-local outline-level #'diff--outline-level)
   (setq-local outline-regexp diff-outline-regexp))
 
 (defun diff-delete-if-empty ()
@@ -2599,7 +2599,8 @@ fixed, visit it in a buffer."
   nil nil 'center)
 
 (defun diff--font-lock-prettify (limit)
-  (when diff-font-lock-prettify
+  (when (and diff-font-lock-prettify
+             (eq diff-buffer-type 'git))
     (save-excursion
       ;; FIXME: Include the first space for context-style hunks!
       (while (re-search-forward "^[-+! ]" limit t)