aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/gnus/ChangeLog17
-rw-r--r--lisp/gnus/mml.el3
-rw-r--r--lisp/gnus/nnheader.el7
-rw-r--r--lisp/gnus/nnimap.el3
-rw-r--r--lisp/gnus/pop3.el41
-rw-r--r--lisp/gnus/shr.el83
6 files changed, 96 insertions, 58 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 2cd76486bd7..c5aebafe35b 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,20 @@
12011-09-26 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * nnimap.el (nnimap-wait-for-response): Message less (bug#9540).
4
5 * nnheader.el (nnheader-message-maybe): New function.
6
7 * shr.el (shr-tag-table): Render totally broken tables better.
8
9 * mml.el (mml-generate-mime-1): Don't alter the contents if we're
10 computing the boundary.
11
122011-09-26 Lars Magne Ingebrigtsen <larsi@gnus.org>
13
14 * pop3.el (pop3-number-of-responses): Remove.
15 (pop3-wait-for-messages): Rewrite to take linear time instead of
16 exponential time.
17
12011-09-24 Lars Magne Ingebrigtsen <larsi@gnus.org> 182011-09-24 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 19
3 * gnus-sum.el (gnus-summary-show-article): Bind `shr-ignore-cache' to 20 * gnus-sum.el (gnus-summary-show-article): Bind `shr-ignore-cache' to
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index d9861394fa0..0d2ae2a845a 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -540,7 +540,8 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
540 (mml-to-mime) 540 (mml-to-mime)
541 ;; Update handle so mml-compute-boundary can 541 ;; Update handle so mml-compute-boundary can
542 ;; detect collisions with the nested parts. 542 ;; detect collisions with the nested parts.
543 (setcdr (assoc 'contents cont) (buffer-string))) 543 (unless mml-inhibit-compute-boundary
544 (setcdr (assoc 'contents cont) (buffer-string))))
544 (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b"))) 545 (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b")))
545 ;; ignore 0x1b, it is part of iso-2022-jp 546 ;; ignore 0x1b, it is part of iso-2022-jp
546 (setq encoding (mm-body-7-or-8)))) 547 (setq encoding (mm-body-7-or-8))))
diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el
index 6f871ccb9e8..a8e8e7d08ef 100644
--- a/lisp/gnus/nnheader.el
+++ b/lisp/gnus/nnheader.el
@@ -1112,6 +1112,13 @@ See `find-file-noselect' for the arguments."
1112 '(buffer-string))))) 1112 '(buffer-string)))))
1113 (insert-buffer-substring ,buffer ,start ,end)))) 1113 (insert-buffer-substring ,buffer ,start ,end))))
1114 1114
1115(defvar nnheader-last-message-time '(0 0))
1116(defun nnheader-message-maybe (&rest args)
1117 (let ((now (current-time)))
1118 (when (> (float-time (time-subtract now nnheader-last-message-time)) 1)
1119 (setq nnheader-last-message-time now)
1120 (apply 'nnheader-message args))))
1121
1115(when (featurep 'xemacs) 1122(when (featurep 'xemacs)
1116 (require 'nnheaderxm)) 1123 (require 'nnheaderxm))
1117 1124
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index f0d3e9f3182..49cceaacf92 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -1723,7 +1723,8 @@ textual parts.")
1723 (looking-at "\\*")))) 1723 (looking-at "\\*"))))
1724 (not (looking-at (format "%d .*\n" sequence))))) 1724 (not (looking-at (format "%d .*\n" sequence)))))
1725 (when messagep 1725 (when messagep
1726 (nnheader-message 7 "nnimap read %dk" (/ (buffer-size) 1000))) 1726 (nnheader-message-maybe
1727 7 "nnimap read %dk" (/ (buffer-size) 1000)))
1727 (nnheader-accept-process-output process) 1728 (nnheader-accept-process-output process)
1728 (goto-char (point-max))) 1729 (goto-char (point-max)))
1729 openp) 1730 openp)
diff --git a/lisp/gnus/pop3.el b/lisp/gnus/pop3.el
index 8fd5382a181..ee3e6582e80 100644
--- a/lisp/gnus/pop3.el
+++ b/lisp/gnus/pop3.el
@@ -167,17 +167,30 @@ Use streaming commands."
167 167
168(defun pop3-send-streaming-command (process command count total-size) 168(defun pop3-send-streaming-command (process command count total-size)
169 (erase-buffer) 169 (erase-buffer)
170 (let ((i 1)) 170 (let ((i 1)
171 (start-point (point-min))
172 (waited-for 0))
171 (while (>= count i) 173 (while (>= count i)
172 (process-send-string process (format "%s %d\r\n" command i)) 174 (process-send-string process (format "%s %d\r\n" command i))
173 ;; Only do 100 messages at a time to avoid pipe stalls. 175 ;; Only do 100 messages at a time to avoid pipe stalls.
174 (when (zerop (% i pop3-stream-length)) 176 (when (zerop (% i pop3-stream-length))
175 (pop3-wait-for-messages process i total-size)) 177 (setq start-point
176 (incf i))) 178 (pop3-wait-for-messages process pop3-stream-length
177 (pop3-wait-for-messages process count total-size)) 179 total-size start-point))
178 180 (incf waited-for pop3-stream-length))
179(defun pop3-wait-for-messages (process count total-size) 181 (incf i))
180 (while (< (pop3-number-of-responses total-size) count) 182 (pop3-wait-for-messages process (- count waited-for)
183 total-size start-point)))
184
185(defun pop3-wait-for-messages (process count total-size start-point)
186 (while (> count 0)
187 (goto-char start-point)
188 (while (or (and (re-search-forward "^\\+OK" nil t)
189 (or (not total-size)
190 (re-search-forward "^\\.\r?\n" nil t)))
191 (re-search-forward "^-ERR " nil t))
192 (decf count)
193 (setq start-point (point)))
181 (unless (memq (process-status process) '(open run)) 194 (unless (memq (process-status process) '(open run))
182 (error "pop3 process died")) 195 (error "pop3 process died"))
183 (when total-size 196 (when total-size
@@ -185,7 +198,8 @@ Use streaming commands."
185 (truncate (/ (buffer-size) 1000)) 198 (truncate (/ (buffer-size) 1000))
186 (truncate (* (/ (* (buffer-size) 1.0) 199 (truncate (* (/ (* (buffer-size) 1.0)
187 total-size) 100)))) 200 total-size) 100))))
188 (pop3-accept-process-output process))) 201 (pop3-accept-process-output process))
202 start-point)
189 203
190(defun pop3-write-to-file (file) 204(defun pop3-write-to-file (file)
191 (let ((pop-buffer (current-buffer)) 205 (let ((pop-buffer (current-buffer))
@@ -219,17 +233,6 @@ Use streaming commands."
219 (delete-char 1)) 233 (delete-char 1))
220 (write-region (point-min) (point-max) file nil 'nomesg))))) 234 (write-region (point-min) (point-max) file nil 'nomesg)))))
221 235
222(defun pop3-number-of-responses (endp)
223 (let ((responses 0))
224 (save-excursion
225 (goto-char (point-min))
226 (while (or (and (re-search-forward "^\\+OK" nil t)
227 (or (not endp)
228 (re-search-forward "^\\.\r?\n" nil t)))
229 (re-search-forward "^-ERR " nil t))
230 (incf responses)))
231 responses))
232
233(defun pop3-logon (process) 236(defun pop3-logon (process)
234 (let ((pop3-password pop3-password)) 237 (let ((pop3-password pop3-password))
235 ;; for debugging only 238 ;; for debugging only
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index fc2f5777fb7..f49bbd69da3 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -1055,44 +1055,53 @@ ones, in case fg and bg are nil."
1055 (nheader (if header (shr-max-columns header))) 1055 (nheader (if header (shr-max-columns header)))
1056 (nbody (if body (shr-max-columns body))) 1056 (nbody (if body (shr-max-columns body)))
1057 (nfooter (if footer (shr-max-columns footer)))) 1057 (nfooter (if footer (shr-max-columns footer))))
1058 (shr-tag-table-1 1058 (if (and (not caption)
1059 (nconc 1059 (not header)
1060 (if caption `((tr (td ,@caption)))) 1060 (not (cdr (assq 'tbody cont)))
1061 (if header 1061 (not (cdr (assq 'tr cont)))
1062 (if footer 1062 (not footer))
1063 ;; hader + body + footer 1063 ;; The table is totally invalid and just contains random junk.
1064 ;; Try to output it anyway.
1065 (shr-generic cont)
1066 ;; It's a real table, so render it.
1067 (shr-tag-table-1
1068 (nconc
1069 (if caption `((tr (td ,@caption))))
1070 (if header
1071 (if footer
1072 ;; hader + body + footer
1073 (if (= nheader nbody)
1074 (if (= nbody nfooter)
1075 `((tr (td (table (tbody ,@header ,@body ,@footer)))))
1076 (nconc `((tr (td (table (tbody ,@header ,@body)))))
1077 (if (= nfooter 1)
1078 footer
1079 `((tr (td (table (tbody ,@footer))))))))
1080 (nconc `((tr (td (table (tbody ,@header)))))
1081 (if (= nbody nfooter)
1082 `((tr (td (table (tbody ,@body ,@footer)))))
1083 (nconc `((tr (td (table (tbody ,@body)))))
1084 (if (= nfooter 1)
1085 footer
1086 `((tr (td (table (tbody ,@footer))))))))))
1087 ;; header + body
1064 (if (= nheader nbody) 1088 (if (= nheader nbody)
1065 (if (= nbody nfooter) 1089 `((tr (td (table (tbody ,@header ,@body)))))
1066 `((tr (td (table (tbody ,@header ,@body ,@footer))))) 1090 (if (= nheader 1)
1067 (nconc `((tr (td (table (tbody ,@header ,@body))))) 1091 `(,@header (tr (td (table (tbody ,@body)))))
1068 (if (= nfooter 1) 1092 `((tr (td (table (tbody ,@header))))
1069 footer 1093 (tr (td (table (tbody ,@body))))))))
1070 `((tr (td (table (tbody ,@footer)))))))) 1094 (if footer
1071 (nconc `((tr (td (table (tbody ,@header))))) 1095 ;; body + footer
1072 (if (= nbody nfooter) 1096 (if (= nbody nfooter)
1073 `((tr (td (table (tbody ,@body ,@footer))))) 1097 `((tr (td (table (tbody ,@body ,@footer)))))
1074 (nconc `((tr (td (table (tbody ,@body))))) 1098 (nconc `((tr (td (table (tbody ,@body)))))
1075 (if (= nfooter 1) 1099 (if (= nfooter 1)
1076 footer 1100 footer
1077 `((tr (td (table (tbody ,@footer)))))))))) 1101 `((tr (td (table (tbody ,@footer))))))))
1078 ;; header + body 1102 (if caption
1079 (if (= nheader nbody) 1103 `((tr (td (table (tbody ,@body)))))
1080 `((tr (td (table (tbody ,@header ,@body))))) 1104 body))))))
1081 (if (= nheader 1)
1082 `(,@header (tr (td (table (tbody ,@body)))))
1083 `((tr (td (table (tbody ,@header))))
1084 (tr (td (table (tbody ,@body))))))))
1085 (if footer
1086 ;; body + footer
1087 (if (= nbody nfooter)
1088 `((tr (td (table (tbody ,@body ,@footer)))))
1089 (nconc `((tr (td (table (tbody ,@body)))))
1090 (if (= nfooter 1)
1091 footer
1092 `((tr (td (table (tbody ,@footer))))))))
1093 (if caption
1094 `((tr (td (table (tbody ,@body)))))
1095 body)))))
1096 (when bgcolor 1105 (when bgcolor
1097 (shr-colorize-region start (point) (cdr (assq 'color shr-stylesheet)) 1106 (shr-colorize-region start (point) (cdr (assq 'color shr-stylesheet))
1098 bgcolor)))) 1107 bgcolor))))