annotate lisp/gnus/gnus-art.el @ 136:b980b6286996 r20-2b2

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