annotate lisp/gnus/gnus-art.el @ 22:8fc7fe29b841 r19-15b94

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