From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#56008: 29.0.50; image-mode buffer scrolled down automatically Date: Thu, 16 Jun 2022 20:11:09 +0300 Message-ID: <83y1xwpm8i.fsf@gnu.org> References: <87pmj9cl4l.fsf@gmail.com> <87czf8ervd.fsf@gnus.org> <878rpwer6z.fsf@gnus.org> <87o7yszqx6.fsf@gmail.com> <834k0kr9rd.fsf@gnu.org> <87sfo4bt5r.fsf@gnus.org> <87k09gzoei.fsf@gmail.com> <831qvor4l4.fsf@gnu.org> <87tu8k4kgm.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39780"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 56008@debbugs.gnu.org To: Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 16 19:13:24 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o1t3b-000ABl-Ro for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Jun 2022 19:13:24 +0200 Original-Received: from localhost ([::1]:43800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1t3a-0007Yy-Re for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Jun 2022 13:13:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1t2J-0006rR-A4 for bug-gnu-emacs@gnu.org; Thu, 16 Jun 2022 13:12:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49128) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1t2I-0005nW-Vi for bug-gnu-emacs@gnu.org; Thu, 16 Jun 2022 13:12:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o1t2I-000779-Pv for bug-gnu-emacs@gnu.org; Thu, 16 Jun 2022 13:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Jun 2022 17:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56008 X-GNU-PR-Package: emacs Original-Received: via spool by 56008-submit@debbugs.gnu.org id=B56008.165539948627272 (code B ref 56008); Thu, 16 Jun 2022 17:12:02 +0000 Original-Received: (at 56008) by debbugs.gnu.org; 16 Jun 2022 17:11:26 +0000 Original-Received: from localhost ([127.0.0.1]:43021 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1t1h-00075o-JH for submit@debbugs.gnu.org; Thu, 16 Jun 2022 13:11:25 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36902) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1t1d-00075W-2f for 56008@debbugs.gnu.org; Thu, 16 Jun 2022 13:11:23 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:45624) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1t1X-0005Sz-PZ; Thu, 16 Jun 2022 13:11:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=UKbbV/b/wrOAxvyZj4LDMLcpPHDX63LKeDGjiyiObck=; b=H3ejj6lSMfrCuvTPxgaD 9bFUyEb4CzAmq7DarCQFLlZPoFwP9wBCj1R1Y6G+9FvKudwmuhr0fYmevpFLsWpANW9aSfBpyKHfK 9OWqzBiaha6Yq/+0AZ1KRvsE2GsTZifwAWkHVSBDu43AjqH9Nln5YxP+n7qwSzqy22sNSH3UEj2sQ 1yqGNiP88D2VVEwlLjEBLsvRd+dQKR8kbaUU4nC0qCpI4ihrtvVEo3MR7xbLskxpXLoszthas5AhN z1IX9k8cU2HHuA0PkyQ7hSZE24JChKHT8FJ8QhHEsmBX+L2922dRjJUycnFJtJclGBJyk180x/J6H u4QFUKjSAS2cRg==; Original-Received: from [87.69.77.57] (port=2642 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1t1X-0000JW-9L; Thu, 16 Jun 2022 13:11:15 -0400 In-Reply-To: <87tu8k4kgm.fsf@gmail.com> (message from Visuwesh on Thu, 16 Jun 2022 22:25:05 +0530) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:234651 Archived-At: > From: Visuwesh > Cc: larsi@gnus.org, 56008@debbugs.gnu.org > Date: Thu, 16 Jun 2022 22:25:05 +0530 > > [வியாழன் ஜூன் 16, 2022 18:49] Eli Zaretskii wrote: > > > What do you mean by "it was `save-window-excursion'"? what is "it" in > > this case? > > I thought the source of the random, unwarranted scrolling could be > `save-window-excursion' since it did come with the following warning, > > BEWARE: Most uses of this macro introduce bugs. > E.g. it should not be used to try and prevent some code from opening > a new window, since that window may sometimes appear in another frame, > in which case ‘save-window-excursion’ cannot help. We don't create new windows in this case, so that warning is not relevant. But save-window-excursion is indeed part of the puzzle, see below. > > And how did you see that this is not the case? > > Sorry, but it is close to a year since I looked at the source code. All > I remember is being annoyed by the bug despite removing the > `save-window-excursion' bit willy-nilly. > > [ This was all in ement.el's source code if I wasn't clear, BTW. ] I don't know what ement.el does and whether this is related, but here's what was happening in this case: . we invoke eww to fetch some URL . before it finishes to fetch the URL, we switch to another window . eww finishes fetching the URL and calls shr.el to render it . shr.el uses the selected window for rendering, and as part of that, it calls set-window-buffer to temporarily make the buffer in which it renders be the buffer of the selected window . set-window-buffer resets the window's hscroll and vscroll values . shr.el calls set-window-buffer inside save-window-excursion, but save-window-excursion didn't preserve the value of vscroll, and in addition shr.el called set-window-hscroll in one place that wasn't inside save-window-excursion . so both vscroll and hscroll of the window showing the image ended up with zero hscroll and vscroll . since image-mode overrides the usual definition of M-> with a command that works by setting the window's hscroll and vscroll, resetting these two makes the (mistaken) impression that the window was scrolled . the reason M-x and M-: appeared to "fix" the problem is that image-mode defines a window-configuration-change-hook that forces the display back to what it was -- this looked to us as if the problem was caused by some redisplay bug, something that took me some time to realize its being completely wrong