Subject: Re: bug#75884: 29.4; Dash character "-" appears as diff when it is the leading character in a line in a patch

From: Juri Linkov <[email-masked]>
Date: Sat, 08 Feb 2025 19:58:23 +0200

> 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 "^-- $")`).