Mercurial > emacs
changeset 111730:55d0f7023d7b
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.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Fri, 26 Nov 2010 07:35:42 +0000 |
parents | f5f8ce99f766 |
children | 8071f778f77e |
files | lisp/gnus/ChangeLog lisp/gnus/shr.el |
diffstat | 2 files changed, 55 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog Thu Nov 25 19:22:49 2010 -0800 +++ b/lisp/gnus/ChangeLog Fri Nov 26 07:35:42 2010 +0000 @@ -1,3 +1,9 @@ +2010-11-26 Katsumi Yamaoka <yamaoka@jpl.org> + + * shr.el (shr-insert): Revert last change. + (shr-find-fill-point): Never leave point being at bol; + relax the kinsoku limitation when rendering tables. + 2010-11-26 Lars Magne Ingebrigtsen <larsi@gnus.org> * nnmail.el (nnmail-expiry-target-group): Protect against degenerate
--- a/lisp/gnus/shr.el Thu Nov 25 19:22:49 2010 -0800 +++ b/lisp/gnus/shr.el Fri Nov 26 07:35:42 2010 +0000 @@ -254,7 +254,7 @@ (while (and (> (current-column) shr-width) (progn (setq found (shr-find-fill-point)) - (not (or (bolp) (eolp))))) + (not (eolp)))) (when (eq (preceding-char) ? ) (delete-char -1)) (insert "\n") @@ -278,7 +278,8 @@ (or (setq failed (= (current-column) shr-indentation)) (eq (preceding-char) ? ) (eq (following-char) ? ) - (aref fill-find-break-point-function-table (preceding-char)))) + (aref fill-find-break-point-function-table (preceding-char)) + (aref (char-category-set (preceding-char)) ?>))) (backward-char 1)) (if failed ;; There's no breakable point, so we give it up. @@ -287,30 +288,52 @@ (while (aref fill-find-break-point-function-table (preceding-char)) (backward-char 1)) nil) - (or (eolp) - ;; Don't put kinsoku-bol characters at the beginning of a line, - ;; or kinsoku-eol characters at the end of a line, - (let ((count 4)) - (if (or shr-kinsoku-shorten - (and (aref (char-category-set (preceding-char)) ?<) - (progn - (setq count (1- count)) - (backward-char 1) - t))) - (while (and - (>= (setq count (1- count)) 0) - (not (memq (preceding-char) (list ?\C-@ ?\n ? ))) - (or (aref (char-category-set (preceding-char)) ?<) - (aref (char-category-set (following-char)) ?>))) - (backward-char 1)) - (while (and (>= (setq count (1- count)) 0) - (aref (char-category-set (following-char)) ?>) - (aref fill-find-break-point-function-table - (following-char))) - (forward-char 1))) - (when (eq (following-char) ? ) - (forward-char 1)) - t))))) + (or + (eolp) + (progn + ;; Don't put kinsoku-bol characters at the beginning of a line, + ;; or kinsoku-eol characters at the end of a line. + (cond + (shr-kinsoku-shorten + (while (and + (not (memq (preceding-char) (list ?\C-@ ?\n ? ))) + (not (or (aref (char-category-set (preceding-char)) ?>) + (aref (char-category-set (following-char)) ?<))) + (or (aref (char-category-set (preceding-char)) ?<) + (aref (char-category-set (following-char)) ?>))) + (backward-char 1))) + ((aref (char-category-set (preceding-char)) ?<) + (let ((count 3)) + (while (progn + (backward-char 1) + (and + (> (setq count (1- count)) 0) + (not (memq (preceding-char) (list ?\C-@ ?\n ? ))) + (or (aref (char-category-set (preceding-char)) ?<) + (aref (char-category-set (following-char)) ?>)))))) + (if (and (setq failed (= (current-column) shr-indentation)) + (re-search-forward "\\c|" (line-end-position) 'move)) + ;; There's no breakable point that doesn't violate kinsoku, + ;; so we look for the second best position. + (let (bp) + (while (and (<= (current-column) shr-width) + (progn + (setq bp (point)) + (not (eolp))) + (aref fill-find-break-point-function-table + (following-char))) + (forward-char 1)) + (goto-char (or bp (line-end-position)))))) + (t + (let ((count 4)) + (while (and (>= (setq count (1- count)) 0) + (aref (char-category-set (following-char)) ?>) + (aref fill-find-break-point-function-table + (following-char))) + (forward-char 1))))) + (when (eq (following-char) ? ) + (forward-char 1)) + (not failed)))))) (defun shr-ensure-newline () (unless (zerop (current-column))