GNU bug report logs -
#51809
29.0.50; [PATCH] Support for outline default state in Diff buffers
Previous Next
Reported by: Matthias Meulien <orontee <at> gmail.com>
Date: Sat, 13 Nov 2021 13:10:02 UTC
Severity: normal
Tags: fixed, patch
Fixed in version 29.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Matthias Meulien <orontee <at> gmail.com> writes:
> My first impression is that setting `outline-level' to
> `diff--outline-level' inconditionnaly should work but since I don't
> understand why `diff-outline-regex' hasn't been defined in terms of
> `diff-file-header-re' and `diff-hunk-header-re' I guess I am missing
> some subtleties.
>
> (Note that there's another minor bug when `diff-buffer-type` isn't equal
> to 'git: `diff--font-lock-prettify` should be a no-op since the regexp
> written there match only Git generated diffs, confirmed by the FIXME
> string "This has only been tested with Git's diff output." written in
> the implementation).
Here's the corresponding patch:
[0001-Fix-computation-of-outline-heading-level-for-non-git.patch (text/x-diff, inline)]
From 4cf31f61caa50ba97e67847b175d598387fabba4 Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee <at> gmail.com>
Date: Mon, 14 Feb 2022 22:29:49 +0100
Subject: [PATCH] Fix computation of outline heading level for non-git diff
* lisp/vc/diff-mode.el (diff-setup-buffer-type): Compute outline heading level
using diff-hunk-header-re.
(diff--font-lock-prettify): Disable prettify in non-git diff.
---
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 0bf7899246..d0c05d3204 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -1596,8 +1596,8 @@ diff-setup-buffer-type
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 @@ 'diff-fringe-nul
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)
--
2.30.2
[Message part 3 (text/plain, inline)]
Without this patch when I visit the reported woman.patch file I see the
following:
[without_patch.png (image/png, attachment)]
[Message part 5 (text/plain, inline)]
but with the patch I see:
[with_patch.png (image/png, attachment)]
[Message part 7 (text/plain, inline)]
--
Matthias
This bug report was last modified 3 years and 91 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.