aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMiles Bader2006-01-11 02:03:24 +0000
committerMiles Bader2006-01-11 02:03:24 +0000
commit7dafe00b0d6e6636c55acb64fa1fb75aee36d343 (patch)
treefc8067f96ba09e81ad0c690312c7f23bb1a47fe2 /lisp
parent2898111ccb9249eec9b12175e29487277df9ddbd (diff)
downloademacs-7dafe00b0d6e6636c55acb64fa1fb75aee36d343.tar.gz
emacs-7dafe00b0d6e6636c55acb64fa1fb75aee36d343.zip
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-690
Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 174-181) - Update from CVS - Update from CVS: texi/gnus.texi (RSS): Addition. 2006-01-10 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/nnrss.el (nnrss-wash-html-in-text-plain-parts): New variable. (nnrss-request-article): Render text/plain parts as HTML. * lisp/gnus/gnus-art.el (gnus-article-wash-html-with-w3m): No need to narrow the buffer. 2006-01-08 Reiner Steib <Reiner.Steib@gmx.de> * lisp/gnus/gnus-cus.el (gnus-group-parameters): Sync posting-style with custom definition of `gnus-posting-styles'. * lisp/gnus/gnus-start.el (gnus-gnus-to-quick-newsrc-format): Bind print-circle. Suggested by Kalle Olavi Niemitalo <kon@iki.fi>. 2006-01-05 Reiner Steib <Reiner.Steib@gmx.de> * lisp/gnus/gnus-group.el (gnus-useful-groups): Use Gmane for ding. Use nntp for bug archive. 2006-01-05 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/nnrss.el (nnrss-request-article): Fix the way to fill text/plain parts. (nnrss-normalize-date): New function converts ISO 8601 date into RFC822 style. Suggested by Mark Plaksin <happy@mcplaksin.org>. (nnrss-check-group): Use it. 2006-01-03 Rodrigo Ventura <yoda@isr.ist.utl.pt> (tiny change) * lisp/gnus/gnus-xmas.el (gnus-xmas-group-startup-message): Typo gnus-splash-face -> gnus-splash. Fixes starting from a TTY in XEmacs. 2006-01-01 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-sum.el (gnus-summary-work-articles): Remove useless `min'. * lisp/gnus/nnrss.el (nnrss-fetch): Make it fail gracefully when it can't fetch a feed. Suggested by Mark Plaksin <happy@mcplaksin.org>. (nnrss-insert-w3): Ditto. 2005-12-21 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/nnrss.el (nnrss-request-article): Fix last change; fill text/plain parts. 2005-12-20 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/nnrss.el (nnrss-request-article): Replace <br />s with newlines in text/plain part. (nnrss-check-group): Don't add excessive newline to dc:subject. 2005-12-19 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-art.el (gnus-article-delete-text-of-type): Enable it to remove MIME buttons associated with multipart/alternative parts. (gnus-mime-display-alternative): Tag buttons using `article-type' text property. * lisp/gnus/gnus-msg.el (gnus-copy-article-buffer): Remove MIME buttons associated with multipart/alternative parts. 2005-12-19 Mark Plaksin <happy@mcplaksin.org> (tiny change) * lisp/gnus/nnrss.el (nnrss-check-group): Put the RSS dc:subject in the article. 2005-12-18 Lars Magne Ingebrigtsen <larsi@gnus.org> * lisp/gnus/dns.el (query-dns): Make sure we check the buffer size before removing tcp headers. 2006-01-10 Katsumi Yamaoka <yamaoka@jpl.org> * man/gnus.texi (RSS): Document nnrss-wash-html-in-text-plain-parts. 2006-01-06 Katsumi Yamaoka <yamaoka@jpl.org> * man/gnus.texi (RSS): Addition. 2005-12-22 Katsumi Yamaoka <yamaoka@jpl.org> * man/gnus.texi (Summary Post Commands): Fix function bound to `S O p'. 2005-12-19 Katsumi Yamaoka <yamaoka@jpl.org> * man/emacs-mime.texi (Display Customization): Add setting example to mm-discouraged-alternatives.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/gnus/ChangeLog74
-rw-r--r--lisp/gnus/dns.el3
-rw-r--r--lisp/gnus/gnus-art.el48
-rw-r--r--lisp/gnus/gnus-cus.el5
-rw-r--r--lisp/gnus/gnus-group.el17
-rw-r--r--lisp/gnus/gnus-msg.el1
-rw-r--r--lisp/gnus/gnus-start.el1
-rw-r--r--lisp/gnus/gnus-sum.el2
-rw-r--r--lisp/gnus/nnrss.el151
9 files changed, 260 insertions, 42 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index c9c5f76c601..fe3275c8380 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,77 @@
12006-01-10 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * nnrss.el (nnrss-wash-html-in-text-plain-parts): New variable.
4 (nnrss-request-article): Render text/plain parts as HTML.
5
6 * gnus-art.el (gnus-article-wash-html-with-w3m): No need to narrow
7 the buffer.
8
92006-01-08 Reiner Steib <Reiner.Steib@gmx.de>
10
11 * gnus-cus.el (gnus-group-parameters): Sync posting-style with
12 custom definition of `gnus-posting-styles'.
13
14 * gnus-start.el (gnus-gnus-to-quick-newsrc-format): Bind
15 print-circle. Suggested by Kalle Olavi Niemitalo <kon@iki.fi>.
16
172006-01-05 Reiner Steib <Reiner.Steib@gmx.de>
18
19 * gnus-group.el (gnus-useful-groups): Use Gmane for ding. Use
20 nntp for bug archive.
21
222006-01-05 Katsumi Yamaoka <yamaoka@jpl.org>
23
24 * nnrss.el (nnrss-request-article): Fix the way to fill text/plain
25 parts.
26 (nnrss-normalize-date): New function converts ISO 8601 date into
27 RFC822 style. Suggested by Mark Plaksin <happy@mcplaksin.org>.
28 (nnrss-check-group): Use it.
29
302006-01-03 Rodrigo Ventura <yoda@isr.ist.utl.pt> (tiny change)
31
32 * gnus-xmas.el (gnus-xmas-group-startup-message): Typo
33 gnus-splash-face -> gnus-splash. Fixes starting from a TTY in
34 XEmacs.
35
362006-01-01 Katsumi Yamaoka <yamaoka@jpl.org>
37
38 * gnus-sum.el (gnus-summary-work-articles): Remove useless `min'.
39
40 * nnrss.el (nnrss-fetch): Make it fail gracefully when it can't
41 fetch a feed. Suggested by Mark Plaksin <happy@mcplaksin.org>.
42 (nnrss-insert-w3): Ditto.
43
442005-12-21 Katsumi Yamaoka <yamaoka@jpl.org>
45
46 * nnrss.el (nnrss-request-article): Fix last change; fill
47 text/plain parts.
48
492005-12-20 Katsumi Yamaoka <yamaoka@jpl.org>
50
51 * nnrss.el (nnrss-request-article): Replace <br />s with newlines
52 in text/plain part.
53 (nnrss-check-group): Don't add excessive newline to dc:subject.
54
552005-12-19 Katsumi Yamaoka <yamaoka@jpl.org>
56
57 * gnus-art.el (gnus-article-delete-text-of-type): Enable it to
58 remove MIME buttons associated with multipart/alternative parts.
59 (gnus-mime-display-alternative): Tag buttons using `article-type'
60 text property.
61
62 * gnus-msg.el (gnus-copy-article-buffer): Remove MIME buttons
63 associated with multipart/alternative parts.
64
652005-12-19 Mark Plaksin <happy@mcplaksin.org> (tiny change)
66
67 * nnrss.el (nnrss-check-group): Put the RSS dc:subject in the
68 article.
69
702005-12-18 Lars Magne Ingebrigtsen <larsi@gnus.org>
71
72 * dns.el (query-dns): Make sure we check the buffer size before
73 removing tcp headers.
74
12006-01-08 Chong Yidong <cyd@stupidchicken.com> 752006-01-08 Chong Yidong <cyd@stupidchicken.com>
2 76
3 * spam.el (spam-group-ham-mark-p, spam-group-spam-mark-p) 77 * spam.el (spam-group-ham-mark-p, spam-group-spam-mark-p)
diff --git a/lisp/gnus/dns.el b/lisp/gnus/dns.el
index 01c373ba954..d73848ca6e5 100644
--- a/lisp/gnus/dns.el
+++ b/lisp/gnus/dns.el
@@ -343,7 +343,8 @@ If FULLP, return the entire record returned."
343 (decf times step)) 343 (decf times step))
344 (ignore-errors 344 (ignore-errors
345 (delete-process process)) 345 (delete-process process))
346 (when tcp-p 346 (when (and tcp-p
347 (>= (buffer-size) 2))
347 (goto-char (point-min)) 348 (goto-char (point-min))
348 (delete-region (point) (+ (point) 2))) 349 (delete-region (point) (+ (point) 2)))
349 (unless (zerop (buffer-size)) 350 (unless (zerop (buffer-size))
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index ad3c91f3579..77177765821 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -1632,10 +1632,24 @@ Initialized from `text-mode-syntax-table.")
1632 "Delete text of TYPE in the current buffer." 1632 "Delete text of TYPE in the current buffer."
1633 (save-excursion 1633 (save-excursion
1634 (let ((b (point-min))) 1634 (let ((b (point-min)))
1635 (while (setq b (text-property-any b (point-max) 'article-type type)) 1635 (if (eq type 'multipart)
1636 (delete-region 1636 ;; Remove MIME buttons associated with multipart/alternative parts.
1637 b (or (text-property-not-all b (point-max) 'article-type type) 1637 (progn
1638 (point-max))))))) 1638 (goto-char b)
1639 (while (if (get-text-property (point) 'gnus-part)
1640 (setq b (point))
1641 (when (setq b (next-single-property-change (point)
1642 'gnus-part))
1643 (goto-char b)
1644 t))
1645 (end-of-line)
1646 (skip-chars-forward "\n")
1647 (when (eq (get-text-property b 'article-type) 'multipart)
1648 (delete-region b (point)))))
1649 (while (setq b (text-property-any b (point-max) 'article-type type))
1650 (delete-region
1651 b (or (text-property-not-all b (point-max) 'article-type type)
1652 (point-max))))))))
1639 1653
1640(defun gnus-article-delete-invisible-text () 1654(defun gnus-article-delete-invisible-text ()
1641 "Delete all invisible text in the current buffer." 1655 "Delete all invisible text in the current buffer."
@@ -2500,19 +2514,17 @@ If READ-CHARSET, ask for a coding system."
2500(defun gnus-article-wash-html-with-w3m () 2514(defun gnus-article-wash-html-with-w3m ()
2501 "Wash the current buffer with emacs-w3m." 2515 "Wash the current buffer with emacs-w3m."
2502 (mm-setup-w3m) 2516 (mm-setup-w3m)
2503 (save-restriction 2517 (let ((w3m-safe-url-regexp mm-w3m-safe-url-regexp)
2504 (narrow-to-region (point) (point-max)) 2518 w3m-force-redisplay)
2505 (let ((w3m-safe-url-regexp mm-w3m-safe-url-regexp) 2519 (w3m-region (point-min) (point-max)))
2506 w3m-force-redisplay) 2520 (when (and mm-inline-text-html-with-w3m-keymap
2507 (w3m-region (point-min) (point-max))) 2521 (boundp 'w3m-minor-mode-map)
2508 (when (and mm-inline-text-html-with-w3m-keymap 2522 w3m-minor-mode-map)
2509 (boundp 'w3m-minor-mode-map) 2523 (add-text-properties
2510 w3m-minor-mode-map) 2524 (point-min) (point-max)
2511 (add-text-properties 2525 (list 'keymap w3m-minor-mode-map
2512 (point-min) (point-max) 2526 ;; Put the mark meaning this part was rendered by emacs-w3m.
2513 (list 'keymap w3m-minor-mode-map 2527 'mm-inline-text-html-with-w3m t))))
2514 ;; Put the mark meaning this part was rendered by emacs-w3m.
2515 'mm-inline-text-html-with-w3m t)))))
2516 2528
2517(defun article-hide-list-identifiers () 2529(defun article-hide-list-identifiers ()
2518 "Remove list identifies from the Subject header. 2530 "Remove list identifies from the Subject header.
@@ -4956,7 +4968,7 @@ If displaying \"text/html\" is discouraged \(see
4956 ,gnus-mouse-face-prop ,gnus-article-mouse-face 4968 ,gnus-mouse-face-prop ,gnus-article-mouse-face
4957 face ,gnus-article-button-face 4969 face ,gnus-article-button-face
4958 gnus-part ,id 4970 gnus-part ,id
4959 gnus-data ,handle)) 4971 article-type multipart))
4960 (widget-convert-button 'link from (point) 4972 (widget-convert-button 'link from (point)
4961 :action 'gnus-widget-press-button 4973 :action 'gnus-widget-press-button
4962 :button-keymap gnus-widget-button-keymap) 4974 :button-keymap gnus-widget-button-keymap)
diff --git a/lisp/gnus/gnus-cus.el b/lisp/gnus/gnus-cus.el
index df10c769315..df09fd43e48 100644
--- a/lisp/gnus/gnus-cus.el
+++ b/lisp/gnus/gnus-cus.el
@@ -235,8 +235,11 @@ See `gnus-emphasis-alist'.")
235 (const signature-file) 235 (const signature-file)
236 (const organization) 236 (const organization)
237 (const address) 237 (const address)
238 (const x-face-file)
238 (const name) 239 (const name)
239 (const body)) 240 (const body)
241 (symbol)
242 (string :tag "Header"))
240 (string :format "%v")))) 243 (string :format "%v"))))
241 "post style. 244 "post style.
242See `gnus-posting-styles'.")) 245See `gnus-posting-styles'."))
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 9a2516d2c03..4246dbe6d86 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -284,14 +284,15 @@ variable."
284 :type 'hook) 284 :type 'hook)
285 285
286(defcustom gnus-useful-groups 286(defcustom gnus-useful-groups
287 '(("(ding) mailing list mirrored at sunsite.auc.dk" 287 '(("(ding) mailing list mirrored at gmane.org"
288 "emacs.ding" 288 "gmane.emacs.gnus.general"
289 (nntp "sunsite.auc.dk" 289 (nntp "Gmane"
290 (nntp-address "sunsite.auc.dk"))) 290 (nntp-address "news.gmane.org")))
291 ("gnus-bug archive" 291 ("Gnus bug archive"
292 "gnus-bug" 292 "gnus.gnus-bug"
293 (nndir "/ftp@ftp.ifi.uio.no:/pub/emacs/gnus/gnus-bug/")) 293 (nntp "news.gnus.org"
294 ("Gnus help group" 294 (nntp-address "news.gnus.org")))
295 ("Local Gnus help group"
295 "gnus-help" 296 "gnus-help"
296 (nndoc "gnus-help" 297 (nndoc "gnus-help"
297 (nndoc-article-type mbox) 298 (nndoc-article-type mbox)
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index eced2a8097a..a1efede2a4d 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -844,6 +844,7 @@ header line with the old Message-ID."
844 (delete-region (point) (point-max)) 844 (delete-region (point) (point-max))
845 (insert yank-string)) 845 (insert yank-string))
846 (gnus-article-delete-text-of-type 'annotation) 846 (gnus-article-delete-text-of-type 'annotation)
847 (gnus-article-delete-text-of-type 'multipart)
847 (gnus-remove-text-with-property 'gnus-prev) 848 (gnus-remove-text-with-property 'gnus-prev)
848 (gnus-remove-text-with-property 'gnus-next) 849 (gnus-remove-text-with-property 'gnus-next)
849 (gnus-remove-text-with-property 'gnus-decoration) 850 (gnus-remove-text-with-property 'gnus-decoration)
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index 53bcc4be15f..a7ae3eb95fe 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -2818,6 +2818,7 @@ If FORCE is non-nil, the .newsrc file is read."
2818 (print-escape-nonascii t) 2818 (print-escape-nonascii t)
2819 (print-length nil) 2819 (print-length nil)
2820 (print-level nil) 2820 (print-level nil)
2821 (print-circle nil)
2821 (print-escape-newlines t) 2822 (print-escape-newlines t)
2822 (gnus-killed-list 2823 (gnus-killed-list
2823 (if (and gnus-save-killed-list 2824 (if (and gnus-save-killed-list
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 51f03061d4f..cd8d3c03d79 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -6114,7 +6114,7 @@ current article will be taken into consideration."
6114 (let ((max (max (point) (mark))) 6114 (let ((max (max (point) (mark)))
6115 articles article) 6115 articles article)
6116 (save-excursion 6116 (save-excursion
6117 (goto-char (min (min (point) (mark)))) 6117 (goto-char (min (point) (mark)))
6118 (while 6118 (while
6119 (and 6119 (and
6120 (push (setq article (gnus-summary-article-number)) articles) 6120 (push (setq article (gnus-summary-article-number)) articles)
diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el
index adef035c830..18a54d05d0d 100644
--- a/lisp/gnus/nnrss.el
+++ b/lisp/gnus/nnrss.el
@@ -87,9 +87,14 @@ ARTICLE is the article number of the current headline.")
87(defvar nnrss-compatible-encoding-alist '((iso-8859-1 . windows-1252)) 87(defvar nnrss-compatible-encoding-alist '((iso-8859-1 . windows-1252))
88 "Alist of encodings and those supersets. 88 "Alist of encodings and those supersets.
89The cdr of each element is used to decode data if it is available when 89The cdr of each element is used to decode data if it is available when
90the car is what the data specify as the encoding. Or, the car is used 90the car is what the data specify as the encoding. Or, the car is used
91for decoding when the cdr that the data specify is not available.") 91for decoding when the cdr that the data specify is not available.")
92 92
93(defvar nnrss-wash-html-in-text-plain-parts nil
94 "*Non-nil means render text in text/plain parts as HTML.
95The function specified by the `mm-text-html-renderer' variable will be
96used to render text. If it is nil, text will simply be folded.")
97
93(nnoo-define-basics nnrss) 98(nnoo-define-basics nnrss)
94 99
95;;; Interface functions 100;;; Interface functions
@@ -169,6 +174,10 @@ for decoding when the cdr that the data specify is not available.")
169(deffoo nnrss-close-group (group &optional server) 174(deffoo nnrss-close-group (group &optional server)
170 t) 175 t)
171 176
177(eval-when-compile
178 (defvar mm-text-html-renderer)
179 (defvar mm-text-html-washer-alist))
180
172(deffoo nnrss-request-article (article &optional group server buffer) 181(deffoo nnrss-request-article (article &optional group server buffer)
173 (setq group (nnrss-decode-group-name group)) 182 (setq group (nnrss-decode-group-name group))
174 (when (stringp article) 183 (when (stringp article)
@@ -191,10 +200,7 @@ for decoding when the cdr that the data specify is not available.")
191 (if (nth 5 e) 200 (if (nth 5 e)
192 (insert "Date: " (nnrss-format-string (nth 5 e)) "\n")) 201 (insert "Date: " (nnrss-format-string (nth 5 e)) "\n"))
193 (let ((header (buffer-string)) 202 (let ((header (buffer-string))
194 (text (if (nth 6 e) 203 (text (nth 6 e))
195 (mapconcat 'identity
196 (delete "" (split-string (nth 6 e) "\n+"))
197 " ")))
198 (link (nth 2 e)) 204 (link (nth 2 e))
199 (enclosure (nth 7 e)) 205 (enclosure (nth 7 e))
200 (comments (nth 8 e)) 206 (comments (nth 8 e))
@@ -205,14 +211,55 @@ for decoding when the cdr that the data specify is not available.")
205 (cons '("Newsgroups" . utf-8) 211 (cons '("Newsgroups" . utf-8)
206 rfc2047-header-encoding-alist) 212 rfc2047-header-encoding-alist)
207 rfc2047-header-encoding-alist)) 213 rfc2047-header-encoding-alist))
208 rfc2047-encode-encoded-words body) 214 rfc2047-encode-encoded-words body fn)
209 (when (or text link enclosure comments) 215 (when (or text link enclosure comments)
210 (insert "\n") 216 (insert "\n")
211 (insert "<#multipart type=alternative>\n" 217 (insert "<#multipart type=alternative>\n"
212 "<#part type=\"text/plain\">\n") 218 "<#part type=\"text/plain\">\n")
213 (setq body (point)) 219 (setq body (point))
214 (when text 220 (when text
215 (insert text "\n") 221 (insert text)
222 (goto-char body)
223 (if (and nnrss-wash-html-in-text-plain-parts
224 (progn
225 (require 'mm-view)
226 (setq fn (or (cdr (assq mm-text-html-renderer
227 mm-text-html-washer-alist))
228 mm-text-html-renderer))))
229 (progn
230 (narrow-to-region body (point-max))
231 (if (functionp fn)
232 (funcall fn)
233 (apply (car fn) (cdr fn)))
234 (widen)
235 (goto-char body)
236 (re-search-forward "[^\t\n ]" nil t)
237 (beginning-of-line)
238 (delete-region body (point))
239 (goto-char (point-max))
240 (skip-chars-backward "\t\n ")
241 (end-of-line)
242 (delete-region (point) (point-max))
243 (insert "\n"))
244 (while (re-search-forward "\n+" nil t)
245 (replace-match " "))
246 (goto-char body)
247 ;; See `nnrss-check-group', which inserts "<br /><br />".
248 (when (search-forward "<br /><br />" nil t)
249 (if (eobp)
250 (replace-match "\n")
251 (replace-match "\n\n")))
252 (unless (eobp)
253 (let ((fill-column default-fill-column)
254 (window (get-buffer-window nntp-server-buffer)))
255 (when window
256 (setq fill-column
257 (max 1 (/ (* (window-width window) 7) 8))))
258 (fill-region (point) (point-max))
259 (goto-char (point-max))
260 ;; XEmacs version of `fill-region' inserts newline.
261 (unless (bolp)
262 (insert "\n")))))
216 (when (or link enclosure) 263 (when (or link enclosure)
217 (insert "\n"))) 264 (insert "\n")))
218 (when link 265 (when link
@@ -362,7 +409,11 @@ otherwise return nil."
362 ;; FIXME: shouldn't binding `coding-system-for-read' be moved 409 ;; FIXME: shouldn't binding `coding-system-for-read' be moved
363 ;; to `mm-url-insert'? 410 ;; to `mm-url-insert'?
364 (let ((coding-system-for-read 'binary)) 411 (let ((coding-system-for-read 'binary))
365 (mm-url-insert url))) 412 (condition-case err
413 (mm-url-insert url)
414 (error (if (or debug-on-quit debug-on-error)
415 (signal (car err) (cdr err))
416 (message "nnrss: Failed to fetch %s" url))))))
366 (nnheader-remove-cr-followed-by-lf) 417 (nnheader-remove-cr-followed-by-lf)
367 ;; Decode text according to the encoding attribute. 418 ;; Decode text according to the encoding attribute.
368 (when (setq cs (nnrss-get-encoding)) 419 (when (setq cs (nnrss-get-encoding))
@@ -414,6 +465,74 @@ nnrss: %s: Not valid XML %s and w3-parse doesn't work %s"
414 (unless (assoc (car elem) nnrss-group-alist) 465 (unless (assoc (car elem) nnrss-group-alist)
415 (insert (prin1-to-string (car elem)) " 0 1 y\n"))))) 466 (insert (prin1-to-string (car elem)) " 0 1 y\n")))))
416 467
468(eval-and-compile (autoload 'timezone-parse-date "timezone"))
469
470(defun nnrss-normalize-date (date)
471 "Return a date string of DATE in the RFC822 style.
472This function handles the ISO 8601 date format described in
473<URL:http://www.w3.org/TR/NOTE-datetime>, and also the RFC822 style
474which RSS 2.0 allows."
475 (let (case-fold-search vector year month day time zone cts)
476 (cond ((null date))
477 ;; RFC822
478 ((string-match " [0-9]+ " date)
479 (setq vector (timezone-parse-date date)
480 year (string-to-number (aref vector 0)))
481 (when (>= year 1969)
482 (setq month (string-to-number (aref vector 1))
483 day (string-to-number (aref vector 2)))
484 (unless (>= (length (setq time (aref vector 3))) 3)
485 (setq time "00:00:00"))
486 (when (and (setq zone (aref vector 4))
487 (not (string-match "\\`[A-Z+-]" zone)))
488 (setq zone nil))))
489 ;; ISO 8601
490 ((string-match
491 (eval-when-compile
492 (concat
493 ;; 1. year
494 "\\(199[0-9]\\|20[0-9][0-9]\\)"
495 "\\(-"
496 ;; 3. month
497 "\\([01][0-9]\\)"
498 "\\(-"
499 ;; 5. day
500 "\\([0-3][0-9]\\)"
501 "\\)?\\)?\\(T"
502 ;; 7. hh:mm
503 "\\([012][0-9]:[0-5][0-9]\\)"
504 "\\("
505 ;; 9. :ss
506 "\\(:[0-5][0-9]\\)"
507 "\\(\\.[0-9]+\\)?\\)?\\)?"
508 ;; 13+14,15,16. zone
509 "\\(\\(\\([+-][012][0-9]\\):\\([0-5][0-9]\\)\\)"
510 "\\|\\([+-][012][0-9][0-5][0-9]\\)"
511 "\\|\\(Z\\)\\)?"))
512 date)
513 (setq year (string-to-number (match-string 1 date))
514 month (string-to-number (or (match-string 3 date) "1"))
515 day (string-to-number (or (match-string 5 date) "1"))
516 time (if (match-beginning 9)
517 (substring date (match-beginning 7) (match-end 9))
518 (concat (or (match-string 7 date) "00:00") ":00"))
519 zone (cond ((match-beginning 13)
520 (concat (match-string 13 date)
521 (match-string 14 date)))
522 ((match-beginning 16) ;; Z
523 "+0000")
524 (t ;; nil if zone is not provided.
525 (match-string 15 date))))))
526 (if month
527 (progn
528 (setq cts (current-time-string (encode-time 0 0 0 day month year)))
529 (format "%s, %02d %s %04d %s%s"
530 (substring cts 0 3) day (substring cts 4 7) year time
531 (if zone
532 (concat " " zone)
533 "")))
534 (message-make-date))))
535
417;;; data functions 536;;; data functions
418 537
419(defun nnrss-read-server-data (server) 538(defun nnrss-read-server-data (server)
@@ -497,7 +616,11 @@ nnrss: %s: Not valid XML %s and w3-parse doesn't work %s"
497 616
498(defun nnrss-insert-w3 (url) 617(defun nnrss-insert-w3 (url)
499 (mm-with-unibyte-current-buffer 618 (mm-with-unibyte-current-buffer
500 (mm-url-insert url))) 619 (condition-case err
620 (mm-url-insert url)
621 (error (if (or debug-on-quit debug-on-error)
622 (signal (car err) (cdr err))
623 (message "nnrss: Failed to fetch %s" url))))))
501 624
502(defun nnrss-decode-entities-string (string) 625(defun nnrss-decode-entities-string (string)
503 (if string 626 (if string
@@ -532,7 +655,7 @@ nnrss: %s: Not valid XML %s and w3-parse doesn't work %s"
532;;; Snarf functions 655;;; Snarf functions
533 656
534(defun nnrss-check-group (group server) 657(defun nnrss-check-group (group server)
535 (let (file xml subject url extra changed author date 658 (let (file xml subject url extra changed author date feed-subject
536 enclosure comments rss-ns rdf-ns content-ns dc-ns) 659 enclosure comments rss-ns rdf-ns content-ns dc-ns)
537 (if (and nnrss-use-local 660 (if (and nnrss-use-local
538 (file-exists-p (setq file (expand-file-name 661 (file-exists-p (setq file (expand-file-name
@@ -575,12 +698,14 @@ nnrss: %s: Not valid XML %s and w3-parse doesn't work %s"
575 (setq extra (or extra 698 (setq extra (or extra
576 (nnrss-node-text content-ns 'encoded item) 699 (nnrss-node-text content-ns 'encoded item)
577 (nnrss-node-text rss-ns 'description item))) 700 (nnrss-node-text rss-ns 'description item)))
701 (if (setq feed-subject (nnrss-node-text dc-ns 'subject item))
702 (setq extra (concat feed-subject "<br /><br />" extra)))
578 (setq author (or (nnrss-node-text rss-ns 'author item) 703 (setq author (or (nnrss-node-text rss-ns 'author item)
579 (nnrss-node-text dc-ns 'creator item) 704 (nnrss-node-text dc-ns 'creator item)
580 (nnrss-node-text dc-ns 'contributor item))) 705 (nnrss-node-text dc-ns 'contributor item)))
581 (setq date (or (nnrss-node-text dc-ns 'date item) 706 (setq date (nnrss-normalize-date
582 (nnrss-node-text rss-ns 'pubDate item) 707 (or (nnrss-node-text dc-ns 'date item)
583 (message-make-date))) 708 (nnrss-node-text rss-ns 'pubDate item))))
584 (setq comments (nnrss-node-text rss-ns 'comments item)) 709 (setq comments (nnrss-node-text rss-ns 'comments item))
585 (when (setq enclosure (cadr (assq (intern (concat rss-ns "enclosure")) item))) 710 (when (setq enclosure (cadr (assq (intern (concat rss-ns "enclosure")) item)))
586 (let ((url (cdr (assq 'url enclosure))) 711 (let ((url (cdr (assq 'url enclosure)))