summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.el6
-rw-r--r--lisp/km-mail.el17
2 files changed, 23 insertions, 0 deletions
diff --git a/init.el b/init.el
index 7cb0d69..ec452dd 100644
--- a/init.el
+++ b/init.el
@@ -1712,6 +1712,12 @@
:config
(global-guix-prettify-mode 1))
+(use-package debbugs-gnu
+ :defer t
+ :config
+ (advice-add 'debbugs-gnu-select-report :override
+ #'km/debbugs-notmuch-select-report))
+
;;; Text modes
diff --git a/lisp/km-mail.el b/lisp/km-mail.el
index 88511a2..cd363d4 100644
--- a/lisp/km-mail.el
+++ b/lisp/km-mail.el
@@ -146,6 +146,23 @@ in the remote's \".git/config\" entry."
(`notmuch-tree-mode (notmuch-tree-get-query))))
(default-value 'notmuch-search-oldest-first)))
+;; Taken from Nicolas Petton's emacs configuration
+;; (https://gitlab.petton.fr/nico/emacs.d/, 208407f53a)
+;;;###autoload
+(defun km/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" id))
+ merged)
+ " ")))
+ (notmuch-search (format "%s %s" address merged-addresses)))))
+
(defmacro km/notmuch-with-raw-message (msg-id &rest body)
"Evaluate BODY with temporary buffer containing text for MSG-ID.
MSG-ID is evaluated before entering the temporary buffer. See