bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29734: 27.0.50; shr-insert-document modify point of buffer in corner


From: Eli Zaretskii
Subject: bug#29734: 27.0.50; shr-insert-document modify point of buffer in corner case
Date: Sat, 16 Dec 2017 16:12:26 +0200

> From: OGAWA Hirofumi <address@hidden>
> Date: Sat, 16 Dec 2017 21:47:07 +0900
> 
> (let ((buf (get-buffer-create "test-case")))
>   (display-buffer buf)
>   (with-current-buffer buf
>     (erase-buffer)
>     (insert "1\n")
>     (shr-insert-document
>      '(html nil (body nil (a ((href . "http://example.org";)) "example"))))
>     (insert "\n")
>     (insert "2\n")))
> 
> and expected result is
> 
>       1
>       example
>       2
> 
> But actual result is
> 
>       example
>       2
>       1
> 
> Like above example, `shr-insert-document' modify the point
> of "test-case" buffer. (display-buffer is important to
> reproduce. If commented out display-buffer line, the issue
> disappear.)
> 
> With some debugging I noticed, the usage of `with-temp-buffer' of
> `shr-string-pixel-width' modify the point. Simplified version of
> `shr-string-pixel-width' to reproduce the issue is the following,
> 
>     (with-temp-buffer
>       (save-window-excursion
>       (set-window-buffer nil (current-buffer))))
> 
> In this conbination, `with-temp-buffer' seems to fail to restore
> the point.
> 
> So the patch seems to save and restore the point correctly.

Thanks.

I think save-excursion is too heavy in this case, so I installed a
change to only preserve point.

Please try the recent emacs-26 branch, it should now be fixed there.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]