From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#56008: 29.0.50; image-mode buffer scrolled down automatically Date: Thu, 16 Jun 2022 22:53:01 +0530 Message-ID: <87edzo4j62.fsf@gmail.com> 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> <83y1xwpm8i.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19119"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: larsi@gnus.org, 56008@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 16 19:24:08 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 1o1tE0-0004jn-IO for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Jun 2022 19:24:08 +0200 Original-Received: from localhost ([::1]:48976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1tDz-0003hY-J7 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Jun 2022 13:24:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1tDu-0003hP-2O for bug-gnu-emacs@gnu.org; Thu, 16 Jun 2022 13:24:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49169) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1tDt-0000Cm-Qn for bug-gnu-emacs@gnu.org; Thu, 16 Jun 2022 13:24:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o1tDt-0007Qy-KW for bug-gnu-emacs@gnu.org; Thu, 16 Jun 2022 13:24:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Jun 2022 17:24:01 +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.165540019328517 (code B ref 56008); Thu, 16 Jun 2022 17:24:01 +0000 Original-Received: (at 56008) by debbugs.gnu.org; 16 Jun 2022 17:23:13 +0000 Original-Received: from localhost ([127.0.0.1]:43066 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1tD7-0007Pt-3F for submit@debbugs.gnu.org; Thu, 16 Jun 2022 13:23:13 -0400 Original-Received: from mail-pj1-f67.google.com ([209.85.216.67]:43870) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1tD5-0007Pg-8p for 56008@debbugs.gnu.org; Thu, 16 Jun 2022 13:23:11 -0400 Original-Received: by mail-pj1-f67.google.com with SMTP id y13-20020a17090a154d00b001eaaa3b9b8dso2076480pja.2 for <56008@debbugs.gnu.org>; Thu, 16 Jun 2022 10:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=EaaMrJg+VfLAUHkFGaOw7uj73PRBhUQ0FRskC+kXADQ=; b=WvrsbXu+t9jBp3hnLBg++DSnAFsgzO1UXvpzikegofKtZThPD8gMDZKKv/M5xH6OQe Xwg55IfvkRpU9qys2NPFHVSpdPE7R5fJjVsH7ttDFoG3TTkPH/757a6ndecl6JhbN4eU F1rbK6hsPpvV1kSGLdSEQF2YSBnkclMXbk9BSNeEsvahacRP6JI/irHc+rKCRNknALbV F5GeN2Lz0lhfcTiqf+/N4pu/rxVTYDKngW9fc1BjNvyAvH6OMeJaNPd1Tn09962g/UPe v6S36+6WwqDCI6ZB/+J7sRjt/JMYqRSJLt8nCwXl13Gw4bAwL8vZEHd49N7nFZdvsE/V mpwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=EaaMrJg+VfLAUHkFGaOw7uj73PRBhUQ0FRskC+kXADQ=; b=N5CYltKjS0WozE5YhRYZ4ARd0mwgsZ+ed4t2chTvoLg8KKGds7RJMSibv+l0CuceoC IMqnn89lvgmXMYtTUtlh+PXi7j2ItcNWzueoiTkR9hIzSJLZXN/U+MNt6AXDi2c358r1 AlPLiLFwCgzR74NI9A81HbO99qWawemElPFUN7fzdeBsO617hNCkUBR1S1Ak9qKEdJpb TYYUULzTbwnlowor4ZJ5+ePywgB8CvKq1BxNtSrTMmRvurhwryu1XZ3MQlFbAUPVD4P8 E4HBQC4v7AKhpiOegGn3KZpDgvLQZNC7657l7RTd9w4+w3hhCewt7jV3tQbeHXuljw2Z +u1w== X-Gm-Message-State: AJIora/tvw6g3Fcq6R/J7iT5MezWQSHSdxAwykSVkigjWJSmezLn45OP bYHTBrbSpu7ARIDJ062yKvw= X-Google-Smtp-Source: AGRyM1sqUGq078NaNmkHS/7IpUVUXlpJ16tNW0ucgRXw+I5XadFxpETGcu4Fni119DwkAkGLi/dZjw== X-Received: by 2002:a17:90b:1d90:b0:1e8:5a98:d591 with SMTP id pf16-20020a17090b1d9000b001e85a98d591mr16992317pjb.126.1655400185450; Thu, 16 Jun 2022 10:23:05 -0700 (PDT) Original-Received: from localhost ([49.205.83.195]) by smtp.gmail.com with ESMTPSA id p14-20020a170902780e00b0015e8d4eb273sm1903407pll.189.2022.06.16.10.23.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 10:23:04 -0700 (PDT) In-Reply-To: <83y1xwpm8i.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 16 Jun 2022 20:11:09 +0300") 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:234654 Archived-At: [=E0=AE=B5=E0=AE=BF=E0=AE=AF=E0=AE=BE=E0=AE=B4=E0=AE=A9=E0=AF=8D =E0=AE=9C= =E0=AF=82=E0=AE=A9=E0=AF=8D 16, 2022 20:11] Eli Zaretskii wrote: >> From: Visuwesh >> Cc: larsi@gnus.org, 56008@debbugs.gnu.org >> Date: Thu, 16 Jun 2022 22:25:05 +0530 >>=20 >> [=E0=AE=B5=E0=AE=BF=E0=AE=AF=E0=AE=BE=E0=AE=B4=E0=AE=A9=E0=AF=8D =E0=AE= =9C=E0=AF=82=E0=AE=A9=E0=AF=8D 16, 2022 18:49] Eli Zaretskii wrote: >>=20 >> > What do you mean by "it was `save-window-excursion'"? what is "it" in >> > this case? >>=20 >> I thought the source of the random, unwarranted scrolling could be >> `save-window-excursion' since it did come with the following warning, >>=20 >> 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 fram= e, >> in which case =E2=80=98save-window-excursion=E2=80=99 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? >>=20 >> 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. >>=20 >> [ 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 Thanks for the explanation, Eli! If I still the remember the ement.el code, I think your commit _should_ fix the problem. But if it doesn't, at least now I have a better idea of where to look. Thanks, again.