annotate lisp/gnus/gnus-art.el @ 16:0293115a14e9 r19-15b91

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