notmuch-dired-search contribution

Subject: notmuch-dired-search contribution

Date: Mon, 10 Mar 2025 21:27:36 +0000

To: notmuch@notmuchmail.org

Cc:

From: Stephen J Eglen


Hello,

Thank you all for notmuch.

I just thought I'd share this short little defun.  My normal use case is for permanently deleting emails from my index.

(defun notmuch-dired-search ()
  "Convert current notmuch search buffer to dired listing."
  (interactive)
  (if (not notmuch-search-query-string)
      (message "No search query could be found.")
    (let*
	((listing (make-temp-file "listing-"))
	 (cmd (format "notmuch search  --output=files --format=sexp %s > %s"
		      notmuch-search-query-string
		      listing))
	 (temp1 (shell-command-to-string cmd))
	 (files (read (with-temp-buffer
			(insert-file-contents listing)
			(buffer-string)))))
      (push "*notmuch-dired*" files)
      (dired files))))


Best wishes,

Stephen
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: