aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKatsumi Yamaoka2010-11-26 07:35:42 +0000
committerKatsumi Yamaoka2010-11-26 07:35:42 +0000
commitb40950bfce6aeaf2fb6e66c9d3859f4e321fa074 (patch)
treeb262afd130430874e74a7e3677dfe009ea4260a6
parent1e8aa221d57ec9f0ee92701b510d130fb5b2ce43 (diff)
downloademacs-b40950bfce6aeaf2fb6e66c9d3859f4e321fa074.tar.gz
emacs-b40950bfce6aeaf2fb6e66c9d3859f4e321fa074.zip
shr.el (shr-insert): Revert last change.
shr.el (shr-find-fill-point): Never leave point being at bol; relax the kinsoku limitation when rendering tables.
-rw-r--r--lisp/gnus/ChangeLog6
-rw-r--r--lisp/gnus/shr.el75
2 files changed, 55 insertions, 26 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 2a4b97bd8d2..01e9d74a581 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,9 @@
12010-11-26 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * shr.el (shr-insert): Revert last change.
4 (shr-find-fill-point): Never leave point being at bol;
5 relax the kinsoku limitation when rendering tables.
6
12010-11-26 Lars Magne Ingebrigtsen <larsi@gnus.org> 72010-11-26 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 8
3 * nnmail.el (nnmail-expiry-target-group): Protect against degenerate 9 * nnmail.el (nnmail-expiry-target-group): Protect against degenerate
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index 1746c9aee4b..69973fbfb50 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -254,7 +254,7 @@ redirects somewhere else."
254 (while (and (> (current-column) shr-width) 254 (while (and (> (current-column) shr-width)
255 (progn 255 (progn
256 (setq found (shr-find-fill-point)) 256 (setq found (shr-find-fill-point))
257 (not (or (bolp) (eolp))))) 257 (not (eolp))))
258 (when (eq (preceding-char) ? ) 258 (when (eq (preceding-char) ? )
259 (delete-char -1)) 259 (delete-char -1))
260 (insert "\n") 260 (insert "\n")
@@ -278,7 +278,8 @@ redirects somewhere else."
278 (or (setq failed (= (current-column) shr-indentation)) 278 (or (setq failed (= (current-column) shr-indentation))
279 (eq (preceding-char) ? ) 279 (eq (preceding-char) ? )
280 (eq (following-char) ? ) 280 (eq (following-char) ? )
281 (aref fill-find-break-point-function-table (preceding-char)))) 281 (aref fill-find-break-point-function-table (preceding-char))
282 (aref (char-category-set (preceding-char)) ?>)))
282 (backward-char 1)) 283 (backward-char 1))
283 (if failed 284 (if failed
284 ;; There's no breakable point, so we give it up. 285 ;; There's no breakable point, so we give it up.
@@ -287,30 +288,52 @@ redirects somewhere else."
287 (while (aref fill-find-break-point-function-table (preceding-char)) 288 (while (aref fill-find-break-point-function-table (preceding-char))
288 (backward-char 1)) 289 (backward-char 1))
289 nil) 290 nil)
290 (or (eolp) 291 (or
291 ;; Don't put kinsoku-bol characters at the beginning of a line, 292 (eolp)
292 ;; or kinsoku-eol characters at the end of a line, 293 (progn
293 (let ((count 4)) 294 ;; Don't put kinsoku-bol characters at the beginning of a line,
294 (if (or shr-kinsoku-shorten 295 ;; or kinsoku-eol characters at the end of a line.
295 (and (aref (char-category-set (preceding-char)) ?<) 296 (cond
296 (progn 297 (shr-kinsoku-shorten
297 (setq count (1- count)) 298 (while (and
298 (backward-char 1) 299 (not (memq (preceding-char) (list ?\C-@ ?\n ? )))
299 t))) 300 (not (or (aref (char-category-set (preceding-char)) ?>)
300 (while (and 301 (aref (char-category-set (following-char)) ?<)))
301 (>= (setq count (1- count)) 0) 302 (or (aref (char-category-set (preceding-char)) ?<)
302 (not (memq (preceding-char) (list ?\C-@ ?\n ? ))) 303 (aref (char-category-set (following-char)) ?>)))
303 (or (aref (char-category-set (preceding-char)) ?<) 304 (backward-char 1)))
304 (aref (char-category-set (following-char)) ?>))) 305 ((aref (char-category-set (preceding-char)) ?<)
305 (backward-char 1)) 306 (let ((count 3))
306 (while (and (>= (setq count (1- count)) 0) 307 (while (progn
307 (aref (char-category-set (following-char)) ?>) 308 (backward-char 1)
308 (aref fill-find-break-point-function-table 309 (and
309 (following-char))) 310 (> (setq count (1- count)) 0)
310 (forward-char 1))) 311 (not (memq (preceding-char) (list ?\C-@ ?\n ? )))
311 (when (eq (following-char) ? ) 312 (or (aref (char-category-set (preceding-char)) ?<)
312 (forward-char 1)) 313 (aref (char-category-set (following-char)) ?>))))))
313 t))))) 314 (if (and (setq failed (= (current-column) shr-indentation))
315 (re-search-forward "\\c|" (line-end-position) 'move))
316 ;; There's no breakable point that doesn't violate kinsoku,
317 ;; so we look for the second best position.
318 (let (bp)
319 (while (and (<= (current-column) shr-width)
320 (progn
321 (setq bp (point))
322 (not (eolp)))
323 (aref fill-find-break-point-function-table
324 (following-char)))
325 (forward-char 1))
326 (goto-char (or bp (line-end-position))))))
327 (t
328 (let ((count 4))
329 (while (and (>= (setq count (1- count)) 0)
330 (aref (char-category-set (following-char)) ?>)
331 (aref fill-find-break-point-function-table
332 (following-char)))
333 (forward-char 1)))))
334 (when (eq (following-char) ? )
335 (forward-char 1))
336 (not failed))))))
314 337
315(defun shr-ensure-newline () 338(defun shr-ensure-newline ()
316 (unless (zerop (current-column)) 339 (unless (zerop (current-column))