summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2018-03-03 23:31:25 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-03-03 23:33:17 +0100
commitcb0954d8de18c3fb49cdf966700f5161919ea2bf (patch)
tree11acf951622611002277c68b9f7e9835e91ee09b
parentf8d758966c87203764aff5c933e915ab6ca28bea (diff)
downloadorg-mode-cb0954d8de18c3fb49cdf966700f5161919ea2bf.tar.gz
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 <unhammer@fsfe.org> <http://lists.gnu.org/r/emacs-orgmode/2018-03/msg00037.html>
-rw-r--r--lisp/org-gnus.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el
index 2354ed4..a53b343 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)))