notmuch/debbugs: Add WIP-snippet to view debbugs reports with Notmuch

master
Pierre Neidhardt 2019-06-15 11:21:46 +02:00
parent 8d090b7d28
commit ea3feb7cbe
1 changed files with 19 additions and 0 deletions

View File

@ -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)