all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* delete lines with overlays [workaround to diff mode]
@ 2023-08-29  5:32 Samuel Wales
  2023-08-29 17:19 ` Marcin Borkowski
  2023-08-29 22:03 ` Jens Schmidt via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 7+ messages in thread
From: Samuel Wales @ 2023-08-29  5:32 UTC (permalink / raw)
  To: help-gnu-emacs

i have been struggling with this and working on this description for
many years.  hoping for a command that can delete all lines starting
with "-" that contain overlays.


rationale:

diff mode does not distinguish DELETED lines in A (i.e. -)
from lines in A that have more text ADDED somewhere in their
B version (i.e. +).

thus, those lines are ambiguous.  they might 1) have been
accidentally deleted, or they might 2) merely be the shorter
version of the line that has text in the other polarity.
the converse is also true if you swap A and B.

the result is that i cannot tell if lines are missing in A
by looking only at the - lines; i have to search through all
of the + lines also, in order to determine whehter, instead,
text was added.

this applies to A lines that have no overlays.  if they have
an overlay for TEXT, then i know that it is not a deleted
line.  also, sometimes a refilled paragraph or so will have
overlays on the - at BOL and presumably are not deleted.


i filed a bug on this, to request e.g. a marker like ^ or
something to show in any diff mode - or + line where text is
exists in the opposite polarity (e.g. + if it is a - line
or - if it is a + line).

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

here is an example from that bug report:

[edit: the caret is an indicator here, not part of the
example text.]

===
so basically,

  -this is a line that ^looks deleted, but it is changed
...
  +this is a line that REALLY looks deleted, but it is changed

what is not indicated for the user is at the ^.  i woul dlike it if
diff mode if possible showed that text was deleted there.

this allows you to look at only the - line and know that it is not a
deleted line, possibly even mistakenly, but rather is part of a cange
set, namely it and the + version of hte same line.  this would reduce
user confusion considerably.
===


i do not know if this is fixable in diff mode.  however, i
thought of a so-so but still useful workaround.

the workaround would be to have a command that can delete
lines with overlays in A (i.e. -).  then the REMAINING lines
are the ambiguous lines and can be inspected without
distraction.  they are either deleted or got changed.

the problem is that i don't know how to program such a
command.  i guess it would take a c-u to delete + lines with
overlays instead of - lines with overlays.


(a better solution is as follows, but i assme it is too
difficult.  it sure would be for me.

that is a command that internally removes overlays for
purposes of comparison and searches for "+" lines that are
otherwise equal to the "-" line.  if such a dual line is
found, then deletes those "-" lines.)



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-08-30 16:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-29  5:32 delete lines with overlays [workaround to diff mode] Samuel Wales
2023-08-29 17:19 ` Marcin Borkowski
2023-08-29 22:03 ` Jens Schmidt via Users list for the GNU Emacs text editor
2023-08-30  5:07   ` Samuel Wales
2023-08-30 11:21     ` Jens Schmidt via Users list for the GNU Emacs text editor
2023-08-30 11:30     ` Jens Schmidt via Users list for the GNU Emacs text editor
2023-08-30 16:25     ` Jens Schmidt

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.