From cb0954d8de18c3fb49cdf966700f5161919ea2bf Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 3 Mar 2018 23:31:25 +0100 Subject: [PATCH] org-gnus: Fix `org-gnus-store-link' * lisp/org-gnus.el (org-gnus-store-link): Fix storing link from an article when point in the summary buffer does not match the article. Reported-by: Kevin Brubeck Unhammer --- lisp/org-gnus.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el index 2354ed472..a53b343ef 100644 --- a/lisp/org-gnus.el +++ b/lisp/org-gnus.el @@ -42,6 +42,7 @@ (declare-function gnus-activate-group "gnus-start" (group &optional scan dont-check method dont-sub-check)) (declare-function gnus-find-method-for-group "gnus" (group &optional info)) +(declare-function gnus-article-show-summary "gnus-art" ()) (declare-function gnus-group-group-name "gnus-group") (declare-function gnus-group-jump-to-group "gnus-group" (group &optional prompt)) (declare-function gnus-group-read-group "gnus-group" (&optional all no-article group select-articles)) @@ -142,7 +143,14 @@ If `org-store-link' was called with a prefix arg the meaning of (save-excursion (nnir-article-group (gnus-summary-article-number)))) (_ gnus-newsgroup-name))) - (header (with-current-buffer gnus-summary-buffer + (header (if (eq major-mode 'gnus-article-mode) + ;; When in an article, first move to summary + ;; buffer, with point on the summary of the + ;; current article before extracting headers. + (save-window-excursion + (save-excursion + (gnus-article-show-summary) + (gnus-summary-article-header))) (gnus-summary-article-header))) (from (mail-header-from header)) (message-id (org-unbracket-string "<" ">" (mail-header-id header)))