Browse Source

org-gnus.el: Handle `gnus-summary-mode' and `gnus-article-mode' separately.

Use `gnus-summary-article-header' function when in gnus-summary-mode.
This way the article doesn't get displayed unnecessarily.  We don't use
this function in the gnus-article-mode because it is not reliable.

Thanks to Leo for this suggestion.
Bastien Guerry 15 years ago
parent
commit
486e807b1b
2 changed files with 26 additions and 4 deletions
  1. 6 0
      lisp/ChangeLog
  2. 20 4
      lisp/org-gnus.el

+ 6 - 0
lisp/ChangeLog

@@ -1,3 +1,9 @@
+2009-08-23  Bastien Guerry  <bzg@altern.org>
+
+	* org-gnus.el (org-gnus-store-link): Handle `gnus-summary-mode'
+	and `gnus-article-mode' separately.
+	(gnus-summary-article-header): Fix the declare-function.
+
 2009-08-23  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-exp.el (org-export-format-source-code-or-example): Translate

+ 20 - 4
lisp/org-gnus.el

@@ -51,8 +51,7 @@ negates this setting for the duration of the command."
   :type 'boolean)
 
 ;; Declare external functions and variables
-(declare-function gnus-article-show-summary "gnus-art" ())
-(declare-function gnus-summary-last-subject "gnus-sum" ())
+(declare-function gnus-summary-article-header "gnus-sum" (&optional number))
 (declare-function message-fetch-field "message" (header &optional not-all))
 (declare-function message-narrow-to-head-1 "message" nil)
 
@@ -122,8 +121,25 @@ If `org-store-link' was called with a prefix arg the meaning of
 	(org-add-link-props :link link :description desc)
 	link)))
 
-   ((memq major-mode '(gnus-summary-mode gnus-article-mode))
-    (and (eq major-mode 'gnus-summary-mode) (gnus-summary-show-article))
+   ((eq major-mode 'gnus-summary-mode)
+    (let* ((group gnus-newsgroup-name)
+    	   (header (save-excursion (gnus-summary-article-header)))
+	   (from (aref header 2))
+	   (message-id (org-remove-angle-brackets (aref header 4)))
+	   (date (aref header 3))
+	   (to (cdr (assoc 'To (aref header 9))))
+	   (newsgroups (cdr (assoc 'newsgroup (aref header 9))))
+	   (x-no-archive (cdr (assoc 'x-no-archive (aref header 9))))
+	   (subject (aref header 1))
+	   desc link)
+      (org-store-link-props :type "gnus" :from from :subject subject
+			    :message-id message-id :group group :to to)
+      (setq desc (org-email-link-description)
+	    link (org-gnus-article-link group newsgroups message-id x-no-archive))
+      (org-add-link-props :link link :description desc)
+      link))
+
+   ((eq major-mode 'gnus-article-mode)
     (let* ((group gnus-newsgroup-name)
 	   (header (with-current-buffer gnus-article-buffer
 		     (gnus-summary-toggle-header 1)