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)
This commit is contained in:
Eli Zaretskii 2017-12-16 16:09:41 +02:00
parent 7890864413
commit f274cbd185

View file

@ -591,9 +591,14 @@ size, and full-buffer size."
(defun shr-string-pixel-width (string) (defun shr-string-pixel-width (string)
(if (not shr-use-fonts) (if (not shr-use-fonts)
(length string) (length string)
;; Save and restore point across with-temp-buffer, since
;; shr-pixel-column uses save-window-excursion, which can reset
;; point to 1.
(let ((pt (point)))
(with-temp-buffer (with-temp-buffer
(insert string) (insert string)
(shr-pixel-column)))) (shr-pixel-column))
(goto-char pt))))
(defsubst shr--translate-insertion-chars () (defsubst shr--translate-insertion-chars ()
;; Remove soft hyphens. ;; Remove soft hyphens.