Subject: bug#61396: diff mode could distinguish changed from deleted lines

From: Samuel Wales <[email-masked]>
Date: Sun, 12 Feb 2023 15:48:04 -0700

for purposes of showing what i mean, suppose you have approximately like:

--- ...
+++ ...
@@ ... @@
-1 hmm
-2 hi
-3
+1 really?
+2 there
+3 for all good men

[btw this is all merely an arbitrary quote from history from a diff tutorial.]

now what does diff-mode do with this?  it usually does a pretty good
job.  sometimes there are glitches.

diff-mode leaves 1 2 3 characters alone.  it uses diff-removed and
diff-added for them.

--- ...
+++ ...
@@ -104,3 +104,3 @@
-1 HMM
-2 HI
-3
+1 REALLY?
+2 THERE
+3 FOR ALL GOOD MEN

this output is correct.  hmm and really are different and hi and there
are different.

line 3 is special.  the - and + moieties are different.  but they are
different specially.  that is because in - there is an /absence/ of
for all good men.  diff-mode does not show absence.  there is no
marker saying "soiemthing is absent".

in - for line 3 it is also special for the user interpretation.  it
could indicate that the line is entirely unique to A according to
diff-mode.  OR it could indicate that it is in both A and B but
different in B like 1 and 2.

this is ambiguous.  an indicator reovs ambiguity.  the idea is merely
one thing: indicating absence.

the same idea is true of a hypothetical opposite case where 3 in +,
not -, lacks an indicator.

can it be done?  naturally, all of this is heuristic-ish to begin
with, insofar as human interpretation is concerned.  that's why we
have difftastic and histogram and all that stuff.  the solution --
indicators for absence -- will also be.  that is ok.

adjacency and blocks are not likely to be the solution.  if it is
elaborate or special-cased, then it is likely impractical.

On 2/12/23, Samuel Wales <[email-masked]> wrote:
> below.
>
> On 2/12/23, Juri Linkov <[email-masked]> wrote:
>> But it seems that you want to check words on every line in the block
>> for changes, and to categorize every line to three groups:
>
> i do not want what you described.
>

-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com