diff options
| author | Lars Ingebrigtsen | 2013-12-27 03:21:42 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2013-12-27 03:21:42 +0100 |
| commit | ac5758d16288422dc7c91f152db612deb44ff3a7 (patch) | |
| tree | 30c31902363040454726e4fc7da305852da16031 | |
| parent | d96b72a59d42b641ff09782a76e5687ec2c47d12 (diff) | |
| download | emacs-ac5758d16288422dc7c91f152db612deb44ff3a7.tar.gz emacs-ac5758d16288422dc7c91f152db612deb44ff3a7.zip | |
shr didn't fill Japanese text correctly any more
* net/shr.el (shr-find-fill-point): Don't try to fill if the
indentation level is larger than the width, because that will
infloop.
(shr-insert): Fill repeatedly long texts, so that Japanese is
formatted correctly.
Fixes: debbugs:16263
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/net/shr.el | 17 |
2 files changed, 17 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2831988efd9..c764f973389 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2013-12-27 Lars Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * net/shr.el (shr-find-fill-point): Don't try to fill if the | ||
| 4 | indentation level is larger than the width, because that will | ||
| 5 | infloop. | ||
| 6 | (shr-insert): Fill repeatedly long texts, so that Japanese is | ||
| 7 | formatted correctly (bug#16263). | ||
| 8 | |||
| 1 | 2013-12-26 João Távora <joaotavora@gmail.com> | 9 | 2013-12-26 João Távora <joaotavora@gmail.com> |
| 2 | 10 | ||
| 3 | * electric.el (electric-pair-mode): More flexible engine for skip- | 11 | * electric.el (electric-pair-mode): More flexible engine for skip- |
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 93e2be0086a..a4cfdfeb0c1 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -455,10 +455,10 @@ size, and full-buffer size." | |||
| 455 | (insert elem) | 455 | (insert elem) |
| 456 | (setq shr-state nil) | 456 | (setq shr-state nil) |
| 457 | (let (found) | 457 | (let (found) |
| 458 | (when (and (> (current-column) shr-width) | 458 | (while (and (> (current-column) shr-width) |
| 459 | (progn | 459 | (progn |
| 460 | (setq found (shr-find-fill-point)) | 460 | (setq found (shr-find-fill-point)) |
| 461 | (not (eolp)))) | 461 | (not (eolp)))) |
| 462 | (when (eq (preceding-char) ? ) | 462 | (when (eq (preceding-char) ? ) |
| 463 | (delete-char -1)) | 463 | (delete-char -1)) |
| 464 | (insert "\n") | 464 | (insert "\n") |
| @@ -478,7 +478,7 @@ size, and full-buffer size." | |||
| 478 | (backward-char 1)) | 478 | (backward-char 1)) |
| 479 | (let ((bp (point)) | 479 | (let ((bp (point)) |
| 480 | failed) | 480 | failed) |
| 481 | (while (not (or (setq failed (= (current-column) shr-indentation)) | 481 | (while (not (or (setq failed (< (current-column) shr-indentation)) |
| 482 | (eq (preceding-char) ? ) | 482 | (eq (preceding-char) ? ) |
| 483 | (eq (following-char) ? ) | 483 | (eq (following-char) ? ) |
| 484 | (shr-char-breakable-p (preceding-char)) | 484 | (shr-char-breakable-p (preceding-char)) |
| @@ -496,7 +496,8 @@ size, and full-buffer size." | |||
| 496 | (while (setq found (re-search-forward | 496 | (while (setq found (re-search-forward |
| 497 | "\\(\\c>\\)\\| \\|\\c<\\|\\c|" | 497 | "\\(\\c>\\)\\| \\|\\c<\\|\\c|" |
| 498 | (line-end-position) 'move))) | 498 | (line-end-position) 'move))) |
| 499 | (if (and found (not (match-beginning 1))) | 499 | (if (and found |
| 500 | (not (match-beginning 1))) | ||
| 500 | (goto-char (match-beginning 0))))) | 501 | (goto-char (match-beginning 0))))) |
| 501 | (or | 502 | (or |
| 502 | (eolp) | 503 | (eolp) |
| @@ -507,7 +508,7 @@ size, and full-buffer size." | |||
| 507 | (while (and (not (memq (preceding-char) (list ?\C-@ ?\n ? ))) | 508 | (while (and (not (memq (preceding-char) (list ?\C-@ ?\n ? ))) |
| 508 | (shr-char-kinsoku-eol-p (preceding-char))) | 509 | (shr-char-kinsoku-eol-p (preceding-char))) |
| 509 | (backward-char 1)) | 510 | (backward-char 1)) |
| 510 | (when (setq failed (= (current-column) shr-indentation)) | 511 | (when (setq failed (< (current-column) shr-indentation)) |
| 511 | ;; There's no breakable point that doesn't violate kinsoku, | 512 | ;; There's no breakable point that doesn't violate kinsoku, |
| 512 | ;; so we look for the second best position. | 513 | ;; so we look for the second best position. |
| 513 | (while (and (progn | 514 | (while (and (progn |
| @@ -527,7 +528,7 @@ size, and full-buffer size." | |||
| 527 | (not (memq (preceding-char) (list ?\C-@ ?\n ? ))) | 528 | (not (memq (preceding-char) (list ?\C-@ ?\n ? ))) |
| 528 | (or (shr-char-kinsoku-eol-p (preceding-char)) | 529 | (or (shr-char-kinsoku-eol-p (preceding-char)) |
| 529 | (shr-char-kinsoku-bol-p (following-char))))))) | 530 | (shr-char-kinsoku-bol-p (following-char))))))) |
| 530 | (when (setq failed (= (current-column) shr-indentation)) | 531 | (when (setq failed (< (current-column) shr-indentation)) |
| 531 | ;; There's no breakable point that doesn't violate kinsoku, | 532 | ;; There's no breakable point that doesn't violate kinsoku, |
| 532 | ;; so we go to the second best position. | 533 | ;; so we go to the second best position. |
| 533 | (if (looking-at "\\(\\c<+\\)\\c<") | 534 | (if (looking-at "\\(\\c<+\\)\\c<") |