From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#21730: 25.0.50; Random errors in redisplay--pre-redisplay-functions Date: Wed, 14 Sep 2016 17:01:34 +0000 Message-ID: References: <87io5zh7m1.fsf@md5i.com> <83vb9zt19o.fsf@gnu.org> <87y4epeyf2.fsf@md5i.com> <87mvuzfapy.fsf@md5i.com> <83ziyzxiwl.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1146a1521601ec053c7aafaa X-Trace: blaine.gmane.org 1473873078 13122 195.159.176.226 (14 Sep 2016 17:11:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 14 Sep 2016 17:11:18 +0000 (UTC) Cc: 21730-done@debbugs.gnu.org To: Eli Zaretskii , 21730@debbugs.gnu.org, mwd@md5i.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 14 19:11:11 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1bkDiF-0002Ap-H4 for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Sep 2016 19:11:07 +0200 Original-Received: from localhost ([::1]:57553 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkDiE-0004sd-GE for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Sep 2016 13:11:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkDZW-0006H6-OP for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 13:02:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkDZS-0005bo-AX for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 13:02:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33784) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkDZS-0005bk-77 for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 13:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bkDZS-0003AU-0E for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 13:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Sep 2016 17:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21730 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21730-submit@debbugs.gnu.org id=B21730.147387251312158 (code B ref 21730); Wed, 14 Sep 2016 17:02:01 +0000 Original-Received: (at 21730) by debbugs.gnu.org; 14 Sep 2016 17:01:53 +0000 Original-Received: from localhost ([127.0.0.1]:59727 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkDZJ-0003A1-I4 for submit@debbugs.gnu.org; Wed, 14 Sep 2016 13:01:53 -0400 Original-Received: from mail-wm0-f51.google.com ([74.125.82.51]:36113) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkDZG-00039i-Dz; Wed, 14 Sep 2016 13:01:52 -0400 Original-Received: by mail-wm0-f51.google.com with SMTP id b187so56940280wme.1; Wed, 14 Sep 2016 10:01:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cpWkJ0OmqFsQML+a5Rsg87XLFHhWdMRKiZqQO54ihrc=; b=BtwkdufUAiRQyDNSmCBOnpgXov3/M4r8RG5mVUIabdBJvysR9sERILOqYJIPHl3LGr pT7YwKcTwszeR/5Aglar7PFEf2eOKGQvLJy1Mkc7Pv8RIQgK00ErMDJ9G8M9Js5byRAu nu5zWWRA/1yopgyfKFK+eHe29H9bxdDRGH3zt2El9QHCHat33ihB09634SLlzrqzTzqw 8Desrc8ZKvnUSrpn1w2GF8XcqzBj1r1heVcoCGIyO4x/D2Fw+0dtu10nST1AOLspMhKR fUfT6pTnDnONvB1SmnovvaF/xP/hfjidBPfj6yk+shnxJBgsErLfMP4aeVF/IFCwYPER sLAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cpWkJ0OmqFsQML+a5Rsg87XLFHhWdMRKiZqQO54ihrc=; b=hp2UEe37zmsQQSzfxA7PyA92ShHrSl6+a9lquhKiP9jQAPIkQqwY6NwtlmjMD7Yp2a n2dZs2hfrHehihpPZwEZYYn+lFy07bdez+/2/dYdbC3QvquJzlMiwdHxfw/eE/e10XHg ZE7Zb2QOJnIXLhC/Ptv5PjEd2fbgxV4Dniwo6+Hr28glupWtsGtz1oWTjp6rOpA1dy80 +PfslkPIM+PYjNOOAZrlKVJJ6hGqsS+zXz2N4PSq8dUYT02VfXPgCztrSTKLPOds1bGz ivg8TSMeYMt1hJTXod+MqEiFE0wO68Spy56SymaFgB+kgVMzQmXpT45tGxXLy6+4G3cx 7yCg== X-Gm-Message-State: AE9vXwOQOCBU2Pt9EITKpRA4/gImie/g+wKj1zedsT1fBLLB5rQujAwgEHqn634JrJG/o0vGRO4i/gaWhiNMBw== X-Received: by 10.28.232.71 with SMTP id f68mr11780233wmh.55.1473872504682; Wed, 14 Sep 2016 10:01:44 -0700 (PDT) In-Reply-To: <83ziyzxiwl.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:123295 Archived-At: --001a1146a1521601ec053c7aafaa Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii schrieb am Sa., 31. Okt. 2015 um 14:34 Uhr: > > From: Michael Welsh Duggan > > Date: Sat, 31 Oct 2015 09:07:05 -0400 > > > > > I've changed the (bobp) to (=3D point 1). I'll run it for a couple o= f > > > weeks and report back. > > > > This change seems to have done the trick. I have not encountered the > > error in several days. > > Thanks for testing. I pushed the change, and I'm arking this bug as > done. > > > This change was reverted in 76ef52267cf887e3e1aa6d25b3b16dd0601dd459. It also doesn't seem correct. cursor-sensor--detect is only used in pre-redisplay-functions, and the documentation of that variable says: "Hook run just before redisplay. It is called in each window that is to be redisplayed. It takes one argument, which is the window that will be redisplayed. When run, the =E2=80=98current-buffer=E2=80=99 is set to the buffer displayed in that window." That means that (bobp) is correct and (=3D point 1) cannot give a different result, unless narrowing is in effect (then only bobp is correct). Given that replacing (bobp) with (=3D point 1) does solve this bug, the documentation of pre-redisplay-functions must be incorrect, i.e. the current buffer is not the buffer of the window passed as argument. I think the only way how this can happen is that a previous entry in pre-redisplay-functions has changed the current buffer. Probably the implementation of redisplay--pre-redisplay-functions should be changed from (with-current-buffer (window-buffer win) (run-hook-with-args 'pre-redisplay-functions win)) to (run-hook-wrapped 'pre-redisplay-functions (lambda (func) (with-current-buffer (window-buffer win) (funcall func win) nil)) or so. So we might try the following: Replace redisplay--pre-redisplay-functions (and indeed, all hooks that document anything about the current buffer) as above. Then add (cl-assert (eq (current-buffer) (window-buffer window)) to cursor-sensor--detect and remove code such as (window-point window), because that must be equal to (point). WDYT? Or am I misunderstanding something? --001a1146a1521601ec053c7aafaa Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Eli Za= retskii <eliz@gnu.org> schrieb am= Sa., 31. Okt. 2015 um 14:34=C2=A0Uhr:
> From: Michael Welsh Duggan <mwd@md5i.com>
> Date: Sat, 31 Oct 2015 09:07:05 -0400
>
> > I've changed the (bobp) to (=3D point 1).=C2=A0 I'll run = it for a couple of
> > weeks and report back.
>
> This change seems to have done the trick.=C2=A0 I have not encountered= the
> error in several days.

Thanks for testing.=C2=A0 I pushed the change, and I'm arking this bug = as
done.



This change was =C2=A0reverted in 76ef52267cf887e3e1aa6d25b3b16dd0601= dd459.
It also doesn't seem correct. cursor-sensor--detect is= only used in pre-redisplay-functions, and the documentation of that variab= le says:
"Hook run just before redisplay.
It is ca= lled in each window that is to be redisplayed.=C2=A0 It takes one argument,=
which is the window that will be redisplayed.=C2=A0 When run, th= e =E2=80=98current-buffer=E2=80=99
is set to the buffer displayed= in that window."
That means that (bobp) is correct and (=3D= point 1) cannot give a different result, unless narrowing is in effect (th= en only bobp is correct).
Given that replacing (bobp) with (=3D p= oint 1) does solve this bug, the documentation of pre-redisplay-functions m= ust be incorrect, i.e. the current buffer is not the buffer of the window p= assed as argument. I think the only way how this can happen is that a previ= ous entry in pre-redisplay-functions has changed the current buffer. Probab= ly the implementation of redisplay--pre-redisplay-functions should be chang= ed from=C2=A0
(with-current-buffer (window-buffer win)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (run-hook-with-args 'pre-redisplay-f= unctions win))
to
(run-hook-wrapped 'pre-redisplay-= functions
=C2=A0 (lambda (func) (with-current-buffer (window-buff= er win)
=C2=A0 =C2=A0 =C2=A0(funcall func win)
=C2=A0 = =C2=A0 =C2=A0nil))
or so.

So we might tr= y the following: Replace redisplay--pre-redisplay-functions (and indeed, al= l hooks that document anything about the current buffer) as above. Then add= (cl-assert (eq (current-buffer) (window-buffer window)) to cursor-sensor--= detect and remove =C2=A0code such as (window-point window), because that mu= st be equal to (point). WDYT? Or am I misunderstanding something?=C2=A0
--001a1146a1521601ec053c7aafaa--