From ea3feb7cbe5ac1a8625ae88a4faad8610d43e606 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Sat, 15 Jun 2019 11:21:46 +0200 Subject: [PATCH] notmuch/debbugs: Add WIP-snippet to view debbugs reports with Notmuch --- .emacs.d/lisp/init-notmuch.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.emacs.d/lisp/init-notmuch.el b/.emacs.d/lisp/init-notmuch.el index 99db290c..8684a839 100644 --- a/.emacs.d/lisp/init-notmuch.el +++ b/.emacs.d/lisp/init-notmuch.el @@ -67,4 +67,23 @@ (lambda (prompt collection initial-input) (completing-read prompt (cons initial-input collection) nil t nil 'notmuch-address-history))) + +;; The following can be used to use notmuch with debbugs, but it won't retrieve +;; the emails so this has to be done separately. +(defun debbugs-notmuch-select-report (&rest _) + (let* ((status (debbugs-gnu-current-status)) + (id (cdr (assq 'id status))) + (merged (cdr (assq 'mergedwith status)))) + (setq merged (if (listp merged) merged (list merged))) + (unless id + (user-error "No bug report on the current line")) + (let ((address (format "%s@debbugs.gnu.org" id)) + (merged-addresses (string-join (mapcar (lambda (id) + (format "%s@debbugs.gnu.org %s" id)) + merged) + " "))) + (notmuch-search (format "%s %s" address merged-addresses))))) + +;; (advice-add 'debbugs-gnu-select-report :override #'debbugs-notmuch-select-report) + (provide 'init-notmuch)