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