annotate lisp/gnus/gnus-art.el @ 151:59463afc5666 r20-3b2

Import from CVS: tag r20-3b2
author cvs
date Mon, 13 Aug 2007 09:37:19 +0200
parents 318232e2a3f0
children 25f70ba0133c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1 ;;; gnus-art.el --- article mode commands for Gnus
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
5 ;; Keywords: news
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
6
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
8
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
12 ;; any later version.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
13
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
17 ;; GNU General Public License for more details.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
18
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
23
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
24 ;;; Commentary:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
25
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
26 ;;; Code:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
27
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
28 (require 'custom)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
29 (require 'gnus)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
30 (require 'gnus-sum)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
31 (require 'gnus-spec)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
32 (require 'gnus-int)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
33 (require 'browse-url)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
34
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
35 (defgroup gnus-article nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
36 "Article display."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
37 :link '(custom-manual "(gnus)The Article Buffer")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
38 :group 'gnus)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
39
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
40 (defgroup gnus-article-hiding nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
41 "Hiding article parts."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
42 :link '(custom-manual "(gnus)Article Hiding")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
43 :group 'gnus-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
44
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
45 (defgroup gnus-article-highlight nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
46 "Article highlighting."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
47 :link '(custom-manual "(gnus)Article Highlighting")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
48 :group 'gnus-article
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
49 :group 'gnus-visual)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
50
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
51 (defgroup gnus-article-signature nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
52 "Article signatures."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
53 :link '(custom-manual "(gnus)Article Signature")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
54 :group 'gnus-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
55
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
56 (defgroup gnus-article-headers nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
57 "Article headers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
58 :link '(custom-manual "(gnus)Hiding Headers")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
59 :group 'gnus-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
60
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
61 (defgroup gnus-article-washing nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
62 "Special commands on articles."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
63 :link '(custom-manual "(gnus)Article Washing")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
64 :group 'gnus-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
65
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
66 (defgroup gnus-article-emphasis nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
67 "Fontisizing articles."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
68 :link '(custom-manual "(gnus)Article Fontisizing")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
69 :group 'gnus-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
70
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
71 (defgroup gnus-article-saving nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
72 "Saving articles."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
73 :link '(custom-manual "(gnus)Saving Articles")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
74 :group 'gnus-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
75
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
76 (defgroup gnus-article-mime nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
77 "Worshiping the MIME wonder."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
78 :link '(custom-manual "(gnus)Using MIME")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
79 :group 'gnus-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
80
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
81 (defgroup gnus-article-buttons nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
82 "Pushable buttons in the article buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
83 :link '(custom-manual "(gnus)Article Buttons")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
84 :group 'gnus-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
85
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
86 (defgroup gnus-article-various nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
87 "Other article options."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
88 :link '(custom-manual "(gnus)Misc Article")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
89 :group 'gnus-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
90
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
91 (defcustom gnus-ignored-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
92 '("^Path:" "^Posting-Version:" "^Article-I.D.:" "^Expires:"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
93 "^Date-Received:" "^References:" "^Control:" "^Xref:" "^Lines:"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
94 "^Posted:" "^Relay-Version:" "^Message-ID:" "^Nf-ID:" "^Nf-From:"
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
95 "^Approved:" "^Sender:" "^Received:" "^Mail-from:")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
96 "All headers that match this regexp will be hidden.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
97 This variable can also be a list of regexps of headers to be ignored.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
98 If `gnus-visible-headers' is non-nil, this variable will be ignored."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
99 :type '(choice :custom-show nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
100 regexp
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
101 (repeat regexp))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
102 :group 'gnus-article-hiding)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
103
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
104 (defcustom gnus-visible-headers
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
105 "^From:\\|^Newsgroups:\\|^Subject:\\|^Date:\\|^Followup-To:\\|^Reply-To:\\|^Organization:\\|^Summary:\\|^Keywords:\\|^To:\\|^Cc:\\|^Posted-To:\\|^Mail-Copies-To:\\|^Apparently-To:\\|^Gnus-Warning:\\|^Resent-From"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
106 "All headers that do not match this regexp will be hidden.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
107 This variable can also be a list of regexp of headers to remain visible.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
108 If this variable is non-nil, `gnus-ignored-headers' will be ignored."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
109 :type '(repeat :value-to-internal (lambda (widget value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
110 (custom-split-regexp-maybe value))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
111 :match (lambda (widget value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
112 (or (stringp value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
113 (widget-editable-list-match widget value)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
114 regexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
115 :group 'gnus-article-hiding)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
116
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
117 (defcustom gnus-sorted-header-list
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
118 '("^From:" "^Subject:" "^Summary:" "^Keywords:" "^Newsgroups:"
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
119 "^Followup-To:" "^To:" "^Cc:" "^Date:" "^Organization:")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
120 "This variable is a list of regular expressions.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
121 If it is non-nil, headers that match the regular expressions will
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
122 be placed first in the article buffer in the sequence specified by
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
123 this list."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
124 :type '(repeat regexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
125 :group 'gnus-article-hiding)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
126
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
127 (defcustom gnus-boring-article-headers '(empty followup-to reply-to)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
128 "Headers that are only to be displayed if they have interesting data.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
129 Possible values in this list are `empty', `newsgroups', `followup-to',
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
130 `reply-to', and `date'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
131 :type '(set (const :tag "Headers with no content." empty)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
132 (const :tag "Newsgroups with only one group." newsgroups)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
133 (const :tag "Followup-to identical to newsgroups." followup-to)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
134 (const :tag "Reply-to identical to from." reply-to)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
135 (const :tag "Date less than four days old." date))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
136 :group 'gnus-article-hiding)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
137
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
138 (defcustom gnus-signature-separator '("^-- $" "^-- *$")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
139 "Regexp matching signature separator.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
140 This can also be a list of regexps. In that case, it will be checked
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
141 from head to tail looking for a separator. Searches will be done from
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
142 the end of the buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
143 :type '(repeat string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
144 :group 'gnus-article-signature)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
145
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
146 (defcustom gnus-signature-limit nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
147 "Provide a limit to what is considered a signature.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
148 If it is a number, no signature may not be longer (in characters) than
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
149 that number. If it is a floating point number, no signature may be
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
150 longer (in lines) than that number. If it is a function, the function
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
151 will be called without any parameters, and if it returns nil, there is
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
152 no signature in the buffer. If it is a string, it will be used as a
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
153 regexp. If it matches, the text in question is not a signature."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
154 :type '(choice integer number function regexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
155 :group 'gnus-article-signature)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
156
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
157 (defcustom gnus-hidden-properties '(invisible t intangible t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
158 "Property list to use for hiding text."
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
159 :type 'sexp
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
160 :group 'gnus-article-hiding)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
161
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
162 (defcustom gnus-article-x-face-command
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
163 "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | xv -quit -"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
164 "String or function to be executed to display an X-Face header.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
165 If it is a string, the command will be executed in a sub-shell
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
166 asynchronously. The compressed face will be piped to this command."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
167 :type 'string ;Leave function case to Lisp.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
168 :group 'gnus-article-washing)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
169
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
170 (defcustom gnus-article-x-face-too-ugly nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
171 "Regexp matching posters whose face shouldn't be shown automatically."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
172 :type 'regexp
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
173 :group 'gnus-article-washing)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
174
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
175 (defcustom gnus-emphasis-alist
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
176 (let ((format
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
177 "\\(\\s-\\|^\\|[-\"]\\|\\s(\\|\\s)\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\\(\\s-\\|[-?!.,;:\"]\\|\\s(\\|\\s)\\)")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
178 (types
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
179 '(("_" "_" underline)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
180 ("/" "/" italic)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
181 ("\\*" "\\*" bold)
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
182 ("_/" "/_" underline-italic)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
183 ("_\\*" "\\*_" underline-bold)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
184 ("\\*/" "/\\*" bold-italic)
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
185 ("_\\*/" "/\\*_" underline-bold-italic))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
186 `(("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_[^_]\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
187 2 3 gnus-emphasis-underline)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
188 ,@(mapcar
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
189 (lambda (spec)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
190 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
191 (format format (car spec) (cadr spec))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
192 2 3 (intern (format "gnus-emphasis-%s" (caddr spec)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
193 types)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
194 "Alist that says how to fontify certain phrases.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
195 Each item looks like this:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
196
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
197 (\"_\\\\(\\\\w+\\\\)_\" 0 1 'underline)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
198
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
199 The first element is a regular expression to be matched. The second
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
200 is a number that says what regular expression grouping used to find
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
201 the entire emphasized word. The third is a number that says what
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
202 regexp grouping should be displayed and highlighted. The fourth
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
203 is the face used for highlighting."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
204 :type '(repeat (list :value ("" 0 0 default)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
205 regexp
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
206 (integer :tag "Match group")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
207 (integer :tag "Emphasize group")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
208 face))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
209 :group 'gnus-article-emphasis)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
210
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
211 (defface gnus-emphasis-bold '((t (:bold t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
212 "Face used for displaying strong emphasized text (*word*)."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
213 :group 'gnus-article-emphasis)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
214
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
215 (defface gnus-emphasis-italic '((t (:italic t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
216 "Face used for displaying italic emphasized text (/word/)."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
217 :group 'gnus-article-emphasis)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
218
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
219 (defface gnus-emphasis-underline '((t (:underline t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
220 "Face used for displaying underlined emphasized text (_word_)."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
221 :group 'gnus-article-emphasis)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
222
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
223 (defface gnus-emphasis-underline-bold '((t (:bold t :underline t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
224 "Face used for displaying underlined bold emphasized text (_*word*_)."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
225 :group 'gnus-article-emphasis)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
226
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
227 (defface gnus-emphasis-underline-italic '((t (:italic t :underline t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
228 "Face used for displaying underlined italic emphasized text (_*word*_)."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
229 :group 'gnus-article-emphasis)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
230
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
231 (defface gnus-emphasis-bold-italic '((t (:bold t :italic t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
232 "Face used for displaying bold italic emphasized text (/*word*/)."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
233 :group 'gnus-article-emphasis)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
234
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
235 (defface gnus-emphasis-underline-bold-italic
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
236 '((t (:bold t :italic t :underline t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
237 "Face used for displaying underlined bold italic emphasized text.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
238 Esample: (_/*word*/_)."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
239 :group 'gnus-article-emphasis)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
240
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
241 (defcustom gnus-article-time-format "%a, %b %d %Y %T %Z"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
242 "Format for display of Date headers in article bodies.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
243 See `format-time-zone' for the possible values."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
244 :type 'string
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
245 :link '(custom-manual "(gnus)Article Date")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
246 :group 'gnus-article-washing)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
247
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
248 (eval-and-compile
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
249 (autoload 'hexl-hex-string-to-integer "hexl")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
250 (autoload 'timezone-make-date-arpa-standard "timezone")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
251 (autoload 'mail-extract-address-components "mail-extr"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
252
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
253 (defcustom gnus-save-all-headers t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
254 "*If non-nil, don't remove any headers before saving."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
255 :group 'gnus-article-saving
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
256 :type 'boolean)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
257
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
258 (defcustom gnus-prompt-before-saving 'always
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
259 "*This variable says how much prompting is to be done when saving articles.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
260 If it is nil, no prompting will be done, and the articles will be
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
261 saved to the default files. If this variable is `always', each and
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
262 every article that is saved will be preceded by a prompt, even when
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
263 saving large batches of articles. If this variable is neither nil not
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
264 `always', there the user will be prompted once for a file name for
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
265 each invocation of the saving commands."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
266 :group 'gnus-article-saving
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
267 :type '(choice (item always)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
268 (item :tag "never" nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
269 (sexp :tag "once" :format "%t")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
270
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
271 (defcustom gnus-saved-headers gnus-visible-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
272 "Headers to keep if `gnus-save-all-headers' is nil.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
273 If `gnus-save-all-headers' is non-nil, this variable will be ignored.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
274 If that variable is nil, however, all headers that match this regexp
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
275 will be kept while the rest will be deleted before saving."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
276 :group 'gnus-article-saving
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
277 :type '(repeat string))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
278
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
279 (defcustom gnus-default-article-saver 'gnus-summary-save-in-rmail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
280 "A function to save articles in your favourite format.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
281 The function must be interactively callable (in other words, it must
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
282 be an Emacs command).
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
283
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
284 Gnus provides the following functions:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
285
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
286 * gnus-summary-save-in-rmail (Rmail format)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
287 * gnus-summary-save-in-mail (Unix mail format)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
288 * gnus-summary-save-in-folder (MH folder)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
289 * gnus-summary-save-in-file (article format)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
290 * gnus-summary-save-in-vm (use VM's folder format)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
291 * gnus-summary-write-to-file (article format -- overwrite)."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
292 :group 'gnus-article-saving
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
293 :type '(radio (function-item gnus-summary-save-in-rmail)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
294 (function-item gnus-summary-save-in-mail)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
295 (function-item gnus-summary-save-in-folder)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
296 (function-item gnus-summary-save-in-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
297 (function-item gnus-summary-save-in-vm)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
298 (function-item gnus-summary-write-to-file)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
299
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
300 (defcustom gnus-rmail-save-name 'gnus-plain-save-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
301 "A function generating a file name to save articles in Rmail format.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
302 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
303 :group 'gnus-article-saving
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
304 :type 'function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
305
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
306 (defcustom gnus-mail-save-name 'gnus-plain-save-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
307 "A function generating a file name to save articles in Unix mail format.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
308 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
309 :group 'gnus-article-saving
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
310 :type 'function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
311
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
312 (defcustom gnus-folder-save-name 'gnus-folder-save-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
313 "A function generating a file name to save articles in MH folder.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
314 The function is called with NEWSGROUP, HEADERS, and optional LAST-FOLDER."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
315 :group 'gnus-article-saving
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
316 :type 'function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
317
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
318 (defcustom gnus-file-save-name 'gnus-numeric-save-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
319 "A function generating a file name to save articles in article format.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
320 The function is called with NEWSGROUP, HEADERS, and optional
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
321 LAST-FILE."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
322 :group 'gnus-article-saving
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
323 :type 'function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
324
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
325 (defcustom gnus-split-methods
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
326 '((gnus-article-archive-name)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
327 (gnus-article-nndoc-name))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
328 "Variable used to suggest where articles are to be saved.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
329 For instance, if you would like to save articles related to Gnus in
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
330 the file \"gnus-stuff\", and articles related to VM in \"vm-stuff\",
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
331 you could set this variable to something like:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
332
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
333 '((\"^Subject:.*gnus\\|^Newsgroups:.*gnus\" \"gnus-stuff\")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
334 (\"^Subject:.*vm\\|^Xref:.*vm\" \"vm-stuff\"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
335
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
336 This variable is an alist where the where the key is the match and the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
337 value is a list of possible files to save in if the match is non-nil.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
338
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
339 If the match is a string, it is used as a regexp match on the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
340 article. If the match is a symbol, that symbol will be funcalled
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
341 from the buffer of the article to be saved with the newsgroup as the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
342 parameter. If it is a list, it will be evaled in the same buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
343
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
344 If this form or function returns a string, this string will be used as
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
345 a possible file name; and if it returns a non-nil list, that list will
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
346 be used as possible file names."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
347 :group 'gnus-article-saving
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
348 :type '(repeat (choice (list function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
349 (cons regexp (repeat string))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
350 sexp)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
351
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
352 (defcustom gnus-strict-mime t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
353 "*If nil, MIME-decode even if there is no Mime-Version header."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
354 :group 'gnus-article-mime
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
355 :type 'boolean)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
356
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
357 (defcustom gnus-show-mime-method 'metamail-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
358 "Function to process a MIME message.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
359 The function is called from the article buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
360 :group 'gnus-article-mime
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
361 :type 'function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
362
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
363 (defcustom gnus-decode-encoded-word-method 'gnus-article-de-quoted-unreadable
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
364 "*Function to decode MIME encoded words.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
365 The function is called from the article buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
366 :group 'gnus-article-mime
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
367 :type 'function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
368
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
369 (defcustom gnus-page-delimiter "^\^L"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
370 "*Regexp describing what to use as article page delimiters.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
371 The default value is \"^\^L\", which is a form linefeed at the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
372 beginning of a line."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
373 :type 'regexp
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
374 :group 'gnus-article-various)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
375
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
376 (defcustom gnus-article-mode-line-format "Gnus: %%b %S"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
377 "*The format specification for the article mode line.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
378 See `gnus-summary-mode-line-format' for a closer description."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
379 :type 'string
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
380 :group 'gnus-article-various)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
381
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
382 (defcustom gnus-article-mode-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
383 "*A hook for Gnus article mode."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
384 :type 'hook
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
385 :group 'gnus-article-various)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
386
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
387 (defcustom gnus-article-menu-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
388 "*Hook run after the creation of the article mode menu."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
389 :type 'hook
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
390 :group 'gnus-article-various)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
391
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
392 (defcustom gnus-article-prepare-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
393 "*A hook called after an article has been prepared in the article buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
394 If you want to run a special decoding program like nkf, use this hook."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
395 :type 'hook
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
396 :group 'gnus-article-various)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
397
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 144
diff changeset
398 (defcustom gnus-article-hide-pgp-hook nil
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 144
diff changeset
399 "*A hook called after successfully hiding a PGP signature."
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 144
diff changeset
400 :type 'hook
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 144
diff changeset
401 :group 'gnus-article-various)
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 144
diff changeset
402
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
403 (defcustom gnus-article-button-face 'bold
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
404 "Face used for highlighting buttons in the article buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
405
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
406 An article button is a piece of text that you can activate by pressing
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
407 `RET' or `mouse-2' above it."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
408 :type 'face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
409 :group 'gnus-article-buttons)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
410
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
411 (defcustom gnus-article-mouse-face 'highlight
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
412 "Face used for mouse highlighting in the article buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
413
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
414 Article buttons will be displayed in this face when the cursor is
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
415 above them."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
416 :type 'face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
417 :group 'gnus-article-buttons)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
418
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
419 (defcustom gnus-signature-face 'gnus-signature-face
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
420 "Face used for highlighting a signature in the article buffer.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
421 Obsolete; use the face `gnus-signature-face' for customizations instead."
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
422 :type 'face
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
423 :group 'gnus-article-highlight
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
424 :group 'gnus-article-signature)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
425
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
426 (defface gnus-signature-face
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
427 '((((type x))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
428 (:italic t)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
429 "Face used for highlighting a signature in the article buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
430 :group 'gnus-article-highlight
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
431 :group 'gnus-article-signature)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
432
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
433 (defface gnus-header-from-face
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
434 '((((class color)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
435 (background dark))
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
436 (:foreground "spring green" :bold t))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
437 (((class color)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
438 (background light))
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
439 (:foreground "red3" :bold t))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
440 (t
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
441 (:bold t :italic t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
442 "Face used for displaying from headers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
443 :group 'gnus-article-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
444 :group 'gnus-article-highlight)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
445
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
446 (defface gnus-header-subject-face
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
447 '((((class color)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
448 (background dark))
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
449 (:foreground "SeaGreen3" :bold t))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
450 (((class color)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
451 (background light))
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
452 (:foreground "red4" :bold t))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
453 (t
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
454 (:bold t :italic t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
455 "Face used for displaying subject headers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
456 :group 'gnus-article-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
457 :group 'gnus-article-highlight)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
458
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
459 (defface gnus-header-newsgroups-face
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
460 '((((class color)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
461 (background dark))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
462 (:foreground "yellow" :bold t :italic t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
463 (((class color)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
464 (background light))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
465 (:foreground "MidnightBlue" :bold t :italic t))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
466 (t
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
467 (:bold t :italic t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
468 "Face used for displaying newsgroups headers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
469 :group 'gnus-article-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
470 :group 'gnus-article-highlight)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
471
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
472 (defface gnus-header-name-face
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
473 '((((class color)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
474 (background dark))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
475 (:foreground "SeaGreen"))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
476 (((class color)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
477 (background light))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
478 (:foreground "maroon"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
479 (t
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
480 (:bold t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
481 "Face used for displaying header names."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
482 :group 'gnus-article-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
483 :group 'gnus-article-highlight)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
484
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
485 (defface gnus-header-content-face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
486 '((((class color)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
487 (background dark))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
488 (:foreground "forest green" :italic t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
489 (((class color)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
490 (background light))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
491 (:foreground "indianred4" :italic t))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
492 (t
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
493 (:italic t))) "Face used for displaying header content."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
494 :group 'gnus-article-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
495 :group 'gnus-article-highlight)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
496
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
497 (defcustom gnus-header-face-alist
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
498 '(("From" nil gnus-header-from-face)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
499 ("Subject" nil gnus-header-subject-face)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
500 ("Newsgroups:.*," nil gnus-header-newsgroups-face)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
501 ("" gnus-header-name-face gnus-header-content-face))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
502 "Controls highlighting of article header.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
503
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
504 An alist of the form (HEADER NAME CONTENT).
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
505
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
506 HEADER is a regular expression which should match the name of an
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
507 header header and NAME and CONTENT are either face names or nil.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
508
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
509 The name of each header field will be displayed using the face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
510 specified by the first element in the list where HEADER match the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
511 header name and NAME is non-nil. Similarly, the content will be
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
512 displayed by the first non-nil matching CONTENT face."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
513 :group 'gnus-article-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
514 :group 'gnus-article-highlight
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
515 :type '(repeat (list (regexp :tag "Header")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
516 (choice :tag "Name"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
517 (item :tag "skip" nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
518 (face :value default))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
519 (choice :tag "Content"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
520 (item :tag "skip" nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
521 (face :value default)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
522
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
523 ;;; Internal variables
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
524
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
525 (defvar gnus-article-mode-syntax-table
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
526 (let ((table (copy-syntax-table text-mode-syntax-table)))
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
527 (modify-syntax-entry ?- "w" table)
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
528 (modify-syntax-entry ?> ")" table)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
529 (modify-syntax-entry ?< "(" table)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
530 table)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
531 "Syntax table used in article mode buffers.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
532 Initialized from `text-mode-syntax-table.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
533
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
534 (defvar gnus-save-article-buffer nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
535
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
536 (defvar gnus-article-mode-line-format-alist
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
537 (nconc '((?w (gnus-article-wash-status) ?s))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
538 gnus-summary-mode-line-format-alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
539
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
540 (defvar gnus-number-of-articles-to-be-saved nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
541
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
542 (defvar gnus-inhibit-hiding nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
543
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
544 (defsubst gnus-article-hide-text (b e props)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
545 "Set text PROPS on the B to E region, extending `intangible' 1 past B."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
546 (add-text-properties b e props)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
547 (when (memq 'intangible props)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
548 (put-text-property
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
549 (max (1- b) (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
550 b 'intangible (cddr (memq 'intangible props)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
551
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
552 (defsubst gnus-article-unhide-text (b e)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
553 "Remove hidden text properties from region between B and E."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
554 (remove-text-properties b e gnus-hidden-properties)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
555 (when (memq 'intangible gnus-hidden-properties)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
556 (put-text-property (max (1- b) (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
557 b 'intangible nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
558
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
559 (defun gnus-article-hide-text-type (b e type)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
560 "Hide text of TYPE between B and E."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
561 (gnus-article-hide-text
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
562 b e (cons 'article-type (cons type gnus-hidden-properties))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
563
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
564 (defun gnus-article-unhide-text-type (b e type)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
565 "Hide text of TYPE between B and E."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
566 (remove-text-properties
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
567 b e (cons 'article-type (cons type gnus-hidden-properties)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
568 (when (memq 'intangible gnus-hidden-properties)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
569 (put-text-property (max (1- b) (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
570 b 'intangible nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
571
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
572 (defun gnus-article-hide-text-of-type (type)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
573 "Hide text of TYPE in the current buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
574 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
575 (let ((b (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
576 (e (point-max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
577 (while (setq b (text-property-any b e 'article-type type))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
578 (add-text-properties b (incf b) gnus-hidden-properties)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
579
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
580 (defun gnus-article-delete-text-of-type (type)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
581 "Delete text of TYPE in the current buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
582 (save-excursion
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
583 (let ((e (point-min))
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
584 b)
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
585 (while (setq b (text-property-any e (point-max) 'article-type type))
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
586 (setq e (text-property-not-all b (point-max) 'article-type type))
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
587 (delete-region b e)))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
588
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
589 (defun gnus-article-delete-invisible-text ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
590 "Delete all invisible text in the current buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
591 (save-excursion
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
592 (let ((e (point-min))
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
593 b)
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
594 (while (setq b (text-property-any e (point-max) 'invisible t))
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
595 (setq e (text-property-not-all b (point-max) 'invisible t))
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
596 (delete-region b e)))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
597
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
598 (defun gnus-article-text-type-exists-p (type)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
599 "Say whether any text of type TYPE exists in the buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
600 (text-property-any (point-min) (point-max) 'article-type type))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
601
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
602 (defsubst gnus-article-header-rank ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
603 "Give the rank of the string HEADER as given by `gnus-sorted-header-list'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
604 (let ((list gnus-sorted-header-list)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
605 (i 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
606 (while list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
607 (when (looking-at (car list))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
608 (setq list nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
609 (setq list (cdr list))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
610 (incf i))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
611 i))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
612
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
613 (defun article-hide-headers (&optional arg delete)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
614 "Toggle whether to hide unwanted headers and possibly sort them as well.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
615 If given a negative prefix, always show; if given a positive prefix,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
616 always hide."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
617 (interactive (gnus-article-hidden-arg))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
618 (if (gnus-article-check-hidden-text 'headers arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
619 ;; Show boring headers as well.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
620 (gnus-article-show-hidden-text 'boring-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
621 ;; This function might be inhibited.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
622 (unless gnus-inhibit-hiding
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
623 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
624 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
625 (let ((buffer-read-only nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
626 (props (nconc (list 'article-type 'headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
627 gnus-hidden-properties))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
628 (max (1+ (length gnus-sorted-header-list)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
629 (ignored (when (not gnus-visible-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
630 (cond ((stringp gnus-ignored-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
631 gnus-ignored-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
632 ((listp gnus-ignored-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
633 (mapconcat 'identity gnus-ignored-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
634 "\\|")))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
635 (visible
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
636 (cond ((stringp gnus-visible-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
637 gnus-visible-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
638 ((and gnus-visible-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
639 (listp gnus-visible-headers))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
640 (mapconcat 'identity gnus-visible-headers "\\|"))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
641 (inhibit-point-motion-hooks t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
642 want-list beg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
643 ;; First we narrow to just the headers.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
644 (widen)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
645 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
646 ;; Hide any "From " lines at the beginning of (mail) articles.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
647 (while (looking-at "From ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
648 (forward-line 1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
649 (unless (bobp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
650 (if delete
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
651 (delete-region (point-min) (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
652 (gnus-article-hide-text (point-min) (point) props)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
653 ;; Then treat the rest of the header lines.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
654 (narrow-to-region
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
655 (point)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
656 (if (search-forward "\n\n" nil t) ; if there's a body
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
657 (progn (forward-line -1) (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
658 (point-max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
659 ;; Then we use the two regular expressions
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
660 ;; `gnus-ignored-headers' and `gnus-visible-headers' to
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
661 ;; select which header lines is to remain visible in the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
662 ;; article buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
663 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
664 (while (re-search-forward "^[^ \t]*:" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
665 (beginning-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
666 ;; Mark the rank of the header.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
667 (put-text-property
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
668 (point) (1+ (point)) 'message-rank
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
669 (if (or (and visible (looking-at visible))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
670 (and ignored
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
671 (not (looking-at ignored))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
672 (gnus-article-header-rank)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
673 (+ 2 max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
674 (forward-line 1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
675 (message-sort-headers-1)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
676 (when (setq beg (text-property-any
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
677 (point-min) (point-max) 'message-rank (+ 2 max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
678 ;; We make the unwanted headers invisible.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
679 (if delete
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
680 (delete-region beg (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
681 ;; Suggested by Sudish Joseph <joseph@cis.ohio-state.edu>.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
682 (gnus-article-hide-text-type beg (point-max) 'headers))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
683 ;; Work around XEmacs lossage.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
684 (put-text-property (point-min) beg 'invisible nil))))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
685
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
686 (defun article-hide-boring-headers (&optional arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
687 "Toggle hiding of headers that aren't very interesting.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
688 If given a negative prefix, always show; if given a positive prefix,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
689 always hide."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
690 (interactive (gnus-article-hidden-arg))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
691 (when (and (not (gnus-article-check-hidden-text 'boring-headers arg))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
692 (not gnus-show-all-headers))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
693 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
694 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
695 (let ((buffer-read-only nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
696 (list gnus-boring-article-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
697 (inhibit-point-motion-hooks t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
698 elem)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
699 (nnheader-narrow-to-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
700 (while list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
701 (setq elem (pop list))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
702 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
703 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
704 ;; Hide empty headers.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
705 ((eq elem 'empty)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
706 (while (re-search-forward "^[^:]+:[ \t]*\n[^ \t]" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
707 (forward-line -1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
708 (gnus-article-hide-text-type
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
709 (progn (beginning-of-line) (point))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
710 (progn
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
711 (end-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
712 (if (re-search-forward "^[^ \t]" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
713 (match-beginning 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
714 (point-max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
715 'boring-headers)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
716 ;; Hide boring Newsgroups header.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
717 ((eq elem 'newsgroups)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
718 (when (equal (gnus-fetch-field "newsgroups")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
719 (gnus-group-real-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
720 (if (boundp 'gnus-newsgroup-name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
721 gnus-newsgroup-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
722 "")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
723 (gnus-article-hide-header "newsgroups")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
724 ((eq elem 'followup-to)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
725 (when (equal (message-fetch-field "followup-to")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
726 (message-fetch-field "newsgroups"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
727 (gnus-article-hide-header "followup-to")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
728 ((eq elem 'reply-to)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
729 (let ((from (message-fetch-field "from"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
730 (reply-to (message-fetch-field "reply-to")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
731 (when (and
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
732 from reply-to
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
733 (ignore-errors
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
734 (equal
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
735 (nth 1 (mail-extract-address-components from))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
736 (nth 1 (mail-extract-address-components reply-to)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
737 (gnus-article-hide-header "reply-to"))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
738 ((eq elem 'date)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
739 (let ((date (message-fetch-field "date")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
740 (when (and date
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
741 (< (gnus-days-between (current-time-string) date)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
742 4))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
743 (gnus-article-hide-header "date")))))))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
744
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
745 (defun gnus-article-hide-header (header)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
746 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
747 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
748 (when (re-search-forward (concat "^" header ":") nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
749 (gnus-article-hide-text-type
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
750 (progn (beginning-of-line) (point))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
751 (progn
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
752 (end-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
753 (if (re-search-forward "^[^ \t]" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
754 (match-beginning 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
755 (point-max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
756 'boring-headers))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
757
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
758 ;; Written by Per Abrahamsen <amanda@iesd.auc.dk>.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
759 (defun article-treat-overstrike ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
760 "Translate overstrikes into bold text."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
761 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
762 (save-excursion
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
763 (goto-char (point-min))
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
764 (when (search-forward "\n\n" nil t)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
765 (let ((buffer-read-only nil))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
766 (while (search-forward "\b" nil t)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
767 (let ((next (following-char))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
768 (previous (char-after (- (point) 2))))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
769 ;; We do the boldification/underlining by hiding the
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
770 ;; overstrikes and putting the proper text property
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
771 ;; on the letters.
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
772 (cond
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
773 ((eq next previous)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
774 (gnus-article-hide-text-type (- (point) 2) (point) 'overstrike)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
775 (put-text-property (point) (1+ (point)) 'face 'bold))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
776 ((eq next ?_)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
777 (gnus-article-hide-text-type
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
778 (1- (point)) (1+ (point)) 'overstrike)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
779 (put-text-property
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
780 (- (point) 2) (1- (point)) 'face 'underline))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
781 ((eq previous ?_)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
782 (gnus-article-hide-text-type (- (point) 2) (point) 'overstrike)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
783 (put-text-property
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
784 (point) (1+ (point)) 'face 'underline)))))))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
785
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
786 (defun article-fill ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
787 "Format too long lines."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
788 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
789 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
790 (let ((buffer-read-only nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
791 (widen)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
792 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
793 (search-forward "\n\n" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
794 (end-of-line 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
795 (let ((paragraph-start "^[>|#:<;* ]*[ \t]*$")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
796 (adaptive-fill-regexp "[ \t]*\\([|#:<;>*]+ *\\)?")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
797 (adaptive-fill-mode t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
798 (while (not (eobp))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
799 (and (>= (current-column) (min fill-column (window-width)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
800 (/= (preceding-char) ?:)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
801 (fill-paragraph nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
802 (end-of-line 2))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
803
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
804 (defun article-remove-cr ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
805 "Remove carriage returns from an article."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
806 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
807 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
808 (let ((buffer-read-only nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
809 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
810 (while (search-forward "\r" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
811 (replace-match "" t t)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
812
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
813 (defun article-remove-trailing-blank-lines ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
814 "Remove all trailing blank lines from the article."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
815 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
816 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
817 (let ((buffer-read-only nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
818 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
819 (delete-region
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
820 (point)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
821 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
822 (while (and (not (bobp))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
823 (looking-at "^[ \t]*$"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
824 (forward-line -1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
825 (forward-line 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
826 (point))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
827
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
828 (defun article-display-x-face (&optional force)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
829 "Look for an X-Face header and display it if present."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
830 (interactive (list 'force))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
831 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
832 ;; Delete the old process, if any.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
833 (when (process-status "article-x-face")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
834 (delete-process "article-x-face"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
835 (let ((inhibit-point-motion-hooks t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
836 (case-fold-search nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
837 from)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
838 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
839 (nnheader-narrow-to-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
840 (setq from (message-fetch-field "from"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
841 (goto-char (point-min))
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
842 (while (and gnus-article-x-face-command
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
843 (or force
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
844 ;; Check whether this face is censored.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
845 (not gnus-article-x-face-too-ugly)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
846 (and gnus-article-x-face-too-ugly from
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
847 (not (string-match gnus-article-x-face-too-ugly
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
848 from))))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
849 ;; Has to be present.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
850 (re-search-forward "^X-Face: " nil t))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
851 ;; We now have the area of the buffer where the X-Face is stored.
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
852 (save-excursion
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
853 (let ((beg (point))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
854 (end (1- (re-search-forward "^\\($\\|[^ \t]\\)" nil t))))
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
855 ;; We display the face.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
856 (if (symbolp gnus-article-x-face-command)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
857 ;; The command is a lisp function, so we call it.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
858 (if (gnus-functionp gnus-article-x-face-command)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
859 (funcall gnus-article-x-face-command beg end)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
860 (error "%s is not a function" gnus-article-x-face-command))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
861 ;; The command is a string, so we interpret the command
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
862 ;; as a, well, command, and fork it off.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
863 (let ((process-connection-type nil))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
864 (process-kill-without-query
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
865 (start-process
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
866 "article-x-face" nil shell-file-name shell-command-switch
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
867 gnus-article-x-face-command))
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
868 (process-send-region "article-x-face" beg end)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
869 (process-send-eof "article-x-face"))))))))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
870
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
871 (defalias 'gnus-decode-rfc1522 'article-decode-rfc1522)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
872 (defalias 'gnus-article-decode-rfc1522 'article-decode-rfc1522)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
873 (defun article-decode-rfc1522 ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
874 "Hack to remove QP encoding from headers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
875 (let ((case-fold-search t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
876 (inhibit-point-motion-hooks t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
877 (buffer-read-only nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
878 string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
879 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
880 (narrow-to-region
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
881 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
882 (or (search-forward "\n\n" nil t) (point-max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
883 (goto-char (point-min))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
884 (while (re-search-forward
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
885 "=\\?iso-8859-1\\?q\\?\\([^?\t\n]*\\)\\?=" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
886 (setq string (match-string 1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
887 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
888 (narrow-to-region (match-beginning 0) (match-end 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
889 (delete-region (point-min) (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
890 (insert string)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
891 (article-mime-decode-quoted-printable
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
892 (goto-char (point-min)) (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
893 (subst-char-in-region (point-min) (point-max) ?_ ? )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
894 (goto-char (point-max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
895 (goto-char (point-min))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
896
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
897 (defun article-de-quoted-unreadable (&optional force)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
898 "Do a naive translation of a quoted-printable-encoded article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
899 This is in no way, shape or form meant as a replacement for real MIME
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
900 processing, but is simply a stop-gap measure until MIME support is
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
901 written.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
902 If FORCE, decode the article whether it is marked as quoted-printable
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
903 or not."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
904 (interactive (list 'force))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
905 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
906 (let ((case-fold-search t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
907 (buffer-read-only nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
908 (type (gnus-fetch-field "content-transfer-encoding")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
909 (gnus-article-decode-rfc1522)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
910 (when (or force
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
911 (and type (string-match "quoted-printable" (downcase type))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
912 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
913 (search-forward "\n\n" nil 'move)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
914 (article-mime-decode-quoted-printable (point) (point-max))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
915
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
916 (defun article-mime-decode-quoted-printable-buffer ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
917 "Decode Quoted-Printable in the current buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
918 (article-mime-decode-quoted-printable (point-min) (point-max)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
919
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
920 (defun article-mime-decode-quoted-printable (from to)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
921 "Decode Quoted-Printable in the region between FROM and TO."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
922 (interactive "r")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
923 (goto-char from)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
924 (while (search-forward "=" to t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
925 (cond ((eq (following-char) ?\n)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
926 (delete-char -1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
927 (delete-char 1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
928 ((looking-at "[0-9A-F][0-9A-F]")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
929 (subst-char-in-region
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
930 (1- (point)) (point) ?=
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
931 (hexl-hex-string-to-integer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
932 (buffer-substring (point) (+ 2 (point)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
933 (delete-char 2))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
934 ((looking-at "=")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
935 (delete-char 1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
936 ((gnus-message 3 "Malformed MIME quoted-printable message")))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
937
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
938 (defun article-hide-pgp (&optional arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
939 "Toggle hiding of any PGP headers and signatures in the current article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
940 If given a negative prefix, always show; if given a positive prefix,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
941 always hide."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
942 (interactive (gnus-article-hidden-arg))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
943 (unless (gnus-article-check-hidden-text 'pgp arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
944 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
945 (let ((inhibit-point-motion-hooks t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
946 buffer-read-only beg end)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
947 (widen)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
948 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
949 ;; Hide the "header".
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
950 (when (search-forward "\n-----BEGIN PGP SIGNED MESSAGE-----\n" nil t)
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
951 (gnus-article-hide-text-type (1+ (match-beginning 0))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
952 (match-end 0) 'pgp))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
953 (setq beg (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
954 ;; Hide the actual signature.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
955 (and (search-forward "\n-----BEGIN PGP SIGNATURE-----\n" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
956 (setq end (1+ (match-beginning 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
957 (gnus-article-hide-text-type
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
958 end
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
959 (if (search-forward "\n-----END PGP SIGNATURE-----\n" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
960 (match-end 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
961 ;; Perhaps we shouldn't hide to the end of the buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
962 ;; if there is no end to the signature?
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
963 (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
964 'pgp))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
965 ;; Hide "- " PGP quotation markers.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
966 (when (and beg end)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
967 (narrow-to-region beg end)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
968 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
969 (while (re-search-forward "^- " nil t)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
970 (gnus-article-hide-text-type
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
971 (match-beginning 0) (match-end 0) 'pgp))
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 144
diff changeset
972 (widen)))
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 144
diff changeset
973 (run-hooks 'gnus-article-hide-pgp-hook))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
974
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
975 (defun article-hide-pem (&optional arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
976 "Toggle hiding of any PEM headers and signatures in the current article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
977 If given a negative prefix, always show; if given a positive prefix,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
978 always hide."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
979 (interactive (gnus-article-hidden-arg))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
980 (unless (gnus-article-check-hidden-text 'pem arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
981 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
982 (let (buffer-read-only end)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
983 (widen)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
984 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
985 ;; hide the horrendously ugly "header".
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
986 (and (search-forward "\n-----BEGIN PRIVACY-ENHANCED MESSAGE-----\n"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
987 nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
988 t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
989 (setq end (1+ (match-beginning 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
990 (gnus-article-hide-text-type
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
991 end
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
992 (if (search-forward "\n\n" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
993 (match-end 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
994 (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
995 'pem))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
996 ;; hide the trailer as well
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
997 (and (search-forward "\n-----END PRIVACY-ENHANCED MESSAGE-----\n"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
998 nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
999 t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1000 (gnus-article-hide-text-type
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1001 (match-beginning 0) (match-end 0) 'pem))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1002
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1003 (defun article-hide-signature (&optional arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1004 "Hide the signature in the current article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1005 If given a negative prefix, always show; if given a positive prefix,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1006 always hide."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1007 (interactive (gnus-article-hidden-arg))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1008 (unless (gnus-article-check-hidden-text 'signature arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1009 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1010 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1011 (let ((buffer-read-only nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1012 (when (gnus-article-narrow-to-signature)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1013 (gnus-article-hide-text-type
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1014 (point-min) (point-max) 'signature)))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1015
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1016 (defun article-strip-leading-blank-lines ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1017 "Remove all blank lines from the beginning of the article."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1018 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1019 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1020 (let ((inhibit-point-motion-hooks t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1021 buffer-read-only)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1022 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1023 (when (search-forward "\n\n" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1024 (while (and (not (eobp))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1025 (looking-at "[ \t]*$"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1026 (gnus-delete-line))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1027
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1028 (defun article-strip-multiple-blank-lines ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1029 "Replace consecutive blank lines with one empty line."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1030 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1031 (save-excursion
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1032 (let ((inhibit-point-motion-hooks t)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1033 buffer-read-only)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1034 ;; First make all blank lines empty.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1035 (goto-char (point-min))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1036 (search-forward "\n\n" nil t)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1037 (while (re-search-forward "^[ \t]+$" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1038 (replace-match "" nil t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1039 ;; Then replace multiple empty lines with a single empty line.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1040 (goto-char (point-min))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1041 (search-forward "\n\n" nil t)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1042 (while (re-search-forward "\n\n\n+" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1043 (replace-match "\n\n" t t)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1044
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1045 (defun article-strip-leading-space ()
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1046 "Remove all white space from the beginning of the lines in the article."
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1047 (interactive)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1048 (save-excursion
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1049 (let ((inhibit-point-motion-hooks t)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1050 buffer-read-only)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1051 (goto-char (point-min))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1052 (search-forward "\n\n" nil t)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1053 (while (re-search-forward "^[ \t]+" nil t)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1054 (replace-match "" t t)))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1055
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1056 (defun article-strip-blank-lines ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1057 "Strip leading, trailing and multiple blank lines."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1058 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1059 (article-strip-leading-blank-lines)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1060 (article-remove-trailing-blank-lines)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1061 (article-strip-multiple-blank-lines))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1062
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1063 (defvar mime::preview/content-list)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1064 (defvar mime::preview-content-info/point-min)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1065 (defun gnus-article-narrow-to-signature ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1066 "Narrow to the signature; return t if a signature is found, else nil."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1067 (widen)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1068 (when (and (boundp 'mime::preview/content-list)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1069 mime::preview/content-list)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1070 ;; We have a MIMEish article, so we use the MIME data to narrow.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1071 (let ((pcinfo (car (last mime::preview/content-list))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1072 (ignore-errors
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1073 (narrow-to-region
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1074 (funcall (intern "mime::preview-content-info/point-min") pcinfo)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1075 (point-max)))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1076
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1077 (when (gnus-article-search-signature)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1078 (forward-line 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1079 ;; Check whether we have some limits to what we consider
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1080 ;; to be a signature.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1081 (let ((limits (if (listp gnus-signature-limit) gnus-signature-limit
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1082 (list gnus-signature-limit)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1083 limit limited)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1084 (while (setq limit (pop limits))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1085 (if (or (and (integerp limit)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1086 (< (- (point-max) (point)) limit))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1087 (and (floatp limit)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1088 (< (count-lines (point) (point-max)) limit))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1089 (and (gnus-functionp limit)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1090 (funcall limit))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1091 (and (stringp limit)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1092 (not (re-search-forward limit nil t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1093 () ; This limit did not succeed.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1094 (setq limited t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1095 limits nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1096 (unless limited
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1097 (narrow-to-region (point) (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1098 t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1099
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1100 (defun gnus-article-search-signature ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1101 "Search the current buffer for the signature separator.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1102 Put point at the beginning of the signature separator."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1103 (let ((cur (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1104 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1105 (if (if (stringp gnus-signature-separator)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1106 (re-search-backward gnus-signature-separator nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1107 (let ((seps gnus-signature-separator))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1108 (while (and seps
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1109 (not (re-search-backward (car seps) nil t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1110 (pop seps))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1111 seps))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1112 t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1113 (goto-char cur)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1114 nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1115
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1116 (eval-and-compile
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1117 (autoload 'w3-parse-buffer "w3-parse"))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1118
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1119 (defun gnus-article-treat-html ()
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1120 "Render HTML."
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1121 (interactive)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1122 (let ((cbuf (current-buffer)))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1123 (set-buffer gnus-article-buffer)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1124 (let (buf buffer-read-only b e)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1125 (goto-char (point-min))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1126 (narrow-to-region
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1127 (if (search-forward "\n\n" nil t)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1128 (setq b (point))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1129 (point-max))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1130 (setq e (point-max)))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1131 (nnheader-temp-write nil
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1132 (insert-buffer-substring gnus-article-buffer b e)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
1133 (require 'url)
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1134 (save-window-excursion
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
1135 (w3-parse-buffer (current-buffer))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
1136 (setq buf (buffer-string))))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1137 (when buf
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1138 (delete-region (point-min) (point-max))
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 144
diff changeset
1139 (insert buf))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1140 (widen)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1141 (goto-char (point-min))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1142 (set-window-start (get-buffer-window (current-buffer)) (point-min))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1143 (set-buffer cbuf))))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1144
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1145 (defun gnus-article-hidden-arg ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1146 "Return the current prefix arg as a number, or 0 if no prefix."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1147 (list (if current-prefix-arg
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1148 (prefix-numeric-value current-prefix-arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1149 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1150
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1151 (defun gnus-article-check-hidden-text (type arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1152 "Return nil if hiding is necessary.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1153 Arg can be nil or a number. Nil and positive means hide, negative
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1154 means show, 0 means toggle."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1155 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1156 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1157 (widen)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1158 (let ((hide (gnus-article-hidden-text-p type)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1159 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1160 ((or (null arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1161 (> arg 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1162 nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1163 ((< arg 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1164 (gnus-article-show-hidden-text type))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1165 (t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1166 (if (eq hide 'hidden)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1167 (gnus-article-show-hidden-text type)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1168 nil)))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1169
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1170 (defun gnus-article-hidden-text-p (type)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1171 "Say whether the current buffer contains hidden text of type TYPE."
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1172 (let ((start (point-min))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1173 (pos (text-property-any (point-min) (point-max) 'article-type type)))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1174 (while (and pos
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1175 (not (get-text-property pos 'invisible)))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1176 (setq pos
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1177 (text-property-any (1+ pos) (point-max) 'article-type type)))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1178 (if pos
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1179 'hidden
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1180 'shown)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1181
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1182 (defun gnus-article-show-hidden-text (type &optional hide)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1183 "Show all hidden text of type TYPE.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1184 If HIDE, hide the text instead."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1185 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1186 (let ((buffer-read-only nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1187 (inhibit-point-motion-hooks t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1188 (end (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1189 beg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1190 (while (setq beg (text-property-any end (point-max) 'article-type type))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1191 (goto-char beg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1192 (setq end (or
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1193 (text-property-not-all beg (point-max) 'article-type type)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1194 (point-max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1195 (if hide
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1196 (gnus-article-hide-text beg end gnus-hidden-properties)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1197 (gnus-article-unhide-text beg end))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1198 (goto-char end))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1199 t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1200
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1201 (defconst article-time-units
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1202 `((year . ,(* 365.25 24 60 60))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1203 (week . ,(* 7 24 60 60))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1204 (day . ,(* 24 60 60))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1205 (hour . ,(* 60 60))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1206 (minute . 60)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1207 (second . 1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1208 "Mapping from time units to seconds.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1209
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1210 (defun article-date-ut (&optional type highlight header)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1211 "Convert DATE date to universal time in the current article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1212 If TYPE is `local', convert to local time; if it is `lapsed', output
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1213 how much time has lapsed since DATE."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1214 (interactive (list 'ut t))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1215 (let* ((header (or header
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1216 (mail-header-date gnus-current-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1217 (message-fetch-field "date")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1218 ""))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1219 (date (if (vectorp header) (mail-header-date header)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1220 header))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1221 (date-regexp "^Date:[ \t]\\|^X-Sent:[ \t]")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1222 (inhibit-point-motion-hooks t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1223 bface eface)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1224 (when (and date (not (string= date "")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1225 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1226 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1227 (nnheader-narrow-to-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1228 (let ((buffer-read-only nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1229 ;; Delete any old Date headers.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1230 (if (re-search-forward date-regexp nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1231 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1232 (setq bface (get-text-property (gnus-point-at-bol) 'face)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1233 eface (get-text-property (1- (gnus-point-at-eol))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1234 'face))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1235 (message-remove-header date-regexp t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1236 (beginning-of-line))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1237 (goto-char (point-max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1238 (insert (article-make-date-line date type))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1239 ;; Do highlighting.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1240 (forward-line -1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1241 (when (looking-at "\\([^:]+\\): *\\(.*\\)$")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1242 (put-text-property (match-beginning 1) (match-end 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1243 'face bface)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1244 (put-text-property (match-beginning 2) (match-end 2)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1245 'face eface))))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1246
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1247 (defun article-make-date-line (date type)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1248 "Return a DATE line of TYPE."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1249 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1250 ;; Convert to the local timezone. We have to slap a
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1251 ;; `condition-case' round the calls to the timezone
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1252 ;; functions since they aren't particularly resistant to
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1253 ;; buggy dates.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1254 ((eq type 'local)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1255 (concat "Date: " (condition-case ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1256 (timezone-make-date-arpa-standard date)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1257 (error date))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1258 "\n"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1259 ;; Convert to Universal Time.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1260 ((eq type 'ut)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1261 (concat "Date: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1262 (condition-case ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1263 (timezone-make-date-arpa-standard date nil "UT")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1264 (error date))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1265 "\n"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1266 ;; Get the original date from the article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1267 ((eq type 'original)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1268 (concat "Date: " date "\n"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1269 ;; Let the user define the format.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1270 ((eq type 'user)
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1271 (concat
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1272 "Date: "
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1273 (format-time-string gnus-article-time-format
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1274 (ignore-errors
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1275 (gnus-encode-date
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1276 (timezone-make-date-arpa-standard
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1277 date nil "UT"))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1278 "\n"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1279 ;; Do an X-Sent lapsed format.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1280 ((eq type 'lapsed)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1281 ;; If the date is seriously mangled, the timezone functions are
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1282 ;; liable to bug out, so we ignore all errors.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1283 (let* ((now (current-time))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1284 (real-time
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1285 (ignore-errors
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1286 (gnus-time-minus
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1287 (gnus-encode-date
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1288 (timezone-make-date-arpa-standard
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1289 (current-time-string now)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1290 (current-time-zone now) "UT"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1291 (gnus-encode-date
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1292 (timezone-make-date-arpa-standard
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1293 date nil "UT")))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1294 (real-sec (and real-time
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1295 (+ (* (float (car real-time)) 65536)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1296 (cadr real-time))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1297 (sec (and real-time (abs real-sec)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1298 num prev)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1299 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1300 ((null real-time)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1301 "X-Sent: Unknown\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1302 ((zerop sec)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1303 "X-Sent: Now\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1304 (t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1305 (concat
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1306 "X-Sent: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1307 ;; This is a bit convoluted, but basically we go
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1308 ;; through the time units for years, weeks, etc,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1309 ;; and divide things to see whether that results
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1310 ;; in positive answers.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1311 (mapconcat
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1312 (lambda (unit)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1313 (if (zerop (setq num (ffloor (/ sec (cdr unit)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1314 ;; The (remaining) seconds are too few to
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1315 ;; be divided into this time unit.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1316 ""
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1317 ;; It's big enough, so we output it.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1318 (setq sec (- sec (* num (cdr unit))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1319 (prog1
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1320 (concat (if prev ", " "") (int-to-string
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1321 (floor num))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1322 " " (symbol-name (car unit))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1323 (if (> num 1) "s" ""))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1324 (setq prev t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1325 article-time-units "")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1326 ;; If dates are odd, then it might appear like the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1327 ;; article was sent in the future.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1328 (if (> real-sec 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1329 " ago\n"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1330 " in the future\n"))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1331 (t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1332 (error "Unknown conversion type: %s" type))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1333
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1334 (defun article-date-local (&optional highlight)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1335 "Convert the current article date to the local timezone."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1336 (interactive (list t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1337 (article-date-ut 'local highlight))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1338
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1339 (defun article-date-original (&optional highlight)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1340 "Convert the current article date to what it was originally.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1341 This is only useful if you have used some other date conversion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1342 function and want to see what the date was before converting."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1343 (interactive (list t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1344 (article-date-ut 'original highlight))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1345
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1346 (defun article-date-lapsed (&optional highlight)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1347 "Convert the current article date to time lapsed since it was sent."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1348 (interactive (list t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1349 (article-date-ut 'lapsed highlight))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1350
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1351 (defun article-date-user (&optional highlight)
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1352 "Convert the current article date to the user-defined format.
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1353 This format is defined by the `gnus-article-time-format' variable."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1354 (interactive (list t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1355 (article-date-ut 'user highlight))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1356
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1357 (defun article-show-all ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1358 "Show all hidden text in the article buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1359 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1360 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1361 (let ((buffer-read-only nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1362 (gnus-article-unhide-text (point-min) (point-max)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1363
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1364 (defun article-emphasize (&optional arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1365 "Emphasize text according to `gnus-emphasis-alist'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1366 (interactive (gnus-article-hidden-arg))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1367 (unless (gnus-article-check-hidden-text 'emphasis arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1368 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1369 (let ((alist gnus-emphasis-alist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1370 (buffer-read-only nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1371 (props (append '(article-type emphasis)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1372 gnus-hidden-properties))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1373 regexp elem beg invisible visible face)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1374 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1375 (search-forward "\n\n" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1376 (setq beg (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1377 (while (setq elem (pop alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1378 (goto-char beg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1379 (setq regexp (car elem)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1380 invisible (nth 1 elem)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1381 visible (nth 2 elem)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1382 face (nth 3 elem))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1383 (while (re-search-forward regexp nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1384 (when (and (match-beginning visible) (match-beginning invisible))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1385 (gnus-article-hide-text
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1386 (match-beginning invisible) (match-end invisible) props)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1387 (gnus-article-unhide-text-type
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1388 (match-beginning visible) (match-end visible) 'emphasis)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1389 (gnus-put-text-property-excluding-newlines
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1390 (match-beginning visible) (match-end visible) 'face face)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1391 (goto-char (match-end invisible)))))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1392
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1393 (defvar gnus-summary-article-menu)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1394 (defvar gnus-summary-post-menu)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1395
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1396 ;;; Saving functions.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1397
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1398 (defun gnus-article-save (save-buffer file &optional num)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1399 "Save the currently selected article."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1400 (unless gnus-save-all-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1401 ;; Remove headers according to `gnus-saved-headers'.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1402 (let ((gnus-visible-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1403 (or gnus-saved-headers gnus-visible-headers))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1404 (gnus-article-buffer save-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1405 (gnus-article-hide-headers 1 t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1406 (save-window-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1407 (if (not gnus-default-article-saver)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1408 (error "No default saver is defined.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1409 ;; !!! Magic! The saving functions all save
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1410 ;; `gnus-original-article-buffer' (or so they think), but we
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1411 ;; bind that variable to our save-buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1412 (set-buffer gnus-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1413 (let* ((gnus-save-article-buffer save-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1414 (filename
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1415 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1416 ((not gnus-prompt-before-saving) 'default)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1417 ((eq gnus-prompt-before-saving 'always) nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1418 (t file)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1419 (gnus-number-of-articles-to-be-saved
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1420 (when (eq gnus-prompt-before-saving t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1421 num))) ; Magic
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1422 (set-buffer gnus-summary-buffer)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1423 (funcall gnus-default-article-saver filename)))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1424
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1425 (defun gnus-read-save-file-name (prompt &optional filename
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1426 function group headers variable)
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
1427 (let ((default-name
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
1428 (funcall function group headers (symbol-value variable)))
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1429 result)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1430 (setq
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1431 result
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1432 (cond
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1433 ((eq filename 'default)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1434 default-name)
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
1435 ((eq filename t)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
1436 default-name)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1437 (filename filename)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1438 (t
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1439 (let* ((split-name (gnus-get-split-value gnus-split-methods))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1440 (prompt
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1441 (format prompt
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1442 (if (and gnus-number-of-articles-to-be-saved
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1443 (> gnus-number-of-articles-to-be-saved 1))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1444 (format "these %d articles"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1445 gnus-number-of-articles-to-be-saved)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1446 "this article")))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1447 (file
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1448 ;; Let the split methods have their say.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1449 (cond
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1450 ;; No split name was found.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1451 ((null split-name)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1452 (read-file-name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1453 (concat prompt " (default "
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1454 (file-name-nondirectory default-name) ") ")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1455 (file-name-directory default-name)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1456 default-name))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1457 ;; A single group name is returned.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1458 ((stringp split-name)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1459 (setq default-name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1460 (funcall function split-name headers
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1461 (symbol-value variable)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1462 (read-file-name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1463 (concat prompt " (default "
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1464 (file-name-nondirectory default-name) ") ")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1465 (file-name-directory default-name)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1466 default-name))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1467 ;; A single split name was found
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1468 ((= 1 (length split-name))
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1469 (let* ((name (expand-file-name
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 124
diff changeset
1470 (car split-name) gnus-article-save-directory))
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1471 (dir (cond ((file-directory-p name)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1472 (file-name-as-directory name))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1473 ((file-exists-p name) name)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1474 (t gnus-article-save-directory))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1475 (read-file-name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1476 (concat prompt " (default " name ") ")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1477 dir name)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1478 ;; A list of splits was found.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1479 (t
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1480 (setq split-name (nreverse split-name))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1481 (let (result)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1482 (let ((file-name-history
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1483 (nconc split-name file-name-history)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1484 (setq result
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1485 (expand-file-name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1486 (read-file-name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1487 (concat prompt " (`M-p' for defaults) ")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1488 gnus-article-save-directory
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1489 (car split-name))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1490 gnus-article-save-directory)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1491 (car (push result file-name-history)))))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1492 ;; Create the directory.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1493 (gnus-make-directory (file-name-directory file))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1494 ;; If we have read a directory, we append the default file name.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1495 (when (file-directory-p file)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1496 (setq file (concat (file-name-as-directory file)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1497 (file-name-nondirectory default-name))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1498 ;; Possibly translate some characters.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1499 (nnheader-translate-file-chars file)))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1500 (gnus-make-directory (file-name-directory result))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1501 (set variable result)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1502
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1503 (defun gnus-article-archive-name (group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1504 "Return the first instance of an \"Archive-name\" in the current buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1505 (let ((case-fold-search t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1506 (when (re-search-forward "archive-name: *\\([^ \n\t]+\\)[ \t]*$" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1507 (nnheader-concat gnus-article-save-directory
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1508 (match-string 1)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1509
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1510 (defun gnus-article-nndoc-name (group)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1511 "If GROUP is an nndoc group, return the name of the parent group."
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1512 (when (eq (car (gnus-find-method-for-group group)) 'nndoc)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1513 (gnus-group-get-parameter group 'save-article-group)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1514
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1515 (defun gnus-summary-save-in-rmail (&optional filename)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1516 "Append this article to Rmail file.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1517 Optional argument FILENAME specifies file name.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1518 Directory to save to is default to `gnus-article-save-directory'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1519 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1520 (gnus-set-global-variables)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1521 (setq filename (gnus-read-save-file-name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1522 "Save %s in rmail file:" filename
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1523 gnus-rmail-save-name gnus-newsgroup-name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1524 gnus-current-headers 'gnus-newsgroup-last-rmail))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1525 (gnus-eval-in-buffer-window gnus-save-article-buffer
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1526 (save-excursion
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1527 (save-restriction
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1528 (widen)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1529 (gnus-output-to-rmail filename)))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1530
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1531 (defun gnus-summary-save-in-mail (&optional filename)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1532 "Append this article to Unix mail file.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1533 Optional argument FILENAME specifies file name.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1534 Directory to save to is default to `gnus-article-save-directory'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1535 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1536 (gnus-set-global-variables)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1537 (setq filename (gnus-read-save-file-name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1538 "Save %s in Unix mail file:" filename
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1539 gnus-mail-save-name gnus-newsgroup-name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1540 gnus-current-headers 'gnus-newsgroup-last-mail))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1541 (gnus-eval-in-buffer-window gnus-save-article-buffer
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1542 (save-excursion
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1543 (save-restriction
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1544 (widen)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1545 (if (and (file-readable-p filename)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1546 (mail-file-babyl-p filename))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1547 (gnus-output-to-rmail filename t)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1548 (gnus-output-to-mail filename))))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1549
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1550 (defun gnus-summary-save-in-file (&optional filename overwrite)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1551 "Append this article to file.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1552 Optional argument FILENAME specifies file name.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1553 Directory to save to is default to `gnus-article-save-directory'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1554 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1555 (gnus-set-global-variables)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1556 (setq filename (gnus-read-save-file-name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1557 "Save %s in file:" filename
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1558 gnus-file-save-name gnus-newsgroup-name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1559 gnus-current-headers 'gnus-newsgroup-last-file))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1560 (gnus-eval-in-buffer-window gnus-save-article-buffer
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1561 (save-excursion
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1562 (save-restriction
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1563 (widen)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1564 (when (and overwrite
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1565 (file-exists-p filename))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1566 (delete-file filename))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1567 (gnus-output-to-file filename)))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1568
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1569 (defun gnus-summary-write-to-file (&optional filename)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1570 "Write this article to a file.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1571 Optional argument FILENAME specifies file name.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1572 The directory to save in defaults to `gnus-article-save-directory'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1573 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1574 (gnus-summary-save-in-file nil t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1575
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1576 (defun gnus-summary-save-body-in-file (&optional filename)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1577 "Append this article body to a file.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1578 Optional argument FILENAME specifies file name.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1579 The directory to save in defaults to `gnus-article-save-directory'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1580 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1581 (gnus-set-global-variables)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1582 (setq filename (gnus-read-save-file-name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1583 "Save %s body in file:" filename
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1584 gnus-file-save-name gnus-newsgroup-name
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1585 gnus-current-headers 'gnus-newsgroup-last-file))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1586 (gnus-eval-in-buffer-window gnus-save-article-buffer
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1587 (save-excursion
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1588 (save-restriction
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1589 (widen)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1590 (goto-char (point-min))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1591 (when (search-forward "\n\n" nil t)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1592 (narrow-to-region (point) (point-max)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
1593 (gnus-output-to-file filename)))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1594
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1595 (defun gnus-summary-save-in-pipe (&optional command)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1596 "Pipe this article to subprocess."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1597 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1598 (gnus-set-global-variables)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1599 (setq command
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1600 (cond ((eq command 'default)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1601 gnus-last-shell-command)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1602 (command command)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1603 (t (read-string
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1604 (format
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1605 "Shell command on %s: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1606 (if (and gnus-number-of-articles-to-be-saved
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1607 (> gnus-number-of-articles-to-be-saved 1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1608 (format "these %d articles"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1609 gnus-number-of-articles-to-be-saved)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1610 "this article"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1611 gnus-last-shell-command))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1612 (when (string-equal command "")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1613 (setq command gnus-last-shell-command))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1614 (gnus-eval-in-buffer-window gnus-article-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1615 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1616 (widen)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1617 (shell-command-on-region (point-min) (point-max) command nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1618 (setq gnus-last-shell-command command))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1619
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1620 ;;; Article file names when saving.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1621
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1622 (defun gnus-capitalize-newsgroup (newsgroup)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1623 "Capitalize NEWSGROUP name."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1624 (when (not (zerop (length newsgroup)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1625 (concat (char-to-string (upcase (aref newsgroup 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1626 (substring newsgroup 1))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1627
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1628 (defun gnus-Numeric-save-name (newsgroup headers &optional last-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1629 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1630 If variable `gnus-use-long-file-name' is non-nil, it is ~/News/News.group/num.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1631 Otherwise, it is like ~/News/news/group/num."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1632 (let ((default
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1633 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1634 (concat (if (gnus-use-long-file-name 'not-save)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1635 (gnus-capitalize-newsgroup newsgroup)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1636 (gnus-newsgroup-directory-form newsgroup))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1637 "/" (int-to-string (mail-header-number headers)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1638 gnus-article-save-directory)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1639 (if (and last-file
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1640 (string-equal (file-name-directory default)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1641 (file-name-directory last-file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1642 (string-match "^[0-9]+$" (file-name-nondirectory last-file)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1643 default
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1644 (or last-file default))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1645
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1646 (defun gnus-numeric-save-name (newsgroup headers &optional last-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1647 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1648 If variable `gnus-use-long-file-name' is non-nil, it is
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1649 ~/News/news.group/num. Otherwise, it is like ~/News/news/group/num."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1650 (let ((default
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1651 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1652 (concat (if (gnus-use-long-file-name 'not-save)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1653 newsgroup
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1654 (gnus-newsgroup-directory-form newsgroup))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1655 "/" (int-to-string (mail-header-number headers)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1656 gnus-article-save-directory)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1657 (if (and last-file
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1658 (string-equal (file-name-directory default)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1659 (file-name-directory last-file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1660 (string-match "^[0-9]+$" (file-name-nondirectory last-file)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1661 default
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1662 (or last-file default))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1663
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1664 (defun gnus-Plain-save-name (newsgroup headers &optional last-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1665 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1666 If variable `gnus-use-long-file-name' is non-nil, it is
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1667 ~/News/News.group. Otherwise, it is like ~/News/news/group/news."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1668 (or last-file
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1669 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1670 (if (gnus-use-long-file-name 'not-save)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1671 (gnus-capitalize-newsgroup newsgroup)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1672 (concat (gnus-newsgroup-directory-form newsgroup) "/news"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1673 gnus-article-save-directory)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1674
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1675 (defun gnus-plain-save-name (newsgroup headers &optional last-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1676 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1677 If variable `gnus-use-long-file-name' is non-nil, it is
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1678 ~/News/news.group. Otherwise, it is like ~/News/news/group/news."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1679 (or last-file
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1680 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1681 (if (gnus-use-long-file-name 'not-save)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1682 newsgroup
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1683 (concat (gnus-newsgroup-directory-form newsgroup) "/news"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1684 gnus-article-save-directory)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1685
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1686 (eval-and-compile
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1687 (mapcar
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1688 (lambda (func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1689 (let (afunc gfunc)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1690 (if (consp func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1691 (setq afunc (car func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1692 gfunc (cdr func))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1693 (setq afunc func
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1694 gfunc (intern (format "gnus-%s" func))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1695 (fset gfunc
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1696 (if (not (fboundp afunc))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1697 nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1698 `(lambda (&optional interactive &rest args)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1699 ,(documentation afunc t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1700 (interactive (list t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1701 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1702 (set-buffer gnus-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1703 (if interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1704 (call-interactively ',afunc)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1705 (apply ',afunc args))))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1706 '(article-hide-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1707 article-hide-boring-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1708 article-treat-overstrike
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1709 (article-fill . gnus-article-word-wrap)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1710 article-remove-cr
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1711 article-display-x-face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1712 article-de-quoted-unreadable
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1713 article-mime-decode-quoted-printable
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1714 article-hide-pgp
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1715 article-hide-pem
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1716 article-hide-signature
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1717 article-remove-trailing-blank-lines
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1718 article-strip-leading-blank-lines
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1719 article-strip-multiple-blank-lines
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1720 article-strip-leading-space
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1721 article-strip-blank-lines
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1722 article-date-local
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1723 article-date-original
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1724 article-date-ut
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1725 article-date-user
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1726 article-date-lapsed
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1727 article-emphasize
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1728 (article-show-all . gnus-article-show-all-headers))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1729
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1730 ;;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1731 ;;; Gnus article mode
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1732 ;;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1733
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1734 (put 'gnus-article-mode 'mode-class 'special)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1735
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1736 (when t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1737 (gnus-define-keys gnus-article-mode-map
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1738 " " gnus-article-goto-next-page
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1739 "\177" gnus-article-goto-prev-page
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1740 [delete] gnus-article-goto-prev-page
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1741 "\C-c^" gnus-article-refer-article
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1742 "h" gnus-article-show-summary
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1743 "s" gnus-article-show-summary
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1744 "\C-c\C-m" gnus-article-mail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1745 "?" gnus-article-describe-briefly
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1746 gnus-mouse-2 gnus-article-push-button
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1747 "\r" gnus-article-press-button
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1748 "\t" gnus-article-next-button
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1749 "\M-\t" gnus-article-prev-button
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1750 "e" gnus-article-edit
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1751 "<" beginning-of-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1752 ">" end-of-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1753 "\C-c\C-i" gnus-info-find-node
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1754 "\C-c\C-b" gnus-bug
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1755
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1756 "\C-d" gnus-article-read-summary-keys
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1757 "\M-*" gnus-article-read-summary-keys
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1758 "\M-#" gnus-article-read-summary-keys
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1759 "\M-^" gnus-article-read-summary-keys
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1760 "\M-g" gnus-article-read-summary-keys)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1761
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1762 (substitute-key-definition
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1763 'undefined 'gnus-article-read-summary-keys gnus-article-mode-map))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1764
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1765 (defun gnus-article-make-menu-bar ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1766 (gnus-turn-off-edit-menu 'article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1767 (unless (boundp 'gnus-article-article-menu)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1768 (easy-menu-define
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1769 gnus-article-article-menu gnus-article-mode-map ""
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1770 '("Article"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1771 ["Scroll forwards" gnus-article-goto-next-page t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1772 ["Scroll backwards" gnus-article-goto-prev-page t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1773 ["Show summary" gnus-article-show-summary t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1774 ["Fetch Message-ID at point" gnus-article-refer-article t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1775 ["Mail to address at point" gnus-article-mail t]))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1776
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1777 (easy-menu-define
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1778 gnus-article-treatment-menu gnus-article-mode-map ""
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1779 '("Treatment"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1780 ["Hide headers" gnus-article-hide-headers t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1781 ["Hide signature" gnus-article-hide-signature t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1782 ["Hide citation" gnus-article-hide-citation t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1783 ["Treat overstrike" gnus-article-treat-overstrike t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1784 ["Remove carriage return" gnus-article-remove-cr t]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1785 ["Remove quoted-unreadable" gnus-article-de-quoted-unreadable t]))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1786
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1787 (when nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1788 (when (boundp 'gnus-summary-article-menu)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1789 (define-key gnus-article-mode-map [menu-bar commands]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1790 (cons "Commands" gnus-summary-article-menu))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1791
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1792 (when (boundp 'gnus-summary-post-menu)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1793 (define-key gnus-article-mode-map [menu-bar post]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1794 (cons "Post" gnus-summary-post-menu)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1795
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1796 (run-hooks 'gnus-article-menu-hook)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1797
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1798 (defun gnus-article-mode ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1799 "Major mode for displaying an article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1800
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1801 All normal editing commands are switched off.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1802
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1803 The following commands are available in addition to all summary mode
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1804 commands:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1805 \\<gnus-article-mode-map>
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1806 \\[gnus-article-next-page]\t Scroll the article one page forwards
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1807 \\[gnus-article-prev-page]\t Scroll the article one page backwards
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1808 \\[gnus-article-refer-article]\t Go to the article referred to by an article id near point
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1809 \\[gnus-article-show-summary]\t Display the summary buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1810 \\[gnus-article-mail]\t Send a reply to the address near point
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1811 \\[gnus-article-describe-briefly]\t Describe the current mode briefly
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1812 \\[gnus-info-find-node]\t Go to the Gnus info node"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1813 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1814 (when (gnus-visual-p 'article-menu 'menu)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1815 (gnus-article-make-menu-bar))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1816 (kill-all-local-variables)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1817 (gnus-simplify-mode-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1818 (setq mode-name "Article")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1819 (setq major-mode 'gnus-article-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1820 (make-local-variable 'minor-mode-alist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1821 (unless (assq 'gnus-show-mime minor-mode-alist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1822 (push (list 'gnus-show-mime " MIME") minor-mode-alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1823 (use-local-map gnus-article-mode-map)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1824 (gnus-update-format-specifications nil 'article-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1825 (set (make-local-variable 'page-delimiter) gnus-page-delimiter)
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1826 (set (make-local-variable 'gnus-page-broken) nil)
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1827 (set (make-local-variable 'gnus-button-marker-list) nil)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1828 (gnus-set-default-directory)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1829 (buffer-disable-undo (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1830 (setq buffer-read-only t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1831 (set-syntax-table gnus-article-mode-syntax-table)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1832 (run-hooks 'gnus-article-mode-hook))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1833
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1834 (defun gnus-article-setup-buffer ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1835 "Initialize the article buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1836 (let* ((name (if gnus-single-article-buffer "*Article*"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1837 (concat "*Article " gnus-newsgroup-name "*")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1838 (original
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1839 (progn (string-match "\\*Article" name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1840 (concat " *Original Article"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1841 (substring name (match-end 0))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1842 (setq gnus-article-buffer name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1843 (setq gnus-original-article-buffer original)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1844 ;; This might be a variable local to the summary buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1845 (unless gnus-single-article-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1846 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1847 (set-buffer gnus-summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1848 (setq gnus-article-buffer name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1849 (setq gnus-original-article-buffer original)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1850 (gnus-set-global-variables)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1851 ;; Init original article buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1852 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1853 (set-buffer (get-buffer-create gnus-original-article-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1854 (buffer-disable-undo (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1855 (setq major-mode 'gnus-original-article-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1856 (gnus-add-current-to-buffer-list)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1857 (make-local-variable 'gnus-original-article))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1858 (if (get-buffer name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1859 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1860 (set-buffer name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1861 (buffer-disable-undo (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1862 (setq buffer-read-only t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1863 (gnus-add-current-to-buffer-list)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1864 (unless (eq major-mode 'gnus-article-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1865 (gnus-article-mode))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1866 (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1867 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1868 (set-buffer (get-buffer-create name))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1869 (gnus-add-current-to-buffer-list)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1870 (gnus-article-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1871 (make-local-variable 'gnus-summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1872 (current-buffer)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1873
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1874 ;; Set article window start at LINE, where LINE is the number of lines
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1875 ;; from the head of the article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1876 (defun gnus-article-set-window-start (&optional line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1877 (set-window-start
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1878 (get-buffer-window gnus-article-buffer t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1879 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1880 (set-buffer gnus-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1881 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1882 (if (not line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1883 (point-min)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1884 (gnus-message 6 "Moved to bookmark")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1885 (search-forward "\n\n" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1886 (forward-line line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1887 (point)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1888
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1889 (defun gnus-article-prepare (article &optional all-headers header)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1890 "Prepare ARTICLE in article mode buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1891 ARTICLE should either be an article number or a Message-ID.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1892 If ARTICLE is an id, HEADER should be the article headers.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1893 If ALL-HEADERS is non-nil, no headers are hidden."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1894 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1895 ;; Make sure we start in a summary buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1896 (unless (eq major-mode 'gnus-summary-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1897 (set-buffer gnus-summary-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1898 (setq gnus-summary-buffer (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1899 ;; Make sure the connection to the server is alive.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1900 (unless (gnus-server-opened
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1901 (gnus-find-method-for-group gnus-newsgroup-name))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1902 (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1903 (gnus-request-group gnus-newsgroup-name t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1904 (let* ((gnus-article (if header (mail-header-number header) article))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1905 (summary-buffer (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1906 (internal-hook gnus-article-internal-prepare-hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1907 (group gnus-newsgroup-name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1908 result)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1909 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1910 (gnus-article-setup-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1911 (set-buffer gnus-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1912 ;; Deactivate active regions.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1913 (when (and (boundp 'transient-mark-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1914 transient-mark-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1915 (setq mark-active nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1916 (if (not (setq result (let ((buffer-read-only nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1917 (gnus-request-article-this-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1918 article group))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1919 ;; There is no such article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1920 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1921 (when (and (numberp article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1922 (not (memq article gnus-newsgroup-sparse)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1923 (setq gnus-article-current
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1924 (cons gnus-newsgroup-name article))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1925 (set-buffer gnus-summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1926 (setq gnus-current-article article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1927 (gnus-summary-mark-article article gnus-canceled-mark))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1928 (unless (memq article gnus-newsgroup-sparse)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1929 (gnus-error
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1930 1 "No such article (may have expired or been canceled)")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1931 (if (or (eq result 'pseudo) (eq result 'nneething))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1932 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1933 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1934 (set-buffer summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1935 (setq gnus-last-article gnus-current-article
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1936 gnus-newsgroup-history (cons gnus-current-article
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1937 gnus-newsgroup-history)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1938 gnus-current-article 0
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1939 gnus-current-headers nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1940 gnus-article-current nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1941 (if (eq result 'nneething)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1942 (gnus-configure-windows 'summary)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1943 (gnus-configure-windows 'article))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1944 (gnus-set-global-variables))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1945 (gnus-set-mode-line 'article))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1946 ;; The result from the `request' was an actual article -
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1947 ;; or at least some text that is now displayed in the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1948 ;; article buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1949 (when (and (numberp article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1950 (not (eq article gnus-current-article)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1951 ;; Seems like a new article has been selected.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1952 ;; `gnus-current-article' must be an article number.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1953 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1954 (set-buffer summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1955 (setq gnus-last-article gnus-current-article
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1956 gnus-newsgroup-history (cons gnus-current-article
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1957 gnus-newsgroup-history)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1958 gnus-current-article article
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1959 gnus-current-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1960 (gnus-summary-article-header gnus-current-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1961 gnus-article-current
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1962 (cons gnus-newsgroup-name gnus-current-article))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1963 (unless (vectorp gnus-current-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1964 (setq gnus-current-headers nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1965 (gnus-summary-show-thread)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1966 (run-hooks 'gnus-mark-article-hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1967 (gnus-set-mode-line 'summary)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1968 (when (gnus-visual-p 'article-highlight 'highlight)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1969 (run-hooks 'gnus-visual-mark-article-hook))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1970 ;; Set the global newsgroup variables here.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1971 ;; Suggested by Jim Sisolak
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1972 ;; <sisolak@trans4.neep.wisc.edu>.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1973 (gnus-set-global-variables)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1974 (setq gnus-have-all-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1975 (or all-headers gnus-show-all-headers))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1976 (and gnus-use-cache
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1977 (vectorp (gnus-summary-article-header article))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1978 (gnus-cache-possibly-enter-article
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1979 group article
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1980 (gnus-summary-article-header article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1981 (memq article gnus-newsgroup-marked)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1982 (memq article gnus-newsgroup-dormant)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1983 (memq article gnus-newsgroup-unreads)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1984 (when (or (numberp article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1985 (stringp article))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1986 ;; Hooks for getting information from the article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1987 ;; This hook must be called before being narrowed.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1988 (let (buffer-read-only)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1989 (run-hooks 'internal-hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1990 (run-hooks 'gnus-article-prepare-hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1991 ;; Decode MIME message.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1992 (when gnus-show-mime
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1993 (if (or (not gnus-strict-mime)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1994 (gnus-fetch-field "Mime-Version"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1995 (funcall gnus-show-mime-method)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1996 (funcall gnus-decode-encoded-word-method)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1997 ;; Perform the article display hooks.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1998 (run-hooks 'gnus-article-display-hook))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1999 ;; Do page break.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2000 (goto-char (point-min))
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
2001 (setq gnus-page-broken
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
2002 (when gnus-break-pages
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
2003 (gnus-narrow-to-page)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
2004 t)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2005 (gnus-set-mode-line 'article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2006 (gnus-configure-windows 'article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2007 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2008 t))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2009
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2010 (defun gnus-article-wash-status ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2011 "Return a string which display status of article washing."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2012 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2013 (set-buffer gnus-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2014 (let ((cite (gnus-article-hidden-text-p 'cite))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2015 (headers (gnus-article-hidden-text-p 'headers))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2016 (boring (gnus-article-hidden-text-p 'boring-headers))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2017 (pgp (gnus-article-hidden-text-p 'pgp))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2018 (pem (gnus-article-hidden-text-p 'pem))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2019 (signature (gnus-article-hidden-text-p 'signature))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2020 (overstrike (gnus-article-hidden-text-p 'overstrike))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2021 (emphasis (gnus-article-hidden-text-p 'emphasis))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2022 (mime gnus-show-mime))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2023 (format "%c%c%c%c%c%c%c"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2024 (if cite ?c ? )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2025 (if (or headers boring) ?h ? )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2026 (if (or pgp pem) ?p ? )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2027 (if signature ?s ? )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2028 (if overstrike ?o ? )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2029 (if mime ?m ? )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2030 (if emphasis ?e ? )))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2031
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2032 (defun gnus-article-hide-headers-if-wanted ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2033 "Hide unwanted headers if `gnus-have-all-headers' is nil.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2034 Provided for backwards compatibility."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2035 (or (save-excursion (set-buffer gnus-summary-buffer) gnus-have-all-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2036 gnus-inhibit-hiding
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2037 (gnus-article-hide-headers)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2038
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2039 ;;; Article savers.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2040
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2041 (defun gnus-output-to-file (file-name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2042 "Append the current article to a file named FILE-NAME."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2043 (let ((artbuf (current-buffer)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2044 (nnheader-temp-write nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2045 (insert-buffer-substring artbuf)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2046 ;; Append newline at end of the buffer as separator, and then
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2047 ;; save it to file.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2048 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2049 (insert "\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2050 (append-to-file (point-min) (point-max) file-name))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2051
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2052 (defun gnus-narrow-to-page (&optional arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2053 "Narrow the article buffer to a page.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2054 If given a numerical ARG, move forward ARG pages."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2055 (interactive "P")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2056 (setq arg (if arg (prefix-numeric-value arg) 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2057 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2058 (set-buffer gnus-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2059 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2060 (widen)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2061 ;; Remove any old next/prev buttons.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2062 (when (gnus-visual-p 'page-marker)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2063 (let ((buffer-read-only nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2064 (gnus-remove-text-with-property 'gnus-prev)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2065 (gnus-remove-text-with-property 'gnus-next)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2066 (when
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2067 (cond ((< arg 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2068 (re-search-backward page-delimiter nil 'move (1+ (abs arg))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2069 ((> arg 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2070 (re-search-forward page-delimiter nil 'move arg)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2071 (goto-char (match-end 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2072 (narrow-to-region
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2073 (point)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2074 (if (re-search-forward page-delimiter nil 'move)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2075 (match-beginning 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2076 (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2077 (when (and (gnus-visual-p 'page-marker)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2078 (not (= (point-min) 1)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2079 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2080 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2081 (gnus-insert-prev-page-button)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2082 (when (and (gnus-visual-p 'page-marker)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2083 (< (+ (point-max) 2) (buffer-size)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2084 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2085 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2086 (gnus-insert-next-page-button)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2087
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2088 ;; Article mode commands
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2089
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2090 (defun gnus-article-goto-next-page ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2091 "Show the next page of the article."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2092 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2093 (when (gnus-article-next-page)
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
2094 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2095 (gnus-article-read-summary-keys nil (gnus-character-to-event ?n))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2096
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2097 (defun gnus-article-goto-prev-page ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2098 "Show the next page of the article."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2099 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2100 (if (bobp) (gnus-article-read-summary-keys nil (gnus-character-to-event ?p))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2101 (gnus-article-prev-page nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2102
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2103 (defun gnus-article-next-page (&optional lines)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2104 "Show the next page of the current article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2105 If end of article, return non-nil. Otherwise return nil.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2106 Argument LINES specifies lines to be scrolled up."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2107 (interactive "p")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2108 (move-to-window-line -1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2109 (if (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2110 (end-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2111 (and (pos-visible-in-window-p) ;Not continuation line.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2112 (eobp)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2113 ;; Nothing in this page.
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
2114 (if (or (not gnus-page-broken)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2115 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2116 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2117 (widen) (forward-line 1) (eobp)))) ;Real end-of-buffer?
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2118 t ;Nothing more.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2119 (gnus-narrow-to-page 1) ;Go to next page.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2120 nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2121 ;; More in this page.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2122 (let ((scroll-in-place nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2123 (condition-case ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2124 (scroll-up lines)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2125 (end-of-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2126 ;; Long lines may cause an end-of-buffer error.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2127 (goto-char (point-max)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2128 (move-to-window-line 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2129 nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2130
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2131 (defun gnus-article-prev-page (&optional lines)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2132 "Show previous page of current article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2133 Argument LINES specifies lines to be scrolled down."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2134 (interactive "p")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2135 (move-to-window-line 0)
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
2136 (if (and gnus-page-broken
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2137 (bobp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2138 (not (save-restriction (widen) (bobp)))) ;Real beginning-of-buffer?
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2139 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2140 (gnus-narrow-to-page -1) ;Go to previous page.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2141 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2142 (recenter -1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2143 (let ((scroll-in-place nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2144 (prog1
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
2145 (condition-case ()
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
2146 (scroll-down lines)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
2147 (beginning-of-buffer
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
2148 (goto-char (point-min))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2149 (move-to-window-line 0)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2150
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2151 (defun gnus-article-refer-article ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2152 "Read article specified by message-id around point."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2153 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2154 (let ((point (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2155 (search-forward ">" nil t) ;Move point to end of "<....>".
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2156 (if (re-search-backward "\\(<[^<> \t\n]+>\\)" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2157 (let ((message-id (match-string 1)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2158 (goto-char point)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2159 (set-buffer gnus-summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2160 (gnus-summary-refer-article message-id))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2161 (goto-char (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2162 (error "No references around point"))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2163
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2164 (defun gnus-article-show-summary ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2165 "Reconfigure windows to show summary buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2166 (interactive)
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
2167 (if (not (gnus-buffer-live-p gnus-summary-buffer))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
2168 (error "There is no summary buffer for this article buffer")
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
2169 (gnus-configure-windows 'article)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
2170 (gnus-summary-goto-subject gnus-current-article)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2171
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2172 (defun gnus-article-describe-briefly ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2173 "Describe article mode commands briefly."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2174 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2175 (gnus-message 6
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2176 (substitute-command-keys "\\<gnus-article-mode-map>\\[gnus-article-goto-next-page]:Next page \\[gnus-article-goto-prev-page]:Prev page \\[gnus-article-show-summary]:Show summary \\[gnus-info-find-node]:Run Info \\[gnus-article-describe-briefly]:This help")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2177
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2178 (defun gnus-article-summary-command ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2179 "Execute the last keystroke in the summary buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2180 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2181 (let ((obuf (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2182 (owin (current-window-configuration))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2183 func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2184 (switch-to-buffer gnus-summary-buffer 'norecord)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2185 (setq func (lookup-key (current-local-map) (this-command-keys)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2186 (call-interactively func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2187 (set-buffer obuf)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2188 (set-window-configuration owin)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2189 (set-window-point (get-buffer-window (current-buffer)) (point))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2190
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2191 (defun gnus-article-summary-command-nosave ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2192 "Execute the last keystroke in the summary buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2193 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2194 (let (func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2195 (pop-to-buffer gnus-summary-buffer 'norecord)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2196 (setq func (lookup-key (current-local-map) (this-command-keys)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2197 (call-interactively func)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2198
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2199 (defun gnus-article-read-summary-keys (&optional arg key not-restore-window)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2200 "Read a summary buffer key sequence and execute it from the article buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2201 (interactive "P")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2202 (let ((nosaves
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2203 '("q" "Q" "c" "r" "R" "\C-c\C-f" "m" "a" "f" "F"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2204 "Zc" "ZC" "ZE" "ZQ" "ZZ" "Zn" "ZR" "ZG" "ZN" "ZP"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2205 "=" "^" "\M-^" "|"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2206 (nosave-but-article
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2207 '("A\r"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2208 (nosave-in-article
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2209 '("\C-d"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2210 keys)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2211 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2212 (set-buffer gnus-summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2213 (let (gnus-pick-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2214 (push (or key last-command-event) unread-command-events)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2215 (setq keys (read-key-sequence nil))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2216 (message "")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2217
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2218 (if (or (member keys nosaves)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2219 (member keys nosave-but-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2220 (member keys nosave-in-article))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2221 (let (func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2222 (save-window-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2223 (pop-to-buffer gnus-summary-buffer 'norecord)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2224 ;; We disable the pick minor mode commands.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2225 (let (gnus-pick-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2226 (setq func (lookup-key (current-local-map) keys))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2227 (if (not func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2228 (ding)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2229 (unless (member keys nosave-in-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2230 (set-buffer gnus-summary-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2231 (call-interactively func))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2232 (when (member keys nosave-but-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2233 (pop-to-buffer gnus-article-buffer 'norecord)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2234 ;; These commands should restore window configuration.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2235 (let ((obuf (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2236 (owin (current-window-configuration))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2237 (opoint (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2238 func in-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2239 (if not-restore-window
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2240 (pop-to-buffer gnus-summary-buffer 'norecord)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2241 (switch-to-buffer gnus-summary-buffer 'norecord))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2242 (setq in-buffer (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2243 ;; We disable the pick minor mode commands.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2244 (if (setq func (let (gnus-pick-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2245 (lookup-key (current-local-map) keys)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2246 (call-interactively func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2247 (ding))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2248 (when (eq in-buffer (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2249 (set-buffer obuf)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2250 (unless not-restore-window
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2251 (set-window-configuration owin))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2252 (set-window-point (get-buffer-window (current-buffer)) opoint))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2253
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2254 (defun gnus-article-hide (&optional arg force)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2255 "Hide all the gruft in the current article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2256 This means that PGP stuff, signatures, cited text and (some)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2257 headers will be hidden.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2258 If given a prefix, show the hidden text instead."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2259 (interactive (list current-prefix-arg 'force))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2260 (gnus-article-hide-headers arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2261 (gnus-article-hide-pgp arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2262 (gnus-article-hide-citation-maybe arg force)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2263 (gnus-article-hide-signature arg))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2264
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2265 (defun gnus-article-maybe-highlight ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2266 "Do some article highlighting if `article-visual' is non-nil."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2267 (when (gnus-visual-p 'article-highlight 'highlight)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2268 (gnus-article-highlight-some)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2269
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2270 (defun gnus-request-article-this-buffer (article group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2271 "Get an article and insert it into this buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2272 (let (do-update-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2273 (prog1
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2274 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2275 (erase-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2276 (gnus-kill-all-overlays)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2277 (setq group (or group gnus-newsgroup-name))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2278
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2279 ;; Open server if it has closed.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2280 (gnus-check-server (gnus-find-method-for-group group))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2281
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2282 ;; Using `gnus-request-article' directly will insert the article into
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2283 ;; `nntp-server-buffer' - so we'll save some time by not having to
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2284 ;; copy it from the server buffer into the article buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2285
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2286 ;; We only request an article by message-id when we do not have the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2287 ;; headers for it, so we'll have to get those.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2288 (when (stringp article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2289 (let ((gnus-override-method gnus-refer-article-method))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2290 (gnus-read-header article)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2291
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2292 ;; If the article number is negative, that means that this article
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2293 ;; doesn't belong in this newsgroup (possibly), so we find its
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2294 ;; message-id and request it by id instead of number.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2295 (when (and (numberp article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2296 gnus-summary-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2297 (get-buffer gnus-summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2298 (buffer-name (get-buffer gnus-summary-buffer)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2299 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2300 (set-buffer gnus-summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2301 (let ((header (gnus-summary-article-header article)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2302 (when (< article 0)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2303 (cond
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2304 ((memq article gnus-newsgroup-sparse)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2305 ;; This is a sparse gap article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2306 (setq do-update-line article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2307 (setq article (mail-header-id header))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2308 (let ((gnus-override-method gnus-refer-article-method))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2309 (gnus-read-header article))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2310 (setq gnus-newsgroup-sparse
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2311 (delq article gnus-newsgroup-sparse)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2312 ((vectorp header)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2313 ;; It's a real article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2314 (setq article (mail-header-id header)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2315 (t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2316 ;; It is an extracted pseudo-article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2317 (setq article 'pseudo)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2318 (gnus-request-pseudo-article header))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2319
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2320 (let ((method (gnus-find-method-for-group
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2321 gnus-newsgroup-name)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2322 (if (not (eq (car method) 'nneething))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2323 ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2324 (let ((dir (concat (file-name-as-directory (nth 1 method))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2325 (mail-header-subject header))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2326 (when (file-directory-p dir)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2327 (setq article 'nneething)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2328 (gnus-group-enter-directory dir))))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2329
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2330 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2331 ;; Refuse to select canceled articles.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2332 ((and (numberp article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2333 gnus-summary-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2334 (get-buffer gnus-summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2335 (buffer-name (get-buffer gnus-summary-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2336 (eq (cdr (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2337 (set-buffer gnus-summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2338 (assq article gnus-newsgroup-reads)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2339 gnus-canceled-mark))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2340 nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2341 ;; We first check `gnus-original-article-buffer'.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2342 ((and (get-buffer gnus-original-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2343 (numberp article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2344 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2345 (set-buffer gnus-original-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2346 (and (equal (car gnus-original-article) group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2347 (eq (cdr gnus-original-article) article))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2348 (insert-buffer-substring gnus-original-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2349 'article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2350 ;; Check the backlog.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2351 ((and gnus-keep-backlog
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2352 (gnus-backlog-request-article group article (current-buffer)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2353 'article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2354 ;; Check asynchronous pre-fetch.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2355 ((gnus-async-request-fetched-article group article (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2356 (gnus-async-prefetch-next group article gnus-summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2357 'article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2358 ;; Check the cache.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2359 ((and gnus-use-cache
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2360 (numberp article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2361 (gnus-cache-request-article article group))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2362 'article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2363 ;; Get the article and put into the article buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2364 ((or (stringp article) (numberp article))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2365 (let ((gnus-override-method
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2366 (and (stringp article) gnus-refer-article-method))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2367 (buffer-read-only nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2368 (erase-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2369 (gnus-kill-all-overlays)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2370 (when (gnus-request-article article group (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2371 (when (numberp article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2372 (gnus-async-prefetch-next group article gnus-summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2373 (when gnus-keep-backlog
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2374 (gnus-backlog-enter-article
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2375 group article (current-buffer))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2376 'article)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2377 ;; It was a pseudo.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2378 (t article)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2379
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2380 ;; Take the article from the original article buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2381 ;; and place it in the buffer it's supposed to be in.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2382 (when (and (get-buffer gnus-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2383 ;;(numberp article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2384 (equal (buffer-name (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2385 (buffer-name (get-buffer gnus-article-buffer))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2386 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2387 (if (get-buffer gnus-original-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2388 (set-buffer (get-buffer gnus-original-article-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2389 (set-buffer (get-buffer-create gnus-original-article-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2390 (buffer-disable-undo (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2391 (setq major-mode 'gnus-original-article-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2392 (setq buffer-read-only t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2393 (gnus-add-current-to-buffer-list))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2394 (let (buffer-read-only)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2395 (erase-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2396 (insert-buffer-substring gnus-article-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2397 (setq gnus-original-article (cons group article))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2398
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2399 ;; Update sparse articles.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2400 (when (and do-update-line
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2401 (or (numberp article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2402 (stringp article)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2403 (let ((buf (current-buffer)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2404 (set-buffer gnus-summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2405 (gnus-summary-update-article do-update-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2406 (gnus-summary-goto-subject do-update-line nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2407 (set-window-point (get-buffer-window (current-buffer) t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2408 (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2409 (set-buffer buf))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2410
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2411 ;;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2412 ;;; Article editing
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2413 ;;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2414
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2415 (defcustom gnus-article-edit-mode-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2416 "Hook run in article edit mode buffers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2417 :group 'gnus-article-various
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2418 :type 'hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2419
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2420 (defvar gnus-article-edit-done-function nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2421
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2422 (defvar gnus-article-edit-mode-map nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2423
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2424 (unless gnus-article-edit-mode-map
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2425 (setq gnus-article-edit-mode-map (copy-keymap text-mode-map))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2426
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2427 (gnus-define-keys gnus-article-edit-mode-map
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2428 "\C-c\C-c" gnus-article-edit-done
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2429 "\C-c\C-k" gnus-article-edit-exit)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2430
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2431 (gnus-define-keys (gnus-article-edit-wash-map
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2432 "\C-c\C-w" gnus-article-edit-mode-map)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2433 "f" gnus-article-edit-full-stops))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2434
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2435 (defun gnus-article-edit-mode ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2436 "Major mode for editing articles.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2437 This is an extended text-mode.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2438
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2439 \\{gnus-article-edit-mode-map}"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2440 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2441 (kill-all-local-variables)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2442 (setq major-mode 'gnus-article-edit-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2443 (setq mode-name "Article Edit")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2444 (use-local-map gnus-article-edit-mode-map)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2445 (make-local-variable 'gnus-article-edit-done-function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2446 (make-local-variable 'gnus-prev-winconf)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2447 (setq buffer-read-only nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2448 (buffer-enable-undo)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2449 (widen)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2450 (run-hooks 'text-mode 'gnus-article-edit-mode-hook))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2451
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2452 (defun gnus-article-edit (&optional force)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2453 "Edit the current article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2454 This will have permanent effect only in mail groups.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2455 If FORCE is non-nil, allow editing of articles even in read-only
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2456 groups."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2457 (interactive "P")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2458 (when (and (not force)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2459 (gnus-group-read-only-p))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2460 (error "The current newsgroup does not support article editing."))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2461 (gnus-article-edit-article
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2462 `(lambda ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2463 (gnus-summary-edit-article-done
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2464 ,(or (mail-header-references gnus-current-headers) "")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2465 ,(gnus-group-read-only-p) ,gnus-summary-buffer))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2466
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2467 (defun gnus-article-edit-article (exit-func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2468 "Start editing the contents of the current article buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2469 (let ((winconf (current-window-configuration)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2470 (set-buffer gnus-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2471 (gnus-article-edit-mode)
144
318232e2a3f0 Import from CVS: tag r20-2b6
cvs
parents: 142
diff changeset
2472 (gnus-set-text-properties (point-min) (point-max) nil)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2473 (gnus-configure-windows 'edit-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2474 (setq gnus-article-edit-done-function exit-func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2475 (setq gnus-prev-winconf winconf)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2476 (gnus-message 6 "C-c C-c to end edits")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2477
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2478 (defun gnus-article-edit-done ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2479 "Update the article edits and exit."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2480 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2481 (let ((func gnus-article-edit-done-function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2482 (buf (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2483 (start (window-start)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2484 (gnus-article-edit-exit)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2485 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2486 (set-buffer buf)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2487 (let ((buffer-read-only nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2488 (funcall func)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2489 (set-buffer buf)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2490 (set-window-start (get-buffer-window buf) start)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2491 (set-window-point (get-buffer-window buf) (point))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2492
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2493 (defun gnus-article-edit-exit ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2494 "Exit the article editing without updating."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2495 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2496 ;; We remove all text props from the article buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2497 (let ((buf (format "%s" (buffer-string)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2498 (curbuf (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2499 (p (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2500 (window-start (window-start)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2501 (erase-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2502 (insert buf)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2503 (let ((winconf gnus-prev-winconf))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2504 (gnus-article-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2505 ;; The cache and backlog have to be flushed somewhat.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2506 (when gnus-use-cache
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2507 (gnus-cache-update-article
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2508 (car gnus-article-current) (cdr gnus-article-current)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2509 (when gnus-keep-backlog
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2510 (gnus-backlog-remove-article
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2511 (car gnus-article-current) (cdr gnus-article-current)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2512 ;; Flush original article as well.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2513 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2514 (when (get-buffer gnus-original-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2515 (set-buffer gnus-original-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2516 (setq gnus-original-article nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2517 (set-window-configuration winconf)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2518 ;; Tippy-toe some to make sure that point remains where it was.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2519 (let ((buf (current-buffer)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2520 (set-buffer curbuf)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2521 (set-window-start (get-buffer-window (current-buffer)) window-start)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2522 (goto-char p)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2523 (set-buffer buf)))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2524
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2525 (defun gnus-article-edit-full-stops ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2526 "Interactively repair spacing at end of sentences."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2527 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2528 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2529 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2530 (search-forward-regexp "^$" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2531 (let ((case-fold-search nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2532 (query-replace-regexp "\\([.!?][])}]* \\)\\([[({A-Z]\\)" "\\1 \\2"))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2533
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2534 ;;;
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2535 ;;; Article highlights
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2536 ;;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2537
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2538 ;; Written by Per Abrahamsen <abraham@iesd.auc.dk>.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2539
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2540 ;;; Internal Variables:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2541
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2542 (defcustom gnus-button-url-regexp "\\b\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?\\([-a-zA-Z0-9_=!?#$@~`%&*+|\\/:;.,]\\|\\w\\)+\\([-a-zA-Z0-9_=#$@~`%&*+|\\/]\\|\\w\\)"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2543 "Regular expression that matches URLs."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2544 :group 'gnus-article-buttons
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2545 :type 'regexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2546
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2547 (defcustom gnus-button-alist
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2548 `(("<\\(url: ?\\)?news:\\([^>\n\t ]*@[^>\n\t ]*\\)>" 0 t
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2549 gnus-button-message-id 2)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2550 ("\\bnews:\\([^>\n\t ]*@[^>\n\t ]*+\\)" 0 t gnus-button-message-id 1)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2551 ("\\(\\b<\\(url: ?\\)?news:\\(//\\)?\\([^>\n\t ]*\\)>\\)" 1 t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2552 gnus-button-fetch-group 4)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2553 ("\\bnews:\\(//\\)?\\([^>\n\t ]+\\)" 0 t gnus-button-fetch-group 2)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2554 ("\\bin\\( +article\\)? +\\(<\\([^\n @<>]+@[^\n @<>]+\\)>\\)" 2
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2555 t gnus-button-message-id 3)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2556 ("\\(<URL: *\\)mailto: *\\([^> \n\t]+\\)>" 0 t gnus-url-mailto 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2557 ("\\bmailto:\\([^ \n\t]+\\)" 0 t gnus-url-mailto 2)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2558 ;; This is how URLs _should_ be embedded in text...
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2559 ("<URL: *\\([^>]*\\)>" 0 t gnus-button-embedded-url 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2560 ;; Raw URLs.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2561 (,gnus-button-url-regexp 0 t gnus-button-url 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2562 "Alist of regexps matching buttons in article bodies.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2563
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2564 Each entry has the form (REGEXP BUTTON FORM CALLBACK PAR...), where
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2565 REGEXP: is the string matching text around the button,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2566 BUTTON: is the number of the regexp grouping actually matching the button,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2567 FORM: is a lisp expression which must eval to true for the button to
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2568 be added,
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2569 CALLBACK: is the function to call when the user push this button, and each
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2570 PAR: is a number of a regexp grouping whose text will be passed to CALLBACK.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2571
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2572 CALLBACK can also be a variable, in that case the value of that
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2573 variable it the real callback function."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2574 :group 'gnus-article-buttons
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2575 :type '(repeat (list regexp
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2576 (integer :tag "Button")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2577 (sexp :tag "Form")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2578 (function :tag "Callback")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2579 (repeat :tag "Par"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2580 :inline t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2581 (integer :tag "Regexp group")))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2582
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2583 (defcustom gnus-header-button-alist
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2584 `(("^\\(References\\|Message-I[Dd]\\):" "<[^>]+>"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2585 0 t gnus-button-message-id 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2586 ("^\\(From\\|Reply-To\\):" ": *\\(.+\\)$" 1 t gnus-button-reply 1)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2587 ("^\\(Cc\\|To\\):" "[^ \t\n<>,()\"]+@[^ \t\n<>,()\"]+"
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2588 0 t gnus-button-mailto 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2589 ("^X-[Uu][Rr][Ll]:" ,gnus-button-url-regexp 0 t gnus-button-url 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2590 ("^[^:]+:" ,gnus-button-url-regexp 0 t gnus-button-url 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2591 ("^[^:]+:" "\\(<\\(url: \\)?news:\\([^>\n ]*\\)>\\)" 1 t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2592 gnus-button-message-id 3))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2593 "Alist of headers and regexps to match buttons in article heads.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2594
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2595 This alist is very similar to `gnus-button-alist', except that each
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2596 alist has an additional HEADER element first in each entry:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2597
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2598 \(HEADER REGEXP BUTTON FORM CALLBACK PAR)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2599
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2600 HEADER is a regexp to match a header. For a fuller explanation, see
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2601 `gnus-button-alist'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2602 :group 'gnus-article-buttons
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2603 :group 'gnus-article-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2604 :type '(repeat (list (regexp :tag "Header")
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2605 regexp
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2606 (integer :tag "Button")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2607 (sexp :tag "Form")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2608 (function :tag "Callback")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2609 (repeat :tag "Par"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2610 :inline t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2611 (integer :tag "Regexp group")))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2612
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2613 (defvar gnus-button-regexp nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2614 (defvar gnus-button-marker-list nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2615 ;; Regexp matching any of the regexps from `gnus-button-alist'.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2616
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2617 (defvar gnus-button-last nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2618 ;; The value of `gnus-button-alist' when `gnus-button-regexp' was build.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2619
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2620 ;;; Commands:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2621
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2622 (defun gnus-article-push-button (event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2623 "Check text under the mouse pointer for a callback function.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2624 If the text under the mouse pointer has a `gnus-callback' property,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2625 call it with the value of the `gnus-data' text property."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2626 (interactive "e")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2627 (set-buffer (window-buffer (posn-window (event-start event))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2628 (let* ((pos (posn-point (event-start event)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2629 (data (get-text-property pos 'gnus-data))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2630 (fun (get-text-property pos 'gnus-callback)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2631 (when fun
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2632 (funcall fun data))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2633
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2634 (defun gnus-article-press-button ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2635 "Check text at point for a callback function.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2636 If the text at point has a `gnus-callback' property,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2637 call it with the value of the `gnus-data' text property."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2638 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2639 (let* ((data (get-text-property (point) 'gnus-data))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2640 (fun (get-text-property (point) 'gnus-callback)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2641 (when fun
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2642 (funcall fun data))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2643
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2644 (defun gnus-article-prev-button (n)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2645 "Move point to N buttons backward.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2646 If N is negative, move forward instead."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2647 (interactive "p")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2648 (gnus-article-next-button (- n)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2649
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2650 (defun gnus-article-next-button (n)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2651 "Move point to N buttons forward.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2652 If N is negative, move backward instead."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2653 (interactive "p")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2654 (let ((function (if (< n 0) 'previous-single-property-change
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2655 'next-single-property-change))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2656 (inhibit-point-motion-hooks t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2657 (backward (< n 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2658 (limit (if (< n 0) (point-min) (point-max))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2659 (setq n (abs n))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2660 (while (and (not (= limit (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2661 (> n 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2662 ;; Skip past the current button.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2663 (when (get-text-property (point) 'gnus-callback)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2664 (goto-char (funcall function (point) 'gnus-callback nil limit)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2665 ;; Go to the next (or previous) button.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2666 (gnus-goto-char (funcall function (point) 'gnus-callback nil limit))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2667 ;; Put point at the start of the button.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2668 (when (and backward (not (get-text-property (point) 'gnus-callback)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2669 (goto-char (funcall function (point) 'gnus-callback nil limit)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2670 ;; Skip past intangible buttons.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2671 (when (get-text-property (point) 'intangible)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2672 (incf n))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2673 (decf n))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2674 (unless (zerop n)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2675 (gnus-message 5 "No more buttons"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2676 n))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2677
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2678 (defun gnus-article-highlight (&optional force)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2679 "Highlight current article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2680 This function calls `gnus-article-highlight-headers',
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2681 `gnus-article-highlight-citation',
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2682 `gnus-article-highlight-signature', and `gnus-article-add-buttons' to
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2683 do the highlighting. See the documentation for those functions."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2684 (interactive (list 'force))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2685 (gnus-article-highlight-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2686 (gnus-article-highlight-citation force)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2687 (gnus-article-highlight-signature)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2688 (gnus-article-add-buttons force)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2689 (gnus-article-add-buttons-to-head))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2690
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2691 (defun gnus-article-highlight-some (&optional force)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2692 "Highlight current article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2693 This function calls `gnus-article-highlight-headers',
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2694 `gnus-article-highlight-signature', and `gnus-article-add-buttons' to
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2695 do the highlighting. See the documentation for those functions."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2696 (interactive (list 'force))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2697 (gnus-article-highlight-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2698 (gnus-article-highlight-signature)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2699 (gnus-article-add-buttons))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2700
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2701 (defun gnus-article-highlight-headers ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2702 "Highlight article headers as specified by `gnus-header-face-alist'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2703 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2704 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2705 (set-buffer gnus-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2706 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2707 (let ((alist gnus-header-face-alist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2708 (buffer-read-only nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2709 (case-fold-search t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2710 (inhibit-point-motion-hooks t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2711 entry regexp header-face field-face from hpoints fpoints)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2712 (message-narrow-to-head)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2713 (while (setq entry (pop alist))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2714 (goto-char (point-min))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2715 (setq regexp (concat "^\\("
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2716 (if (string-equal "" (nth 0 entry))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2717 "[^\t ]"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2718 (nth 0 entry))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2719 "\\)")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2720 header-face (nth 1 entry)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2721 field-face (nth 2 entry))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2722 (while (and (re-search-forward regexp nil t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2723 (not (eobp)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2724 (beginning-of-line)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2725 (setq from (point))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2726 (unless (search-forward ":" nil t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2727 (forward-char 1))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2728 (when (and header-face
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2729 (not (memq (point) hpoints)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2730 (push (point) hpoints)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2731 (gnus-put-text-property from (point) 'face header-face))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2732 (when (and field-face
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2733 (not (memq (setq from (point)) fpoints)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2734 (push from fpoints)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2735 (if (re-search-forward "^[^ \t]" nil t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2736 (forward-char -2)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2737 (goto-char (point-max)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2738 (gnus-put-text-property from (point) 'face field-face))))))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2739
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2740 (defun gnus-article-highlight-signature ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2741 "Highlight the signature in an article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2742 It does this by highlighting everything after
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2743 `gnus-signature-separator' using `gnus-signature-face'."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2744 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2745 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2746 (set-buffer gnus-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2747 (let ((buffer-read-only nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2748 (inhibit-point-motion-hooks t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2749 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2750 (when (and gnus-signature-face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2751 (gnus-article-narrow-to-signature))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2752 (gnus-overlay-put (gnus-make-overlay (point-min) (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2753 'face gnus-signature-face)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2754 (widen)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2755 (gnus-article-search-signature)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2756 (let ((start (match-beginning 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2757 (end (set-marker (make-marker) (1+ (match-end 0)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2758 (gnus-article-add-button start (1- end) 'gnus-signature-toggle
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2759 end)))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2760
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2761 (defun gnus-button-in-region-p (b e prop)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2762 "Say whether PROP exists in the region."
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2763 (text-property-not-all b e prop nil))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2764
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2765 (defun gnus-article-add-buttons (&optional force)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2766 "Find external references in the article and make buttons of them.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2767 \"External references\" are things like Message-IDs and URLs, as
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2768 specified by `gnus-button-alist'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2769 (interactive (list 'force))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2770 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2771 (set-buffer gnus-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2772 (let ((buffer-read-only nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2773 (inhibit-point-motion-hooks t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2774 (case-fold-search t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2775 (alist gnus-button-alist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2776 beg entry regexp)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2777 ;; Remove all old markers.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2778 (let (marker entry)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2779 (while (setq marker (pop gnus-button-marker-list))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2780 (goto-char marker)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2781 (when (setq entry (gnus-button-entry))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2782 (put-text-property (match-beginning (nth 1 entry))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2783 (match-end (nth 1 entry))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2784 'gnus-callback nil))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2785 (set-marker marker nil)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2786 ;; We skip the headers.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2787 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2788 (unless (search-forward "\n\n" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2789 (goto-char (point-max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2790 (setq beg (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2791 (while (setq entry (pop alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2792 (setq regexp (car entry))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2793 (goto-char beg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2794 (while (re-search-forward regexp nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2795 (let* ((start (and entry (match-beginning (nth 1 entry))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2796 (end (and entry (match-end (nth 1 entry))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2797 (from (match-beginning 0)))
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
2798 (when (and (or (eq t (nth 2 entry))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 116
diff changeset
2799 (eval (nth 2 entry)))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
2800 (not (gnus-button-in-region-p
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
2801 start end 'gnus-callback)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2802 ;; That optional form returned non-nil, so we add the
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
2803 ;; button.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2804 (gnus-article-add-button
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2805 start end 'gnus-button-push
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2806 (car (push (set-marker (make-marker) from)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2807 gnus-button-marker-list))))))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2808
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2809 ;; Add buttons to the head of an article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2810 (defun gnus-article-add-buttons-to-head ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2811 "Add buttons to the head of the article."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2812 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2813 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2814 (set-buffer gnus-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2815 (let ((buffer-read-only nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2816 (inhibit-point-motion-hooks t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2817 (case-fold-search t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2818 (alist gnus-header-button-alist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2819 entry beg end)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2820 (nnheader-narrow-to-headers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2821 (while alist
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2822 ;; Each alist entry.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2823 (setq entry (car alist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2824 alist (cdr alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2825 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2826 (while (re-search-forward (car entry) nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2827 ;; Each header matching the entry.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2828 (setq beg (match-beginning 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2829 (setq end (or (and (re-search-forward "^[^ \t]" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2830 (match-beginning 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2831 (point-max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2832 (goto-char beg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2833 (while (re-search-forward (nth 1 entry) end t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2834 ;; Each match within a header.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2835 (let* ((entry (cdr entry))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2836 (start (match-beginning (nth 1 entry)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2837 (end (match-end (nth 1 entry)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2838 (form (nth 2 entry)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2839 (goto-char (match-end 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2840 (when (eval form)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2841 (gnus-article-add-button
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2842 start end (nth 3 entry)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2843 (buffer-substring (match-beginning (nth 4 entry))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2844 (match-end (nth 4 entry)))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2845 (goto-char end))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2846 (widen)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2847
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2848 ;;; External functions:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2849
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2850 (defun gnus-article-add-button (from to fun &optional data)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2851 "Create a button between FROM and TO with callback FUN and data DATA."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2852 (when gnus-article-button-face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2853 (gnus-overlay-put (gnus-make-overlay from to)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2854 'face gnus-article-button-face))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2855 (gnus-add-text-properties
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2856 from to
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2857 (nconc (and gnus-article-mouse-face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2858 (list gnus-mouse-face-prop gnus-article-mouse-face))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2859 (list 'gnus-callback fun)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2860 (and data (list 'gnus-data data)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2861
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2862 ;;; Internal functions:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2863
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2864 (defun gnus-signature-toggle (end)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2865 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2866 (set-buffer gnus-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2867 (let ((buffer-read-only nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2868 (inhibit-point-motion-hooks t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2869 (if (get-text-property end 'invisible)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2870 (gnus-article-unhide-text end (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2871 (gnus-article-hide-text end (point-max) gnus-hidden-properties)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2872
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2873 (defun gnus-button-entry ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2874 ;; Return the first entry in `gnus-button-alist' matching this place.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2875 (let ((alist gnus-button-alist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2876 (entry nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2877 (while alist
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2878 (setq entry (pop alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2879 (if (looking-at (car entry))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2880 (setq alist nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2881 (setq entry nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2882 entry))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2883
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2884 (defun gnus-button-push (marker)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2885 ;; Push button starting at MARKER.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2886 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2887 (set-buffer gnus-article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2888 (goto-char marker)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2889 (let* ((entry (gnus-button-entry))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2890 (inhibit-point-motion-hooks t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2891 (fun (nth 3 entry))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2892 (args (mapcar (lambda (group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2893 (let ((string (match-string group)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2894 (gnus-set-text-properties
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2895 0 (length string) nil string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2896 string))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2897 (nthcdr 4 entry))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2898 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2899 ((fboundp fun)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2900 (apply fun args))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2901 ((and (boundp fun)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2902 (fboundp (symbol-value fun)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2903 (apply (symbol-value fun) args))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2904 (t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2905 (gnus-message 1 "You must define `%S' to use this button"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2906 (cons fun args)))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2907
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2908 (defun gnus-button-message-id (message-id)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2909 "Fetch MESSAGE-ID."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2910 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2911 (set-buffer gnus-summary-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2912 (gnus-summary-refer-article message-id)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2913
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2914 (defun gnus-button-fetch-group (address)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2915 "Fetch GROUP specified by ADDRESS."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2916 (if (not (string-match "[:/]" address))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2917 ;; This is just a simple group url.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2918 (gnus-group-read-ephemeral-group address gnus-select-method)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2919 (if (not (string-match "^\\([^:/]+\\)\\(:\\([^/]+\\)/\\)?\\(.*\\)$"
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2920 address))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2921 (error "Can't parse %s" address)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2922 (gnus-group-read-ephemeral-group
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2923 (match-string 4 address)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2924 `(nntp ,(match-string 1 address)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2925 (nntp-address ,(match-string 1 address))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2926 (nntp-port-number ,(if (match-end 3)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2927 (match-string 3 address)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
2928 "nntp")))))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2929
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2930 (defun gnus-split-string (string pattern)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2931 "Return a list of substrings of STRING which are separated by PATTERN."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2932 (let (parts (start 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2933 (while (string-match pattern string start)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2934 (setq parts (cons (substring string start (match-beginning 0)) parts)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2935 start (match-end 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2936 (nreverse (cons (substring string start) parts))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2937
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2938 (defun gnus-url-parse-query-string (query &optional downcase)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2939 (let (retval pairs cur key val)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2940 (setq pairs (gnus-split-string query "&"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2941 (while pairs
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2942 (setq cur (car pairs)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2943 pairs (cdr pairs))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2944 (if (not (string-match "=" cur))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2945 nil ; Grace
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2946 (setq key (gnus-url-unhex-string (substring cur 0 (match-beginning 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2947 val (gnus-url-unhex-string (substring cur (match-end 0) nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2948 (if downcase
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2949 (setq key (downcase key)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2950 (setq cur (assoc key retval))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2951 (if cur
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2952 (setcdr cur (cons val (cdr cur)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2953 (setq retval (cons (list key val) retval)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2954 retval))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2955
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2956 (defun gnus-url-unhex (x)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2957 (if (> x ?9)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2958 (if (>= x ?a)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2959 (+ 10 (- x ?a))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2960 (+ 10 (- x ?A)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2961 (- x ?0)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2962
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2963 (defun gnus-url-unhex-string (str &optional allow-newlines)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2964 "Remove %XXX embedded spaces, etc in a url.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2965 If optional second argument ALLOW-NEWLINES is non-nil, then allow the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2966 decoding of carriage returns and line feeds in the string, which is normally
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2967 forbidden in URL encoding."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2968 (setq str (or str ""))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2969 (let ((tmp "")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2970 (case-fold-search t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2971 (while (string-match "%[0-9a-f][0-9a-f]" str)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2972 (let* ((start (match-beginning 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2973 (ch1 (gnus-url-unhex (elt str (+ start 1))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2974 (code (+ (* 16 ch1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2975 (gnus-url-unhex (elt str (+ start 2))))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2976 (setq tmp (concat
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2977 tmp (substring str 0 start)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2978 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2979 (allow-newlines
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2980 (char-to-string code))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2981 ((or (= code ?\n) (= code ?\r))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2982 " ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2983 (t (char-to-string code))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2984 str (substring str (match-end 0)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2985 (setq tmp (concat tmp str))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2986 tmp))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
2987
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2988 (defun gnus-url-mailto (url)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2989 ;; Send mail to someone
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2990 (when (string-match "mailto:/*\\(.*\\)" url)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2991 (setq url (substring url (match-beginning 1) nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2992 (let (to args source-url subject func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2993 (if (string-match (regexp-quote "?") url)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2994 (setq to (gnus-url-unhex-string (substring url 0 (match-beginning 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2995 args (gnus-url-parse-query-string
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2996 (substring url (match-end 0) nil) t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2997 (setq to (gnus-url-unhex-string url)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2998 (setq args (cons (list "to" to) args)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2999 subject (cdr-safe (assoc "subject" args)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3000 (message-mail)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3001 (while args
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3002 (setq func (intern-soft (concat "message-goto-" (downcase (caar args)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3003 (if (fboundp func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3004 (funcall func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3005 (message-position-on-field (caar args)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3006 (insert (mapconcat 'identity (cdar args) ", "))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3007 (setq args (cdr args)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3008 (if subject
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3009 (message-goto-body)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3010 (message-goto-subject))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3011
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3012 (defun gnus-button-mailto (address)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3013 ;; Mail to ADDRESS.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3014 (set-buffer (gnus-copy-article-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3015 (message-reply address))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3016
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3017 (defun gnus-button-reply (address)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3018 ;; Reply to ADDRESS.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3019 (message-reply address))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3020
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3021 (defun gnus-button-url (address)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3022 "Browse ADDRESS."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3023 (funcall browse-url-browser-function address))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3024
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3025 (defun gnus-button-embedded-url (address)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3026 "Browse ADDRESS."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3027 (funcall browse-url-browser-function (gnus-strip-whitespace address)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3028
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3029 ;;; Next/prev buttons in the article buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3030
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3031 (defvar gnus-next-page-line-format "%{%(Next page...%)%}\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3032 (defvar gnus-prev-page-line-format "%{%(Previous page...%)%}\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3033
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3034 (defvar gnus-prev-page-map nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3035 (unless gnus-prev-page-map
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3036 (setq gnus-prev-page-map (make-sparse-keymap))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3037 (define-key gnus-prev-page-map gnus-mouse-2 'gnus-button-prev-page)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3038 (define-key gnus-prev-page-map "\r" 'gnus-button-prev-page))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3039
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3040 (defun gnus-insert-prev-page-button ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3041 (let ((buffer-read-only nil))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3042 (gnus-eval-format
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3043 gnus-prev-page-line-format nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3044 `(gnus-prev t local-map ,gnus-prev-page-map
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3045 gnus-callback gnus-article-button-prev-page))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3046
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3047 (defvar gnus-next-page-map nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3048 (unless gnus-next-page-map
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3049 (setq gnus-next-page-map (make-keymap))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3050 (suppress-keymap gnus-prev-page-map)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3051 (define-key gnus-next-page-map gnus-mouse-2 'gnus-button-next-page)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3052 (define-key gnus-next-page-map "\r" 'gnus-button-next-page))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3053
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3054 (defun gnus-button-next-page ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3055 "Go to the next page."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3056 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3057 (let ((win (selected-window)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3058 (select-window (get-buffer-window gnus-article-buffer t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3059 (gnus-article-next-page)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3060 (select-window win)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3061
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3062 (defun gnus-button-prev-page ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3063 "Go to the prev page."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3064 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3065 (let ((win (selected-window)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3066 (select-window (get-buffer-window gnus-article-buffer t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3067 (gnus-article-prev-page)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3068 (select-window win)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3069
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3070 (defun gnus-insert-next-page-button ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3071 (let ((buffer-read-only nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3072 (gnus-eval-format gnus-next-page-line-format nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3073 `(gnus-next t local-map ,gnus-next-page-map
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3074 gnus-callback
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3075 gnus-article-button-next-page))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3076
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3077 (defun gnus-article-button-next-page (arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3078 "Go to the next page."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3079 (interactive "P")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3080 (let ((win (selected-window)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3081 (select-window (get-buffer-window gnus-article-buffer t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3082 (gnus-article-next-page)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3083 (select-window win)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3084
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3085 (defun gnus-article-button-prev-page (arg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3086 "Go to the prev page."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3087 (interactive "P")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3088 (let ((win (selected-window)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3089 (select-window (get-buffer-window gnus-article-buffer t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3090 (gnus-article-prev-page)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
3091 (select-window win)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3092
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3093 (gnus-ems-redefine)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3094
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3095 (provide 'gnus-art)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3096
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3097 (run-hooks 'gnus-art-load-hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3098
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3099 ;;; gnus-art.el ends here