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 19:11:57 +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/mixed; boundary=047d7b86e99268d361053c7c81ef X-Trace: blaine.gmane.org 1473880806 13258 195.159.176.226 (14 Sep 2016 19:20:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 14 Sep 2016 19:20:06 +0000 (UTC) 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 21:20:02 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 1bkFil-0001UE-S3 for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Sep 2016 21:19:48 +0200 Original-Received: from localhost ([::1]:58304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkFij-0002v5-Md for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Sep 2016 15:19:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50303) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkFcJ-0006eD-La for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 15:13:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkFcE-0007BU-4z for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 15:13:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33859) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkFcE-0007BM-04 for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 15:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bkFcD-0006Gq-Pt for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 15:13:01 -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 19:13: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.147388033624047 (code B ref 21730); Wed, 14 Sep 2016 19:13:01 +0000 Original-Received: (at 21730) by debbugs.gnu.org; 14 Sep 2016 19:12:16 +0000 Original-Received: from localhost ([127.0.0.1]:59804 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkFbU-0006Fm-1O for submit@debbugs.gnu.org; Wed, 14 Sep 2016 15:12:16 -0400 Original-Received: from mail-wm0-f51.google.com ([74.125.82.51]:34610) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkFbS-0006FY-0I for 21730@debbugs.gnu.org; Wed, 14 Sep 2016 15:12:14 -0400 Original-Received: by mail-wm0-f51.google.com with SMTP id l68so9131668wml.1 for <21730@debbugs.gnu.org>; Wed, 14 Sep 2016 12:12:13 -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; bh=/k+I6E05ha+G5rVXA5rKkVPcpF6O5liVmPV04ilihEI=; b=vK82fHUpcD3D6oMy8fFQ2L1Y/DxONJk0P3Xi7UIlVDQLSF8bqnkaz/J7nP16pp9c8Y n22x3aDKrk6JjDPv0btIj+cXualpkiZ//C/RUKuD8JfD19DDvVVVgkZmvdyQdfSff62L 0hVBiibtpI8e5KZP5yxIRdTyUdUuVbzEMDKr4HCIr66x7ppe988FHFD7AmH2XgbOqjg2 rBpOql3PLvgLzT7QvMaPOLcsnQxPvKtOS9yT4PBljf2aPbrlbz0ZdxvRTSWzPNlPRrhK pttSUclw73cgsSCgMPtnBIC93UOmMNjnb2ayu6Tqlq5JpQT5FYvmvlMNh73UGL003CWy L3zg== 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; bh=/k+I6E05ha+G5rVXA5rKkVPcpF6O5liVmPV04ilihEI=; b=i2J0yrgU9q+9xeYI/WnGD2cLiTl6PvYh2Ne2Jwa6b9+CLHhGld6eU+zxWIPC1+brnZ 84yRylDpVQ7c9xBTEr9lNVpO0wGJHhS0w9IIZirQEXrAMxkwMchvkRU/De3ghbt862e9 akC7HVRt/vUfT5jFS6i+mWxb8EgdBHtGF53jycdaiescIZpbEz5iMcScFcc3BIpOC6jM Qh6dB0xPBc0RlCKzMVXXmq7QtP4IQ+YMJVVJbBu5qlUalQDcRca36EWgRah9rVFpRDy/ Hp3laVoo49l6+ksbDxlQst8rjxOR1SweXk4NKwEFBt7qxRsmF3WTlmXCOkAgpqA+Flh/ CIJA== X-Gm-Message-State: AE9vXwPjVPdMxd7skFkSCOfq3ikOUahgWJyyKBRxpDzslsb2Bim9CHq31hR+mKv2cX9J9CzZ7rtC76rvI4ysfQ== X-Received: by 10.194.47.101 with SMTP id c5mr4795003wjn.67.1473880328286; Wed, 14 Sep 2016 12:12:08 -0700 (PDT) In-Reply-To: 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:123307 Archived-At: --047d7b86e99268d361053c7c81ef Content-Type: multipart/alternative; boundary=047d7b86e99268d35d053c7c81ed --047d7b86e99268d35d053c7c81ed Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Philipp Stephani schrieb am Mi., 14. Sep. 2016 um 18:54 Uhr: > 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 differe= nt > 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 thin= k > 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 fr= om > (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. > I've attached a patch for this. --047d7b86e99268d35d053c7c81ed Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Philip= p Stephani <p.stephani2@gmail.c= om> schrieb am Mi., 14. Sep. 2016 um 18:54=C2=A0Uhr:
Eli Zaretskii = <e= liz@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=A0= reverted in=C2=A076ef52267cf887e3e1aa6d25b3b16dd0601dd459.
It also doesn't seem correct. cursor-sensor--detect is o= nly used in pre-redisplay-functions, and the documentation of that variable= says:
"Hook run just before redisplay.<= /div>
It is called in each window that is to be red= isplayed.=C2=A0 It takes one argument,
which = is the window that will be redisplayed.=C2=A0 When run, the =E2=80=98curren= t-buffer=E2=80=99
is set to the buffer displa= yed in that window."
That means that (bo= bp) is correct and (=3D point 1) cannot give a different result, unless nar= rowing is in effect (then only bobp is correct).
Given that replacing (bobp) with (=3D point 1) does solve this bug, the= documentation of=C2=A0pre-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 re= display--pre-redisplay-functions should be changed from=C2=A0
(with-current-buffer (window-buff= er win)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (r= un-hook-with-args 'pre-redisplay-functions win))
to
(run-hook-wrapped 'pre-= redisplay-functions
=C2=A0 (lambda (func) (wi= th-current-buffer (window-buffer win)
=C2=A0 = =C2=A0 =C2=A0(funcall func win)
=C2=A0 =C2=A0= =C2=A0nil))
or so.

I've attached a patch for this.=C2=A0
--047d7b86e99268d35d053c7c81ed-- --047d7b86e99268d361053c7c81ef Content-Type: text/plain; charset=US-ASCII; name="0001-Restore-buffer-in-pre-redisplay-functions.txt" Content-Disposition: attachment; filename="0001-Restore-buffer-in-pre-redisplay-functions.txt" Content-Transfer-Encoding: base64 Content-ID: <1572a1c3b4858316fef1> X-Attachment-Id: 1572a1c3b4858316fef1 RnJvbSAzNjFhMDQ4OGE2N2ZmYzYwMWUyMDc2MjZiMjUzMjdiZjQ4NjhkMjRhIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBQaGlsaXBwIFN0ZXBoYW5pIDxwaHN0QGdvb2dsZS5jb20+CkRh dGU6IFdlZCwgMTQgU2VwIDIwMTYgMjE6MDg6MDcgKzAyMDAKU3ViamVjdDogW1BBVENIXSBSZXN0 b3JlIGJ1ZmZlciBpbiBgcHJlLXJlZGlzcGxheS1mdW5jdGlvbnMnCgpQcmV2aW91c2x5LCBhIGZ1 bmN0aW9uIGluIGBwcmUtcmVkaXNwbGF5LWZ1bmN0aW9ucycgY291bGQgY2hhbmdlIHRoZQpjdXJy ZW50IGJ1ZmZlciwgYnJlYWtpbmcgdGhlIGNvbnRyYWN0IG9mIGBwcmUtcmVkaXNwbGF5LWZ1bmN0 aW9ucycKdGhhdCB0aGUgY3VycmVudCBidWZmZXIgaXMgYWx3YXlzIHRoZSBidWZmZXIgZGlzcGxh eWVkIGluIHRoZSBhcmd1bWVudAp3aW5kb3cuCgoqIGxpc3Avc2ltcGxlLmVsIChyZWRpc3BsYXkt LXByZS1yZWRpc3BsYXktZnVuY3Rpb25zKTogRml4CmJlaGF2aW9yIHdoZW4gYSBmdW5jdGlvbiBp biBgcHJlLXJlZGlzcGxheS1mdW5jdGlvbnMnIGNoYW5nZXMgdGhlCmN1cnJlbnQgYnVmZmVyLgoK KiB0ZXN0L2xpc3Avc2ltcGxlLXRlc3RzLmVsCihwcmUtcmVkaXNwbGF5LWZ1bm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UtcmVkaXNwbGF5LWZ1bmN0aW9uJworKGVydC1kZWZ0ZXN0IHByZS1yZWRp c3BsYXktZnVuY3Rpb24tLWN1cnJlbnQtYnVmZmVyICgpCisgICJWZXJpZnkgdGhhdCB0aGUgZnVu Y3Rpb25zIGluIGBwcmUtcmVkaXNwbGF5LWZ1bmN0aW9ucycgYXJlIGNhbGxlZCB3aXRoIHRoZSBj b3JyZWN0IGBjdXJyZW50LWJ1ZmZlcicuCitTZWUgQnVnIzIxNzMwLiIKKyAgKHdpdGgtdGVtcC1i dWZmZXIKKyAgICAobGV0ICgoYnVmZmVyLTEgKGN1cnJlbnQtYnVmZmVyKSkpCisgICAgICAod2l0 aC10ZW1wLWJ1ZmZlcgorICAgICAgICAobGV0ICgoYnVmZmVyLTIgKGN1cnJlbnQtYnVmZmVyKSkK KyAgICAgICAgICAgICAgKHByZS1yZWRpc3BsYXktZnVuY3Rpb25zIHByZS1yZWRpc3BsYXktZnVu Y3Rpb25zKQorICAgICAgICAgICAgICAoaG9vay0xLWNhbGxzIDApCisgICAgICAgICAgICAgICho b29rLTItY2FsbHMgMCkpCisgICAgICAgICAgKGFkZC1ob29rICdwcmUtcmVkaXNwbGF5LWZ1bmN0 aW9ucworICAgICAgICAgICAgICAgICAgICAobGFtYmRhICh3aW5kb3cpCisgICAgICAgICAgICAg ICAgICAgICAgKHNob3VsZCAoZXF1YWwgKGN1cnJlbnQtYnVmZmVyKSAod2luZG93LWJ1ZmZlciB3 aW5kb3cpKSkKKyAgICAgICAgICAgICAgICAgICAgICAoY2wtaW5jZiBob29rLTEtY2FsbHMpCisg ICAgICAgICAgICAgICAgICAgICAgKHNldC1idWZmZXIgYnVmZmVyLTEpKQorICAgICAgICAgICAg ICAgICAgICA6YXBwZW5kKQorICAgICAgICAgIChhZGQtaG9vayAncHJlLXJlZGlzcGxheS1mdW5j dGlvbnMKKyAgICAgICAgICAgICAgICAgICAgKGxhbWJkYSAod2luZG93KQorICAgICAgICAgICAg ICAgICAgICAgIChzaG91bGQgKGVxdWFsIChjdXJyZW50LWJ1ZmZlcikgKHdpbmRvdy1idWZmZXIg d2luZG93KSkpCisgICAgICAgICAgICAgICAgICAgICAgKGNsLWluY2YgaG9vay0yLWNhbGxzKSkK KyAgICAgICAgICAgICAgICAgICAgOmFwcGVuZCkKKyAgICAgICAgICAoZnVuY2FsbCBwcmUtcmVk aXNwbGF5LWZ1bmN0aW9uIG5pbCkKKyAgICAgICAgICAoc2hvdWxkIChlcXVhbCAoY3VycmVudC1i dWZmZXIpIGJ1ZmZlci0yKSkKKyAgICAgICAgICAoc2hvdWxkIChlcXVhbCBob29rLTEtY2FsbHMg MSkpCisgICAgICAgICAgKHNob3VsZCAoZXF1YWwgaG9vay0yLWNhbGxzIDEpKSkpKSkpCisKIChw cm92aWRlICdzaW1wbGUtdGVzdCkKIDs7OyBzaW1wbGUtdGVzdC5lbCBlbmRzIGhlcmUKLS0gCjIu OC4wLnJjMy4yMjYuZzM5ZDQwMjAKCg== --047d7b86e99268d361053c7c81ef--