branch: externals/gnorb
commit f3acab58c4bfb72acae66068c551e11a3fbb70e4
Author: Eric Abrahamsen <[email protected]>
Commit: Eric Abrahamsen <[email protected]>
Handle forwarding from gnorb-mode summary buffers
* nngnorb.el (gnorb-summary-reply-hook): `message-repy-headers' is only
populated for replies. When forwarding, simply get the message-id from
the text of the forwarded message below. If the user has added
message-id to `message-forward-ignored-headers' then s/he is out of
luck.
---
nngnorb.el | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/nngnorb.el b/nngnorb.el
index 0c1ca35..732254e 100644
--- a/nngnorb.el
+++ b/nngnorb.el
@@ -269,7 +269,14 @@ continue to provide tracking of sent messages."
(defun gnorb-summary-reply-hook (&rest args)
"Function that runs after any command that creates a reply."
;; Not actually a "hook"
- (let* ((msg-id (aref message-reply-headers 4))
+ (let* ((msg-id (if message-reply-headers
+ (aref message-reply-headers 4)
+ ;; When forwarding messages,
+ ;; `message-reply-headers' is nil.
+ (save-excursion
+ (let ((case-fold-search t))
+ (when (re-search-forward "message-id: +\\(.*\\)$"
(point-max) t)
+ (match-string 1))))))
(org-id (car-safe (gnus-registry-get-id-key msg-id 'gnorb-ids)))
(compose-marker (make-marker))
(attachments (buffer-local-value