summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2017-10-27 21:57:28 -0400
committerKyle Meyer <kyle@kyleam.com>2018-01-13 11:15:18 -0500
commita7e78b1f51179ad25ffe17ac41c939e1ad07a4b0 (patch)
treeed39439d0067faff2bd8427ad915dfec0a507ab1
parent9146e7c012213ee8391dbd8515207d7243f4b8e5 (diff)
downloademacs.d-a7e78b1f51179ad25ffe17ac41c939e1ad07a4b0.tar.gz
Add notmuch variant for debbugs-gnu-select-report
-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