Просмотр исходного кода

Fix web linking in org-gnus.el

Reported by Matt Lundin, fixed by Leo.
Carsten Dominik 15 лет назад
Родитель
Сommit
d30e537868
2 измененных файлов с 17 добавлено и 7 удалено
  1. 5 0
      lisp/ChangeLog
  2. 12 7
      lisp/org-gnus.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2009-08-31  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-gnus.el (org-gnus-store-link): Restore the linking to a
+	website.
+
 2009-08-29  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-clock.el (org-clock-modify-effort-estimate): Emit message

+ 12 - 7
lisp/org-gnus.el

@@ -120,24 +120,29 @@ If `org-store-link' was called with a prefix arg the meaning of
 	      link desc)
 	(org-add-link-props :link link :description desc)
 	link)))
-   
+
    ((memq major-mode '(gnus-summary-mode gnus-article-mode))
     (let* ((group gnus-newsgroup-name)
    	   (header (with-current-buffer gnus-summary-buffer
 		     (gnus-summary-article-header)))
-	   (extra (mail-header-extra header))
 	   (from (mail-header-from header))
 	   (message-id (org-remove-angle-brackets (mail-header-id header)))
 	   (date (mail-header-date header))
-	   (to (cdr (assoc 'To extra)))
-	   (newsgroups (cdr (assoc 'newsgroup extra)))
-	   (x-no-archive (cdr (assoc 'x-no-archive extra)))
 	   (subject (mail-header-subject header))
-	   desc link)
+           (to (cdr (assq 'To (mail-header-extra header))))
+           newsgroups x-no-archive desc link)
+      ;; Fetching an article is an expensive operation; newsgroup and
+      ;; x-no-archive are only needed for web links.
+      (when (org-xor current-prefix-arg org-gnus-prefer-web-links)
+        ;; Make sure the original article buffer is up-to-date
+        (save-window-excursion (gnus-summary-select-article))
+        (setq to (or to (gnus-fetch-original-field "To"))
+              newsgroups (gnus-fetch-original-field "Newsgroups")
+              x-no-archive (gnus-fetch-original-field "x-no-archive")))
       (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 
+	    link (org-gnus-article-link
 		  group	newsgroups message-id x-no-archive))
       (org-add-link-props :link link :description desc)
       link))))