GNU bug report logs - #75884
29.4; Dash character "-" appears as diff when it is the leading character in a line in a patch

Previous Next

Package: emacs;

Reported by: Husain Alshehhi <husain <at> alshehhi.io>

Date: Mon, 27 Jan 2025 03:41:02 UTC

Severity: minor

Tags: confirmed

Found in version 29.4

Fixed in version 31.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: Juri Linkov <juri <at> linkov.net>
Cc: Husain Alshehhi <husain <at> alshehhi.io>, Dmitry Gutov <dmitry <at> gutov.dev>, Eli Zaretskii <eliz <at> gnu.org>, 75884 <at> debbugs.gnu.org
Subject: bug#75884: 29.4; Dash character "-" appears as diff when it is the leading character in a line in a patch
Date: Sat, 08 Feb 2025 21:14:44 +0000
Hello,

On Sat 08 Feb 2025 at 07:58pm +02, Juri Linkov wrote:

>> For patches generated by git, indeed, anything before the first hunk
>> should not be fontified as though it were a patch.
>>
>> Similarly we should look for a "-- " line at the end of the message and
>> treat it as an e-mail signature.
>
> Completely agree.
>
>> But one question I immediately have is how much of this is Git-specific.
>> Is there some specification of the unified diff format anywhere?
>>
>> Could there be non-Git unidifed diffs this would break?
>
> There is already some Git-specific code in diff-mode that depends
> on 'diff-buffer-type' being equal to 'git' such as in
> 'diff-prev-line-if-patch-separator'.  This could be used
> also to exclude font-locking from header (anything until
> the first line , i.e. `(re-search-forward "^diff --git" nil t)`)
> and footer (anything after `(looking-at "^-- $")`).

Okay.  Then I think we know what is needed here.

-- 
Sean Whitton




This bug report was last modified 130 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.