Mercurial > emacs
annotate lisp/org/org-gnus.el @ 102611:03183a1400eb
(Vminibuffer_completion_confirm): Doc fix.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Tue, 17 Mar 2009 04:37:41 +0000 |
parents | 6d71fc980cde |
children | dbcad43aecdd |
rev | line source |
---|---|
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
1 ;;; org-gnus.el --- Support for links to Gnus groups and messages from within Org-mode |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
2 |
101515
64ef70f990a9
2009-01-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
101458
diff
changeset
|
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 |
64ef70f990a9
2009-01-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
101458
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
5 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
6 ;; Author: Carsten Dominik <carsten at orgmode dot org> |
99849
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
7 ;; Tassilo Horn <tassilo at member dot fsf dot org> |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
8 ;; Keywords: outlines, hypermedia, calendar, wp |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
9 ;; Homepage: http://orgmode.org |
101757
6d71fc980cde
2009-02-02 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
101702
diff
changeset
|
10 ;; Version: 6.21b |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
11 ;; |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
12 ;; This file is part of GNU Emacs. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
13 ;; |
94676
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94441
diff
changeset
|
14 ;; GNU Emacs is free software: you can redistribute it and/or modify |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
15 ;; it under the terms of the GNU General Public License as published by |
94676
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94441
diff
changeset
|
16 ;; the Free Software Foundation, either version 3 of the License, or |
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94441
diff
changeset
|
17 ;; (at your option) any later version. |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
18 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
19 ;; GNU Emacs is distributed in the hope that it will be useful, |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
22 ;; GNU General Public License for more details. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
23 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
24 ;; You should have received a copy of the GNU General Public License |
94676
ba3167bc4143
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94441
diff
changeset
|
25 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
27 ;; |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
28 ;;; Commentary: |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
29 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
30 ;; This file implements links to Gnus groups and messages from within Org-mode. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
31 ;; Org-mode loads this module by default - if this is not what you want, |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
32 ;; configure the variable `org-modules'. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
33 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
34 ;;; Code: |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
35 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
36 (require 'org) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
37 (eval-when-compile |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
38 (require 'gnus-sum)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
39 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
40 ;; Customization variables |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
41 |
99849
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
42 (when (fboundp 'defvaralias) |
100267
c851df8e004e
2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99866
diff
changeset
|
43 (defvaralias 'org-usenet-links-prefer-google 'org-gnus-prefer-web-links)) |
99849
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
44 |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
45 (defcustom org-gnus-prefer-web-links nil |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
46 "Non-nil means, `org-store-link' will create web links to Google groups. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
47 When nil, Gnus will be used for such links. |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
48 Using a prefix arg to the command \\[org-store-link] (`org-store-link') |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
49 negates this setting for the duration of the command." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
50 :group 'org-link-store |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
51 :type 'boolean) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
52 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
53 ;; Declare external functions and variables |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
54 (declare-function gnus-article-show-summary "gnus-art" ()) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
55 (declare-function gnus-summary-last-subject "gnus-sum" ()) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
56 (defvar gnus-other-frame-object) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
57 (defvar gnus-group-name) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
58 (defvar gnus-article-current) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
59 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
60 ;; Install the link type |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
61 (org-add-link-type "gnus" 'org-gnus-open) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
62 (add-hook 'org-store-link-functions 'org-gnus-store-link) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
63 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
64 ;; Implementation |
99849
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
65 |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
66 (defun org-gnus-group-link (group) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
67 "Create a link to the Gnus group GROUP. |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
68 If GROUP is a newsgroup and `org-gnus-prefer-web-links' is |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
69 non-nil, create a link to groups.google.com or gmane.org. |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
70 Otherwise create a link to the group inside Gnus. |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
71 |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
72 If `org-store-link' was called with a prefix arg the meaning of |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
73 `org-gnus-prefer-web-links' is reversed." |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
74 (let ((unprefixed-group (replace-regexp-in-string "^[^:]+:" "" group))) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
75 (if (and (string-match "^nntp" group) ;; Only for nntp groups |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
76 (org-xor current-prefix-arg |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
77 org-gnus-prefer-web-links)) |
100448
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
78 (org-make-link (if (string-match "gmane" unprefixed-group) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
79 "http://news.gmane.org/" |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
80 "http://groups.google.com/group/") |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
81 unprefixed-group) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
82 (org-make-link "gnus:" group)))) |
99849
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
83 |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
84 (defun org-gnus-article-link (group newsgroups message-id x-no-archive) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
85 "Create a link to a Gnus article. |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
86 The article is specified by its MESSAGE-ID. Additional |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
87 parameters are the Gnus GROUP, the NEWSGROUPS the article was |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
88 posted to and the X-NO-ARCHIVE header value of that article. |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
89 |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
90 If GROUP is a newsgroup and `org-gnus-prefer-web-links' is |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
91 non-nil, create a link to groups.google.com or gmane.org. |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
92 Otherwise create a link to the article inside Gnus. |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
93 |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
94 If `org-store-link' was called with a prefix arg the meaning of |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
95 `org-gnus-prefer-web-links' is reversed." |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
96 (if (and (org-xor current-prefix-arg org-gnus-prefer-web-links) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
97 newsgroups ;; Make web links only for nntp groups |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
98 (not x-no-archive)) ;; and if X-No-Archive isn't set. |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
99 (format (if (string-match "gmane\\." newsgroups) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
100 "http://mid.gmane.org/%s" |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
101 "http://groups.google.com/groups/search?as_umsgid=%s") |
100448
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
102 (org-fixup-message-id-for-http message-id)) |
99849
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
103 (org-make-link "gnus:" group "#" message-id))) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
104 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
105 (defun org-gnus-store-link () |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
106 "Store a link to a Gnus folder or message." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
107 (cond |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
108 ((eq major-mode 'gnus-group-mode) |
99849
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
109 (let* ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
110 (gnus-group-group-name)) ; version |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
111 ((fboundp 'gnus-group-name) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
112 (gnus-group-name)) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
113 (t "???"))) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
114 desc link) |
101458
36abe982e7cd
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100908
diff
changeset
|
115 (when group |
36abe982e7cd
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100908
diff
changeset
|
116 (org-store-link-props :type "gnus" :group group) |
36abe982e7cd
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100908
diff
changeset
|
117 (setq desc (org-gnus-group-link group) |
36abe982e7cd
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100908
diff
changeset
|
118 link desc) |
36abe982e7cd
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100908
diff
changeset
|
119 (org-add-link-props :link link :description desc) |
36abe982e7cd
2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100908
diff
changeset
|
120 link))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
121 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
122 ((memq major-mode '(gnus-summary-mode gnus-article-mode)) |
99849
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
123 (and (eq major-mode 'gnus-summary-mode) (gnus-summary-show-article)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
124 (let* ((group gnus-newsgroup-name) |
99849
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
125 (header (with-current-buffer gnus-article-buffer |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
126 (gnus-summary-toggle-header 1) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
127 (goto-char (point-min)) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
128 (mail-header-extract-no-properties))) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
129 (from (mail-header 'from header)) |
100448
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
130 (message-id (org-remove-angle-brackets |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
131 (mail-header 'message-id header))) |
99849
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
132 (date (mail-header 'date header)) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
133 (to (mail-header 'to header)) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
134 (newsgroups (mail-header 'newsgroups header)) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
135 (x-no-archive (mail-header 'x-no-archive header)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
136 (subject (gnus-summary-subject-string)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
137 desc link) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
138 (org-store-link-props :type "gnus" :from from :subject subject |
98644
e1cc41b9282d
2008-10-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
97027
diff
changeset
|
139 :message-id message-id :group group :to to) |
99849
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
140 (setq desc (org-email-link-description) |
621e15919df0
2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99501
diff
changeset
|
141 link (org-gnus-article-link group newsgroups message-id x-no-archive)) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
142 (org-add-link-props :link link :description desc) |
100267
c851df8e004e
2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99866
diff
changeset
|
143 (gnus-summary-toggle-header -1) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
144 link)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
145 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
146 (defun org-gnus-open (path) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
147 "Follow the Gnus message or folder link specified by PATH." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
148 (let (group article) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
149 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path)) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
150 (error "Error in Gnus link")) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
151 (setq group (match-string 1 path) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
152 article (match-string 3 path)) |
100448
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
153 (when group |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
154 (setq group (org-substring-no-properties group))) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
155 (when article |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
156 (setq article (org-substring-no-properties article))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
157 (org-gnus-follow-link group article))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
158 |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
159 (defun org-gnus-follow-link (&optional group article) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
160 "Follow a Gnus link to GROUP and ARTICLE." |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
161 (require 'gnus) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
162 (funcall (cdr (assq 'gnus org-link-frame-setup))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
163 (if gnus-other-frame-object (select-frame gnus-other-frame-object)) |
100448
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
164 (when group |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
165 (setq group (org-substring-no-properties group))) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
166 (when article |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
167 (setq article (org-substring-no-properties article))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
168 (cond ((and group article) |
100448
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
169 (gnus-activate-group group t) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
170 (condition-case nil |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
171 (let ((articles 1) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
172 group-opened) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
173 (while (and (not group-opened) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
174 ;; stop on integer overflows |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
175 (> articles 0)) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
176 (setq group-opened (gnus-group-read-group articles nil group) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
177 articles (if (< articles 16) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
178 (1+ articles) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
179 (* articles 2)))) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
180 (if group-opened |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
181 (gnus-summary-goto-article article nil t) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
182 (message "Couldn't follow gnus link. %s" |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
183 "The summary couldn't be opened."))) |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
184 (quit (message "Couldn't follow gnus link. %s" |
cea079b68b76
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
100267
diff
changeset
|
185 "The linked group is empty.")))) |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
186 (group (gnus-group-jump-to-group group)))) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
187 |
99501
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99139
diff
changeset
|
188 (defun org-gnus-no-new-news () |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99139
diff
changeset
|
189 "Like `M-x gnus' but doesn't check for new news." |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99139
diff
changeset
|
190 (if (not (gnus-alive-p)) (gnus))) |
e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents:
99139
diff
changeset
|
191 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
192 (provide 'org-gnus) |
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
193 |
94441 | 194 ;; arch-tag: 512e0840-58fa-45b3-b456-71e10fa2376d |
96044
c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
94676
diff
changeset
|
195 |
94414
d86cb59eea9f
2008-04-27 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents:
diff
changeset
|
196 ;;; org-gnus.el ends here |