emacs-patch-review

Port of Thunderbird Patch Review to mu4e.

git clone git://mccd.space/emacs-patch-review
commit 4a448f791e7489d23b0646d756eebae3354e360c
parent 4fb28b5bc07c31c5476bb511edc4bdefba722e9e
Author: Pi Agent <agent@pi.local>
Date:   Mon,  3 Aug 2026 10:21:35 +0200

Add patch-review-mu4e: mu4e adapter

One entry point, patch-review-mu4e-review, for mu4e view and headers
buffers: locate the raw message file via the :path field and hand it to
patch-review-open-message-file. Untested in CI (no mu on the dev
machine); deliberately kept to a field lookup.

Diffstat:
Apatch-review-mu4e.el | 39+++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+), 0 deletions(-)
diff --git a/patch-review-mu4e.el b/patch-review-mu4e.el
@@ -0,0 +1,39 @@
+;;; patch-review-mu4e.el --- mu4e integration for patch-review -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Marc Coquand
+
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;;; Commentary:
+
+;; Thin mu4e adapter: open the message shown in the current *mu4e-view*
+;; buffer as a patch review.  Suggested binding:
+;;
+;;   (define-key mu4e-view-mode-map (kbd "R") #'patch-review-mu4e-review)
+;;
+;; The adapter only locates the raw message file and hands it to
+;; `patch-review-open-message-file'; everything else lives in the core.
+
+;;; Code:
+
+(require 'patch-review)
+
+(declare-function mu4e-message-at-point "mu4e-message" (&optional noerror))
+(declare-function mu4e-message-field "mu4e-message" (msg field))
+
+;;;###autoload
+(defun patch-review-mu4e-review ()
+  "Review the patch message at point (mu4e view or headers buffer)."
+  (interactive nil mu4e-view-mode mu4e-headers-mode)
+  (unless (require 'mu4e-message nil t)
+    (user-error "mu4e is not available"))
+  (let ((path (mu4e-message-field (mu4e-message-at-point) :path)))
+    (unless (and path (file-readable-p path))
+      (user-error "No message file at point"))
+    (patch-review-open-message-file path)))
+
+(provide 'patch-review-mu4e)
+;;; patch-review-mu4e.el ends here