Re: mass removal of duplicates

Subject: Re: mass removal of duplicates

Date: Thu, 31 Jul 2025 20:22:38 +0200

To: David Bremner, notmuch

Cc:

From: Alan Schmitt


On 2025-07-31 14:27, Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> On 2025-07-31 07:51, David Bremner <david@tethera.net> writes:
>
>> With the caveat that it is always good to have backups, something like
>>
>>      notmuch search --duplicate=2 --output=files '*' | xargs rm
>
> This is a great start, thanks. I think I’ll build up on this to have a
> tool that shows me the duplicates side by side so that I can choose
> which one to keep.

I have a couple followup questions. In emacs, how can I run a query of
the form `notmuch search --duplicate=2 --output=messages '*''? I would
like to see messages with duplicates from with emacs. I looked at the
code for `notmuch-search' and could not find how to add the
`--duplicate=2' option.

I wrote a couple functions to easily switch between duplicates and show
the path of their files:

(defun my-notmuch-get-current-file-name ()
  (let* ((files (notmuch-show-get-prop :filename))
         (duplicate (notmuch-show-get-prop :duplicate))
         (curfile (nth (- duplicate 1) files)))
    curfile))

(defun my-notmuch-next-duplicate ()
  (interactive)
  (let* ((files (notmuch-show-get-prop :filename))
         (duplicate (notmuch-show-get-prop :duplicate))
         (newdup (if (= duplicate (length files)) 1 (+ 1 duplicate))))
    (notmuch-show-choose-duplicate newdup)
    (message (my-notmuch-get-current-file-name))))

I would like to add a function to call `rm' on the current file. What
should I do to make sure the change is picked up by notmuch? Run
`notmuch new' (I would do this from within emacs).

Thanks!

Alan
signature.asc (application/pgp-signature)
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: