From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: The issue with with-temp-buffer (or with-current-buffer) Date: Fri, 15 Dec 2017 22:51:29 +0200 Message-ID: <83shcbsoj2.fsf@gnu.org> References: <87d13f97bd.fsf@mail.parknet.co.jp> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1513371134 29504 195.159.176.226 (15 Dec 2017 20:52:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 15 Dec 2017 20:52:14 +0000 (UTC) Cc: emacs-devel@gnu.org To: OGAWA Hirofumi Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 15 21:52:11 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePwxk-0007Hb-Re for ged-emacs-devel@m.gmane.org; Fri, 15 Dec 2017 21:52:08 +0100 Original-Received: from localhost ([::1]:48462 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePwxr-0004KK-Pv for ged-emacs-devel@m.gmane.org; Fri, 15 Dec 2017 15:52:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePwxB-0004KE-EI for emacs-devel@gnu.org; Fri, 15 Dec 2017 15:51:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePwx8-0006RQ-Bt for emacs-devel@gnu.org; Fri, 15 Dec 2017 15:51:33 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:46974) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePwx8-0006RB-8O; Fri, 15 Dec 2017 15:51:30 -0500 Original-Received: from [176.228.60.248] (port=1619 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ePwx7-0005IT-Gp; Fri, 15 Dec 2017 15:51:30 -0500 In-reply-to: <87d13f97bd.fsf@mail.parknet.co.jp> (message from OGAWA Hirofumi on Sat, 16 Dec 2017 03:25:58 +0900) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221113 Archived-At: > From: OGAWA Hirofumi > Date: Sat, 16 Dec 2017 03:25:58 +0900 > > and expected result is > > ---- test-case ---- > 2 > 1 > ------------------- > > But actual result is > > ---- test-case ---- > 1 > 2 > ------------------- > > [The actual issue that I'm hitted was using `shr-insert-document' > like following. And above is simplied version to reproduce the issue. > > (with-current-buffer buf > (erase-buffer) > (insert ...) > (shr-insert-document '(html nil (body nil ...))) > (insert ...))) > ] > > After some debugging, I noticed `with-current-buffer' that is > used in `with-temp-buffer' doesn't restore `point'. Please try the latest shr.el from the emacs-26 branch, I think you will find that this problem is solved there. > Well so, this behavior (doesn't restore point) of > `with-temp-buffer' (or `with-current-buffer') is intented or bug? It's intended. > And to fix this issue, we should change which one of > with-temp-buffer, with-current-buffer, shr-insert-document, or > user of shr-insert-document? I think shr.el was already fixed.