From: Marcin Borkowski <mbork@mbork.pl>
To: Samuel Wales <samologist@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: delete lines with overlays [workaround to diff mode]
Date: Tue, 29 Aug 2023 19:19:14 +0200 [thread overview]
Message-ID: <877cpd6a25.fsf@mbork.pl> (raw)
In-Reply-To: <CAJcAo8uDYpvQSsWApmk+j_iP47oi+Rc=6Fpda-5WG0L0niw=gw@mail.gmail.com>
On 2023-08-29, at 07:32, Samuel Wales <samologist@gmail.com> wrote:
> 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.
It will indeed be a bit of work to code this, but not too hard. I would
start with `(overlays-in (point-min) (point-max))' to get all the
overlays in the buffer, then iterate over that list with `mapc' and at
each overlay check if the current line begins with `-' or `+' and delete
it if so.
If that is too difficult for you, and nobody else steps in, I can help
you with that. I'm not sure, though, if it will really help you.
What I would probably do instead would be to iterate over, say, all
"deleted" lines, and for every such line try to find an "added" line
which is equal to the "deleted" line plus some string (or strings?)
somewhere. The latter seems to be a special case of finding a longest
common subsequence (see
https://en.wikipedia.org/wiki/Longest_common_subsequence), though I'm
not good enough in algorithms to know for sure if this is the right
approach.
Hth,
--
Marcin Borkowski
http://mbork.pl
next prev parent reply other threads:[~2023-08-29 17:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-29 5:32 delete lines with overlays [workaround to diff mode] Samuel Wales
2023-08-29 17:19 ` Marcin Borkowski [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877cpd6a25.fsf@mbork.pl \
--to=mbork@mbork.pl \
--cc=help-gnu-emacs@gnu.org \
--cc=samologist@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.