comparison lisp/gnus/nnrss.el @ 111068:f72fefc68ae4

nnrss.el (nnrss-wash-html-in-text-plain-parts): Remove. nnrss.el (nnrss-request-article): Don't use special html washing code.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Thu, 21 Oct 2010 00:27:32 +0000
parents e36c65ac23bf
children 417b1e4d63cd
comparison
equal deleted inserted replaced
111067:e36c65ac23bf 111068:f72fefc68ae4
111 mm-charset-override-alist)) 111 mm-charset-override-alist))
112 "Alist of encodings and those supersets. 112 "Alist of encodings and those supersets.
113 The cdr of each element is used to decode data if it is available when 113 The cdr of each element is used to decode data if it is available when
114 the car is what the data specify as the encoding. Or, the car is used 114 the car is what the data specify as the encoding. Or, the car is used
115 for decoding when the cdr that the data specify is not available.") 115 for decoding when the cdr that the data specify is not available.")
116
117 (defvar nnrss-wash-html-in-text-plain-parts nil
118 "*Non-nil means render text in text/plain parts as HTML.
119 The function specified by the `mm-text-html-renderer' variable will be
120 used to render text. If it is nil, text will simply be folded.")
121 116
122 (nnoo-define-basics nnrss) 117 (nnoo-define-basics nnrss)
123 118
124 ;;; Interface functions 119 ;;; Interface functions
125 120
195 (nnheader-message 6 "nnrss: Requesting %s...done" group))) 190 (nnheader-message 6 "nnrss: Requesting %s...done" group)))
196 191
197 (deffoo nnrss-close-group (group &optional server) 192 (deffoo nnrss-close-group (group &optional server)
198 t) 193 t)
199 194
200 (defvar mm-text-html-renderer)
201
202 (deffoo nnrss-request-article (article &optional group server buffer) 195 (deffoo nnrss-request-article (article &optional group server buffer)
203 (setq group (nnrss-decode-group-name group)) 196 (setq group (nnrss-decode-group-name group))
204 (when (stringp article) 197 (when (stringp article)
205 (setq article (if (string-match "\\`<\\([0-9]+\\)@" article) 198 (setq article (if (string-match "\\`<\\([0-9]+\\)@" article)
206 (string-to-number (match-string 1 article)) 199 (string-to-number (match-string 1 article))
237 "<#part type=\"text/plain\">\n") 230 "<#part type=\"text/plain\">\n")
238 (setq body (point)) 231 (setq body (point))
239 (when text 232 (when text
240 (insert text) 233 (insert text)
241 (goto-char body) 234 (goto-char body)
242 (if (and nnrss-wash-html-in-text-plain-parts 235 (while (re-search-forward "\n+" nil t)
243 (progn 236 (replace-match " "))
244 (require 'mm-view) 237 (goto-char body)
245 (setq fn (or (cdr (assq mm-text-html-renderer 238 ;; See `nnrss-check-group', which inserts "<br /><br />".
246 mm-text-html-washer-alist)) 239 (when (search-forward "<br /><br />" nil t)
247 mm-text-html-renderer)))) 240 (if (eobp)
248 (progn 241 (replace-match "\n")
249 (narrow-to-region body (point-max)) 242 (replace-match "\n\n")))
250 (if (functionp fn) 243 (unless (eobp)
251 (funcall fn) 244 (let ((fill-column (default-value 'fill-column))
252 (apply (car fn) (cdr fn))) 245 (window (get-buffer-window nntp-server-buffer)))
253 (widen) 246 (when window
254 (goto-char body) 247 (setq fill-column
255 (re-search-forward "[^\t\n ]" nil t) 248 (max 1 (/ (* (window-width window) 7) 8))))
256 (beginning-of-line) 249 (fill-region (point) (point-max))
257 (delete-region body (point)) 250 (goto-char (point-max))
258 (goto-char (point-max)) 251 ;; XEmacs version of `fill-region' inserts newline.
259 (skip-chars-backward "\t\n ") 252 (unless (bolp)
260 (end-of-line) 253 (insert "\n"))))
261 (delete-region (point) (point-max))
262 (insert "\n"))
263 (while (re-search-forward "\n+" nil t)
264 (replace-match " "))
265 (goto-char body)
266 ;; See `nnrss-check-group', which inserts "<br /><br />".
267 (when (search-forward "<br /><br />" nil t)
268 (if (eobp)
269 (replace-match "\n")
270 (replace-match "\n\n")))
271 (unless (eobp)
272 (let ((fill-column (default-value 'fill-column))
273 (window (get-buffer-window nntp-server-buffer)))
274 (when window
275 (setq fill-column
276 (max 1 (/ (* (window-width window) 7) 8))))
277 (fill-region (point) (point-max))
278 (goto-char (point-max))
279 ;; XEmacs version of `fill-region' inserts newline.
280 (unless (bolp)
281 (insert "\n")))))
282 (when (or link enclosure) 254 (when (or link enclosure)
283 (insert "\n"))) 255 (insert "\n")))
284 (when link 256 (when link
285 (insert link "\n")) 257 (insert link "\n"))
286 (when enclosure 258 (when enclosure