emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Delete duplicate subtrees?
@ 2020-08-05 18:15 David Rogers
  2020-08-05 21:59 ` Allen Li
  0 siblings, 1 reply; 4+ messages in thread
From: David Rogers @ 2020-08-05 18:15 UTC (permalink / raw)
  To: Org-mode list

Hello

I've copied text from several different sources into an org 
buffer, and now I find I have a large number of subtrees that are 
exactly the same. All headlines are at the top level, so there are 
no duplicates at different levels from each other - but there 
*are* some where the headline matches but the contents don't 
match. Is there an efficient way to delete all-but-one of the 
exactly duplicate subtrees, but avoid deleting any whose contents 
are different? (When the large number of exact duplicates are 
gone, it will be easy for me to resolve the partial matches one by 
one.)

-- 
Thanks
David


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

* Re: Delete duplicate subtrees?
  2020-08-05 18:15 Delete duplicate subtrees? David Rogers
@ 2020-08-05 21:59 ` Allen Li
  2020-08-06  8:20   ` David Rogers
  2020-08-07  1:07   ` David Rogers
  0 siblings, 2 replies; 4+ messages in thread
From: Allen Li @ 2020-08-05 21:59 UTC (permalink / raw)
  To: David Rogers; +Cc: Org-mode list

On Wed, Aug 5, 2020 at 6:16 PM David Rogers <davidandrewrogers@gmail.com> wrote:
>
> Hello
>
> I've copied text from several different sources into an org
> buffer, and now I find I have a large number of subtrees that are
> exactly the same. All headlines are at the top level, so there are
> no duplicates at different levels from each other - but there
> *are* some where the headline matches but the contents don't
> match. Is there an efficient way to delete all-but-one of the
> exactly duplicate subtrees, but avoid deleting any whose contents
> are different? (When the large number of exact duplicates are
> gone, it will be easy for me to resolve the partial matches one by
> one.)

Maybe this will be useful to you.

https://lists.gnu.org/archive/html/emacs-orgmode/2017-12/msg00626.html
https://lists.gnu.org/archive/html/emacs-orgmode/2018-01/msg00000.html

You will have to modify the code since IIRC the linked code only
matches by heading and not body.

>
> --
> Thanks
> David
>


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

* Re: Delete duplicate subtrees?
  2020-08-05 21:59 ` Allen Li
@ 2020-08-06  8:20   ` David Rogers
  2020-08-07  1:07   ` David Rogers
  1 sibling, 0 replies; 4+ messages in thread
From: David Rogers @ 2020-08-06  8:20 UTC (permalink / raw)
  To: Org-mode list

Allen Li <darkfeline@felesatra.moe> writes:

> On Wed, Aug 5, 2020 at 6:16 PM David Rogers 
> <davidandrewrogers@gmail.com> wrote:
>>
>> Hello
>>
>> I've copied text from several different sources into an org
>> buffer, and now I find I have a large number of subtrees that 
>> are
>> exactly the same. All headlines are at the top level, so there 
>> are
>> no duplicates at different levels from each other - but there
>> *are* some where the headline matches but the contents don't
>> match. Is there an efficient way to delete all-but-one of the
>> exactly duplicate subtrees, but avoid deleting any whose 
>> contents
>> are different? (When the large number of exact duplicates are
>> gone, it will be easy for me to resolve the partial matches one 
>> by
>> one.)
>
> Maybe this will be useful to you.
>
> https://lists.gnu.org/archive/html/emacs-orgmode/2017-12/msg00626.html
> https://lists.gnu.org/archive/html/emacs-orgmode/2018-01/msg00000.html
>
> You will have to modify the code since IIRC the linked code only
> matches by heading and not body.
>

Thank you - I'm clumsy at best with modifying code, but I'll see 
what I can do with it.

-- 
David


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

* Re: Delete duplicate subtrees?
  2020-08-05 21:59 ` Allen Li
  2020-08-06  8:20   ` David Rogers
@ 2020-08-07  1:07   ` David Rogers
  1 sibling, 0 replies; 4+ messages in thread
From: David Rogers @ 2020-08-07  1:07 UTC (permalink / raw)
  To: Allen Li; +Cc: David Rogers, Org-mode list

Allen Li <darkfeline@felesatra.moe> writes:

> On Wed, Aug 5, 2020 at 6:16 PM David Rogers 
> <davidandrewrogers@gmail.com> wrote:
>>
>> Hello
>>
>> I've copied text from several different sources into an org
>> buffer, and now I find I have a large number of subtrees that 
>> are
>> exactly the same. All headlines are at the top level, so there 
>> are
>> no duplicates at different levels from each other - but there
>> *are* some where the headline matches but the contents don't
>> match. Is there an efficient way to delete all-but-one of the
>> exactly duplicate subtrees, but avoid deleting any whose 
>> contents
>> are different? (When the large number of exact duplicates are
>> gone, it will be easy for me to resolve the partial matches one 
>> by
>> one.)
>
> Maybe this will be useful to you.
>
> https://lists.gnu.org/archive/html/emacs-orgmode/2017-12/msg00626.html
> https://lists.gnu.org/archive/html/emacs-orgmode/2018-01/msg00000.html
>
> You will have to modify the code since IIRC the linked code only
> matches by heading and not body.
>

After reading the discussion about the code you provided, it's 
clear to me that what I need is exactly what the "naysayers" were 
pointing out - something that definitely scans the full text, and 
maybe gives notice of what's being changed. I don't have the 
ability to correctly build in those kinds of things myself.

-- 
Thanks
David


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

end of thread, other threads:[~2020-08-07  1:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-05 18:15 Delete duplicate subtrees? David Rogers
2020-08-05 21:59 ` Allen Li
2020-08-06  8:20   ` David Rogers
2020-08-07  1:07   ` David Rogers

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).