diff lisp/org/org-gnus.el @ 99849:621e15919df0

2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-dblock-write:clocktable): Make sure the clocktable sees the first line. (org-clock-in): Warn if the clock cannot be resumed. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-open-at-point): Fix mixup about interactive and non-interactive elisp links. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-preprocess-string): Allow one comment line before the first headline to always be included. This is to not miss a commented target. * org-mouse.el (org-mouse-insert-item): Call `org-indent-to-column' instead of `indent-to', for XEmacs compatibility. * org.el (org-refile-targets): Fix customize definition so that it works also in XEmacs. (org-fixup-indentation): Call `org-indent-to-column' instead of `indent-to', for XEmacs compatibility. 2008-11-23 Tokuya Kameshima <kames@fa2.so-net.ne.jp> * org-mew.el (org-mew-store-link): Get the correct case folder for refiled messages. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-as-ascii): Remove the "\\" forced line break indicators. * org.el (org-ido-completing-read): Remove the "i:" prefix for ido-completion propts. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-remember-apply-template): Use `org-substring-no-properties'. * org-compat.el (org-substring-no-properties): New function. * org-remember.el (org-remember-apply-template): Use `org-substring-no-properties' for compatibility. * org-list.el (org-list-two-spaces-after-bullet-regexp): New option. (org-fix-bullet-type): respect `org-list-two-spaces-after-bullet-regexp'. * org-clock.el (org-clock-load): Clean up the code. * org.el (org-adaptive-fill-function): Allow two spaces after "1." as a list bullet. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-save, org-clock-load): Check for live buffers, existing files, and buffer file names to ensure consistent information. (org-clock-persist): Make `clock' a special value of this variable, and improve docstring. * org-list.el (org-cycle-list-bullet, org-fix-bullet-type) (org-get-string-indentation): Adapt indentation when the bullet width changes. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-remember-finalize): Make interactive. (org-remember-kill): New command. (org-remember-finish-immediately): Call `org-remember-finalize' directly. (org-remember-finalize): Make `org-remember-finalize' an interactive function. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-remember-apply-template): No ido completion for free prompts in remember templates. (org-remember-before-finalize-hook): New hook. (org-remember-mode): New minor mode. (org-remember-apply-template): Turn on `org-remember-mode'. * org-id.el (org-id-add-location): Avoid error when no file is given. * org-remember.el (org-remember-apply-template): Fix the way how the list of allowed properties is retrieved from the target file. * org.el (org-insert-link): Improve file link matching. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-colview.el (org-columns-display-here): New argument DATELINE, to trigger using the new face. (org-agenda-colview-summarize): Call `org-columns-display-here' with the new argument. * org-faces.el (org-agenda-column-dateline): New face. * org-publish.el (org-publish-org-index): Use index-title at page title, not as section. * org-exp.el (org-export-html-format-desc): Respect the org-protect property. (org-export-as-html): Protect image specifiers that are in the description part of a link. * org.el (org-sort-entries-or-items, org-completing-read) (org-refile-get-location, org-olpath-completing-read, org-todo) (org-show-todo-tree, org-sparse-tree, org-make-tags-matcher) (org-set-tags, org-change-tag-in-region, org-fast-tag-selection) (org-set-property, org-delete-property) (org-delete-property-globally): Use `org-ido-completing-read'. * org-remember.el (org-remember-apply-template): Use `org-ido-completing-read'. * org-publish.el (org-publish): Use `org-ido-completing-read'. * org-colview.el (org-columns-edit-value, org-columns-new) (org-insert-columns-dblock): Use `org-ido-completing-read'. * org-colview-xemacs.el (org-columns-edit-value) (org-columns-new, org-insert-columns-dblock): Use `org-ido-completing-read'. * org-attach.el (org-attach-delete-one, org-attach-open): Use `org-ido-completing-read'. * org-agenda.el (org-todo-list, org-agenda-filter-by-tag): Use `org-ido-completing-read'. * org.el (org-time-today): New function. (org-matcher-time): Use `org-time-today'. Add special treatment for "<tomorrow>" and "<yesterday>". (org-ido-completing-read): New function. (org-completion-use-ido): New option. * org-exp.el (org-export-format-source-code): Fix bug in require htmlize code. (org-export-target-internal-links): Fix bug in search for text property. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-export-latex.el (org-export-latex-subcontent): Interprete target aliases as additonal labels. * org-exp.el (org-export-target-aliases): New variable. (org-export-preprocess-string) (org-export-handle-invisible-targets): Fill the alias alist. (org-export-as-html): Remove the &nbsp; from the anchor, and also assign an id. (org-html-level-start): Insert the target aliases as additonal anchors. * org.el (org-edit-fixed-width-region): Fix bug when starting a new picture area. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-open-at-mouse): Ensure correct link abbreviations when following a link with the mouse from the agenda. * org-exp.el (org-export-as-html): Avoid lone </div> when no headlines are created. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-link-translation-function): New option. (org-open-at-point): Call `org-link-translation-function' if non-nil. (org-translate-link): New function. (org-translate-link-from-planner): New function. (org-open-at-point): Allow interactive commands in elisp links. * org-exp.el (org-icalendar-cleanup-string): Restore the old iCalendar quoting. The new one seems to caus problems with applications. * org.el (org-yank): Set `this-command' to `yank', so that `yank-pop' will work. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-icalendar-cleanup-string): Improve RFC2455 compliance as far as quoting is concerned. * org.el (org-link-expand-abbrev): Implement %h as an escape for a hexified version of the tag. * org-vm.el (org-vm-follow-link): Require `vm-search'. * org.el (org-up-heading-safe, org-forward-same-level): Always call `org-back-to-heading' instead of `outline-back-to-heading'. (org-back-to-heading): New wrapper around outline-back-to-heading, with a useful error message telling where the error happened. * org-list.el (org-update-checkbox-count): Always call `org-back-to-heading' instead of `outline-back-to-heading'. * org-exp.el (org-export-as-html): Make sure that each <img> tag has an `alt' attribute, to ensure XHTML validation. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-publish.el (org-publish-attachment): Allow publishing to overwrite attachment files. * org-agenda.el (org-agenda-timerange-leaders): New option. (org-agenda-get-blocks): Use `org-agenda-timerange-leaders'. * org.el (org-edit-src-exit): Untabify ASCII image before returning.
author Carsten Dominik <dominik@science.uva.nl>
date Sun, 23 Nov 2008 13:37:44 +0000
parents e3acb52d33e1
children 57447f70a253
line wrap: on
line diff
--- a/lisp/org/org-gnus.el	Sun Nov 23 13:37:03 2008 +0000
+++ b/lisp/org/org-gnus.el	Sun Nov 23 13:37:44 2008 +0000
@@ -3,9 +3,10 @@
 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
+;;         Tassilo Horn <tassilo at member dot fsf dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.12a
+;; Version: 6.13
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -37,7 +38,11 @@
 
 ;; Customization variables
 
-(defcustom org-usenet-links-prefer-google nil
+(when (fboundp 'defvaralias)
+  (defvaralias 'org-usenet-links-prefer-google 'org-gnus-prefer-web-links
+    "Deprecated name for `org-gnus-prefer-web-links'."))
+
+(defcustom org-gnus-prefer-web-links nil
   "Non-nil means, `org-store-link' will create web links to Google groups.
 When nil, Gnus will be used for such links.
 Using a prefix arg to the command \\[org-store-link] (`org-store-link')
@@ -57,50 +62,83 @@
 (add-hook 'org-store-link-functions 'org-gnus-store-link)
 
 ;; Implementation
+
+(defun org-gnus-group-link (group)
+  "Create a link to the Gnus group GROUP.
+If GROUP is a newsgroup and `org-gnus-prefer-web-links' is
+non-nil, create a link to groups.google.com or gmane.org.
+Otherwise create a link to the group inside Gnus.
+
+If `org-store-link' was called with a prefix arg the meaning of
+`org-gnus-prefer-web-links' is reversed."
+  (let ((unprefixed-group (replace-regexp-in-string "^[^:]+:" "" group)))
+    (if (and (string-match "^nntp" group) ;; Only for nntp groups
+	     (org-xor current-prefix-arg
+		      org-gnus-prefer-web-links))
+	(concat (if (string-match "gmane" unprefixed-group)
+		    "http://news.gmane.org/"
+		  "http://groups.google.com/group/")
+		unprefixed-group)
+      (concat "gnus:" group))))
+
+(defun org-gnus-article-link (group newsgroups message-id x-no-archive)
+  "Create a link to a Gnus article.
+The article is specified by its MESSAGE-ID.  Additional
+parameters are the Gnus GROUP, the NEWSGROUPS the article was
+posted to and the X-NO-ARCHIVE header value of that article.
+
+If GROUP is a newsgroup and `org-gnus-prefer-web-links' is
+non-nil, create a link to groups.google.com or gmane.org.
+Otherwise create a link to the article inside Gnus.
+
+If `org-store-link' was called with a prefix arg the meaning of
+`org-gnus-prefer-web-links' is reversed."
+  (if (and (org-xor current-prefix-arg org-gnus-prefer-web-links)
+	   newsgroups	  ;; Make web links only for nntp groups
+	   (not x-no-archive)) ;; and if X-No-Archive isn't set.
+      (format (if (string-match "gmane\\." newsgroups)
+		  "http://mid.gmane.org/%s"
+		"http://groups.google.com/groups/search?as_umsgid=%s")
+	      (org-fixup-message-id-for-http
+	       (replace-regexp-in-string "[<>]" "" message-id)))
+    (org-make-link "gnus:" group "#" message-id)))
+
 (defun org-gnus-store-link ()
   "Store a link to a Gnus folder or message."
   (cond
    ((eq major-mode 'gnus-group-mode)
-    (let ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus
-			(gnus-group-group-name))         ; version
-		       ((fboundp 'gnus-group-name)
-			(gnus-group-name))
-		       (t "???")))
-	  desc link)
+    (let* ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus
+			 (gnus-group-group-name))         ; version
+			((fboundp 'gnus-group-name)
+			 (gnus-group-name))
+			(t "???")))
+	   desc link)
       (unless group (error "Not on a group"))
       (org-store-link-props :type "gnus" :group group)
-      (setq desc (concat
-		  (if (org-xor current-prefix-arg
-			       org-usenet-links-prefer-google)
-		      "http://groups.google.com/groups?group="
-		    "gnus:")
-		  group)
+      (setq desc (org-gnus-group-link group)
 	    link (org-make-link desc))
       (org-add-link-props :link link :description desc)
       link))
 
    ((memq major-mode '(gnus-summary-mode gnus-article-mode))
-    (and (eq major-mode 'gnus-article-mode) (gnus-article-show-summary))
+    (and (eq major-mode 'gnus-summary-mode) (gnus-summary-show-article))
     (let* ((group gnus-newsgroup-name)
-	   (article (gnus-summary-article-number))
-	   (header (gnus-summary-article-header article))
-	   (from (mail-header-from header))
-	   (message-id (mail-header-id header))
-	   (date (mail-header-date header))
-	   (extra (mail-header-extra header))
-	   (to (cdr (assoc 'To extra)))
+	   (header (with-current-buffer gnus-article-buffer
+		     (gnus-summary-toggle-header 1)
+		     (goto-char (point-min))
+		     (mail-header-extract-no-properties)))
+	   (from (mail-header 'from header))
+	   (message-id (mail-header 'message-id header))
+	   (date (mail-header 'date header))
+	   (to (mail-header 'to header))
+	   (newsgroups (mail-header 'newsgroups header))
+	   (x-no-archive (mail-header 'x-no-archive header))
 	   (subject (gnus-summary-subject-string))
 	   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))
-      (if (org-xor current-prefix-arg org-usenet-links-prefer-google)
-	  (setq link
-		(format "http://groups.google.com/groups?as_umsgid=%s"
-			(org-fixup-message-id-for-http message-id)))
-	(setq link (org-make-link "gnus:" group "#"
-				  (or message-id
-				      (number-to-string article)))))
+      (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))))