Pārlūkot izejas kodu

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>
Nicolas Goaziou 7 gadi atpakaļ
vecāks
revīzija
cb0954d8de
1 mainītis faili ar 9 papildinājumiem un 1 dzēšanām
  1. 9 1
      lisp/org-gnus.el

+ 9 - 1
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)))