diff options
| author | Eli Zaretskii | 2017-12-16 16:09:41 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2017-12-16 16:09:41 +0200 |
| commit | f274cbd185ddab4e414ccecf6c0b30e6fd3ef303 (patch) | |
| tree | 26a033bbc0fd9debd96ba2d72e11fd85bd477756 | |
| parent | 78908644131e70f20de28fed08ef4dc2878878a3 (diff) | |
| download | emacs-f274cbd185ddab4e414ccecf6c0b30e6fd3ef303.tar.gz emacs-f274cbd185ddab4e414ccecf6c0b30e6fd3ef303.zip | |
Avoid reordering of output in 'shr-insert-document'
* lisp/net/shr.el (shr-string-pixel-width): Preserve point across
shr-pixel-column invocations. (Bug#29734)
| -rw-r--r-- | lisp/net/shr.el | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 8a64f7549f2..c505f25a5a9 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -591,9 +591,14 @@ size, and full-buffer size." | |||
| 591 | (defun shr-string-pixel-width (string) | 591 | (defun shr-string-pixel-width (string) |
| 592 | (if (not shr-use-fonts) | 592 | (if (not shr-use-fonts) |
| 593 | (length string) | 593 | (length string) |
| 594 | (with-temp-buffer | 594 | ;; Save and restore point across with-temp-buffer, since |
| 595 | (insert string) | 595 | ;; shr-pixel-column uses save-window-excursion, which can reset |
| 596 | (shr-pixel-column)))) | 596 | ;; point to 1. |
| 597 | (let ((pt (point))) | ||
| 598 | (with-temp-buffer | ||
| 599 | (insert string) | ||
| 600 | (shr-pixel-column)) | ||
| 601 | (goto-char pt)))) | ||
| 597 | 602 | ||
| 598 | (defsubst shr--translate-insertion-chars () | 603 | (defsubst shr--translate-insertion-chars () |
| 599 | ;; Remove soft hyphens. | 604 | ;; Remove soft hyphens. |