From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: OGAWA Hirofumi Newsgroups: gmane.emacs.devel Subject: Re: The issue with with-temp-buffer (or with-current-buffer) Date: Sat, 16 Dec 2017 07:40:37 +0900 Message-ID: <87zi6j7gyi.fsf@mail.parknet.co.jp> References: <87d13f97bd.fsf@mail.parknet.co.jp> <83shcbsoj2.fsf@gnu.org> <874lor8y0p.fsf@mail.parknet.co.jp> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1513377684 26319 195.159.176.226 (15 Dec 2017 22:41:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 15 Dec 2017 22:41:24 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 15 23:41:16 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 1ePyfL-0006DZ-NV for ged-emacs-devel@m.gmane.org; Fri, 15 Dec 2017 23:41:15 +0100 Original-Received: from localhost ([::1]:48708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePyfS-0008OJ-SK for ged-emacs-devel@m.gmane.org; Fri, 15 Dec 2017 17:41:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePyeu-0008OD-1V for emacs-devel@gnu.org; Fri, 15 Dec 2017 17:40:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePyet-0005OL-4A for emacs-devel@gnu.org; Fri, 15 Dec 2017 17:40:48 -0500 Original-Received: from mail.parknet.co.jp ([210.171.160.6]:52529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePyeo-0005DD-Ck; Fri, 15 Dec 2017 17:40:42 -0500 Original-Received: from ibmpc.myhome.or.jp (server.parknet.ne.jp [210.171.168.39]) by mail.parknet.co.jp (Postfix) with ESMTP id 2049A170001; Sat, 16 Dec 2017 07:40:40 +0900 (JST) Original-Received: from devron.myhome.or.jp (root@devron.myhome.or.jp [192.168.0.3]) by ibmpc.myhome.or.jp (8.15.2/8.15.2/Debian-9) with ESMTPS id vBFMecO5002205 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 16 Dec 2017 07:40:39 +0900 Original-Received: from devron.myhome.or.jp (hirofumi@localhost [127.0.0.1]) by devron.myhome.or.jp (8.15.2/8.15.2/Debian-9) with ESMTPS id vBFMecrY008998 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 16 Dec 2017 07:40:38 +0900 Original-Received: (from hirofumi@localhost) by devron.myhome.or.jp (8.15.2/8.15.2/Submit) id vBFMebBs008997; Sat, 16 Dec 2017 07:40:37 +0900 In-Reply-To: <874lor8y0p.fsf@mail.parknet.co.jp> (OGAWA Hirofumi's message of "Sat, 16 Dec 2017 06:46:46 +0900") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 210.171.160.6 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:221117 Archived-At: OGAWA Hirofumi writes: > Eli Zaretskii writes: > >>> 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. > > I've tested the following master and emacs-26 branches... > > master 5e6fb1e246b1e7f44ebba48e7e24f597a8eb92dd > emacs-26 3003ac046900f9e7fdaa3161b99dbb1cc8f37b32 > > However result is still same (there is the described issue). I confirmed the following patch fixes the issue, although I'm not sure if the code is proper or better fix is there. Thanks --- lisp/net/shr.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff -puN lisp/net/shr.el~shr-fix-point-modification lisp/net/shr.el --- emacs/lisp/net/shr.el~shr-fix-point-modification 2017-12-16 07:32:47.777230050 +0900 +++ emacs-hirofumi/lisp/net/shr.el 2017-12-16 07:35:48.083847035 +0900 @@ -591,9 +591,10 @@ size, and full-buffer size." (defun shr-string-pixel-width (string) (if (not shr-use-fonts) (length string) - (with-temp-buffer - (insert string) - (shr-pixel-column)))) + (save-excursion + (with-temp-buffer + (insert string) + (shr-pixel-column))))) (defsubst shr--translate-insertion-chars () ;; Remove soft hyphens. _ -- OGAWA Hirofumi