GNU bug report logs -
#78269
diff-outline-regexp
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Mon, 5 May 2025 19:12:01 UTC
Severity: normal
Fixed in version 31.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 78269 in the body.
You can then email your comments to 78269 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org
:
bug#78269
; Package
emacs
.
(Mon, 05 May 2025 19:12:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> linkov.net>
:
New bug report received and forwarded. Copy sent to
monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org
.
(Mon, 05 May 2025 19:12:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
I noticed that 'diff-setup-buffer-type' overrides the default value
of 'diff-outline-regexp'. Here is the fix:
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index a5f4169a7f3..76703526b63 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -1719,7 +1719,7 @@ diff-setup-buffer-type
'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))
Probably no one noticed this problem because its current default value
is not useful to anyone:
(defvar diff-outline-regexp
"\\([*+][*+][*+] [^0-9]\\|@@ ...\\|\\*\\*\\* [0-9].\\|--- [0-9]..\\)")
Maybe the default should be replaced with something like
(defvar diff-outline-regexp
(concat "\\(^diff -.*\\|" diff-hunk-header-re "\\)"))
that is useful for file-based diff. Or maybe the value for file-based diff
should be set in 'diff-no-select' like this?
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el
index c8a1b7c0efa..62c4ba6d302 100644
--- a/lisp/vc/diff.el
+++ b/lisp/vc/diff.el
@@ -196,6 +196,9 @@ diff-no-select
(erase-buffer))
(buffer-enable-undo (current-buffer))
(diff-mode)
+ (setq-local diff-outline-regexp
+ (concat "\\(^" diff-command ".*\\|" diff-hunk-header-re "\\)")
+ outline-regexp diff-outline-regexp)
(setq-local revert-buffer-function
(lambda (_ignore-auto _noconfirm)
(diff-no-select old new switches no-async (current-buffer))))
But I might be missing more use cases.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78269
; Package
emacs
.
(Mon, 05 May 2025 22:43:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 78269 <at> debbugs.gnu.org (full text, mbox):
> diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
> index a5f4169a7f3..76703526b63 100644
> --- a/lisp/vc/diff-mode.el
> +++ b/lisp/vc/diff-mode.el
> @@ -1719,7 +1719,7 @@ diff-setup-buffer-type
> '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))
LGTM, thanks.
> Probably no one noticed this problem because its current default value
> is not useful to anyone:
>
> (defvar diff-outline-regexp
> "\\([*+][*+][*+] [^0-9]\\|@@ ...\\|\\*\\*\\* [0-9].\\|--- [0-9]..\\)")
I think the idea was to recognize file header and hunk headers, in the
case where the "diff" command itself is absent (as is the case in the
output of the (non-recursive) `diff` command).
> Maybe the default should be replaced with something like
>
> (defvar diff-outline-regexp
> (concat "\\(^diff -.*\\|" diff-hunk-header-re "\\)"))
LGTM (I'd even drop the `-` after `diff`). AFAICT nowadays the "diff
..." command is absent only in cases where there's only one file in the
diff, so matching the file header is not very useful, indeed.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78269
; Package
emacs
.
(Wed, 07 May 2025 06:35:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 78269 <at> debbugs.gnu.org (full text, mbox):
close 78269 31.0.50
thanks
>> - (setq diff-outline-regexp
>> + (setq-local diff-outline-regexp
>
> LGTM, thanks.
>
>> Probably no one noticed this problem because its current default value
>> is not useful to anyone:
>>
>> (defvar diff-outline-regexp
>> "\\([*+][*+][*+] [^0-9]\\|@@ ...\\|\\*\\*\\* [0-9].\\|--- [0-9]..\\)")
>
> I think the idea was to recognize file header and hunk headers, in the
> case where the "diff" command itself is absent (as is the case in the
> output of the (non-recursive) `diff` command).
>
>> Maybe the default should be replaced with something like
>>
>> (defvar diff-outline-regexp
>> (concat "\\(^diff -.*\\|" diff-hunk-header-re "\\)"))
>
> LGTM (I'd even drop the `-` after `diff`). AFAICT nowadays the "diff
> ..." command is absent only in cases where there's only one file in the
> diff, so matching the file header is not very useful, indeed.
So now pushed.
bug marked as fixed in version 31.0.50, send any further explanations to
78269 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net>
Request was from
Juri Linkov <juri <at> linkov.net>
to
control <at> debbugs.gnu.org
.
(Wed, 07 May 2025 06:35:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 04 Jun 2025 11:24:20 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.