all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: 29734@debbugs.gnu.org
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	[thread overview]
Message-ID: <83h8sqsqwl.fsf@gnu.org> (raw)
In-Reply-To: <87shca7sc4.fsf@mail.parknet.co.jp> (message from OGAWA Hirofumi on Sat, 16 Dec 2017 21:47:07 +0900)

> From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
> 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	other threads:[~2017-12-16 14:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-16 12:47 bug#29734: 27.0.50; shr-insert-document modify point of buffer in corner case OGAWA Hirofumi
2017-12-16 14:12 ` Eli Zaretskii [this message]
2017-12-16 16:59   ` OGAWA Hirofumi
2017-12-16 17:18     ` Eli Zaretskii
2017-12-18  2:53       ` Katsumi Yamaoka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83h8sqsqwl.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=29734@debbugs.gnu.org \
    --cc=hirofumi@mail.parknet.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.