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 18:43:13 +0000 Message-ID: References: <87io5zh7m1.fsf@md5i.com> <83vb9zt19o.fsf@gnu.org> <87y4epeyf2.fsf@md5i.com> <87mvuzfapy.fsf@md5i.com> <83ziyzxiwl.fsf@gnu.org> <834m5i8l3h.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7ba97a10a81433053c7c1a53 X-Trace: blaine.gmane.org 1473878666 4268 195.159.176.226 (14 Sep 2016 18:44:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 14 Sep 2016 18:44:26 +0000 (UTC) Cc: 21730@debbugs.gnu.org, mwd@md5i.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 14 20:44:22 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 1bkFAM-00084a-2e for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Sep 2016 20:44:14 +0200 Original-Received: from localhost ([::1]:58105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkFAK-0001LK-BH for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Sep 2016 14:44:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkFAC-0001L7-4C for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 14:44:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkFAA-0006Ik-Qh for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 14:44:04 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkFAA-0006Ig-Mr for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 14:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bkFAA-0005aC-C2 for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 14:44: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 18:44:02 +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.147387861221418 (code B ref 21730); Wed, 14 Sep 2016 18:44:02 +0000 Original-Received: (at 21730) by debbugs.gnu.org; 14 Sep 2016 18:43:32 +0000 Original-Received: from localhost ([127.0.0.1]:59783 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkF9g-0005ZO-Jp for submit@debbugs.gnu.org; Wed, 14 Sep 2016 14:43:32 -0400 Original-Received: from mail-wm0-f44.google.com ([74.125.82.44]:36206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkF9e-0005Z8-8I for 21730@debbugs.gnu.org; Wed, 14 Sep 2016 14:43:30 -0400 Original-Received: by mail-wm0-f44.google.com with SMTP id b187so60995548wme.1 for <21730@debbugs.gnu.org>; Wed, 14 Sep 2016 11:43:30 -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=t3bxt/GxJwNMys33r9UdskOUX7RInOb9qPrsuLsUrYQ=; b=xLCNa4iWCwZb8owK96SPRPA7WHVjJpiVy2OcXy9yMNlo9+T4aqalQ3xCOqDIcXL+Ye KXJ79vl820WxbhDi0MQ0PlHAnbf/pF18RQ9VaVkmwxv2/2s1m2aGM9Pm0zSt4Bp/nR9h grFeMagYw8oRI3FNsCZ+XZiC/cYvyUnLKZBRq/oXfguSwz4gruQJWnF6ANfxnkDitooc KGV663vZisSGvtUDGQE6J/Amgqz5YnDgmErse7qW6FQfrOjk1i8omgE9CvhD8B7hogy0 n0RZ/HEL0PVHVSUEKGPfvaHW5s8oa8PIGafbv+4lPYP4DNdy/Ix88QvX3xzpWEzNeRC/ P5LA== 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=t3bxt/GxJwNMys33r9UdskOUX7RInOb9qPrsuLsUrYQ=; b=l37HMm8b16k1pZKSrlhvQ9zPx5TDPgboTVmsHZPaFRDAKoJui/MAeSvhM/G4dV1ST8 ywSYxsSueCY7T9VyFTV0fzatWHHXByYTJTlnlE7vzWOm07vHNB+bPfUPmAzWGeOnNaEu r5KPOaDMAJQZdMRS//bTRPugUOaePyYQEPoq97Ii7vfhqvVXy4hbDFikJWxOgmOK8aX1 xJODfwAnhz291ANe3RBWYlPLpbhCC5lfgrlsjOHPIxJcIAL0U403j2TtJl3+nYs7WJNa tSXvo1p25S6bEa+QHbEKy9YcfMWUh1xk+12tMuKUK9DyeB/Xw+fpITzaQYHMChTdCzuK 3gdQ== X-Gm-Message-State: AE9vXwOMmb688HdT3SrlSQJ2Evr85jBjXNFaqtIOMe4bF+X9tKlvVQQkxZUzb4EH1hDh33ItH3EfbW+2oWsxbg== X-Received: by 10.194.184.39 with SMTP id er7mr4110232wjc.159.1473878604384; Wed, 14 Sep 2016 11:43:24 -0700 (PDT) In-Reply-To: <834m5i8l3h.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:123305 Archived-At: --047d7ba97a10a81433053c7c1a53 Content-Type: text/plain; charset=UTF-8 Eli Zaretskii schrieb am Mi., 14. Sep. 2016 um 19:11 Uhr: > > > Given that replacing (bobp) with (= 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? > > Since the problem that caused the patch to be reverted was with > narrowing, why not simply use > > (= point (with-current-buffer (window-buffer window) (point-min))) > > instead of > > (= point 1) > > ? > > This has the same issues as described above. There's more code in cursor-sensor--detect that assumes (eq (current-buffer) (window-buffer window)), e.g. the form (get-char-property point 'cursor-sensor-functions). Therefore (= point (with-current-buffer (window-buffer window) (point-min))) must be the same as (bobp). Another mystery is the stack trace entry "run-hook-with-args(cursor-sensor--detect #)". How can cursor-sensor--detect be the first argument to run-hook-with-args? Shouldn't it always be pre-redisplay-functions? --047d7ba97a10a81433053c7c1a53 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Eli Za= retskii <eliz@gnu.org> schrieb am= Mi., 14. Sep. 2016 um 19:11=C2=A0Uhr:

> Given that replacing (bobp) with (=3D point 1) does solve this bug, th= e documentation of pre-redisplay-functions
> must be incorrect, i.e. the current buffer is not the buffer of the wi= ndow passed as argument. I think the only
> way how this can happen is that a previous entry in pre-redisplay-func= tions has changed the current buffer.
> Probably the implementation of redisplay--pre-redisplay-functions shou= ld 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-functi= ons (and indeed, all hooks that
> document anything about the current buffer) as above. Then add (cl-ass= ert (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 somethin= g?

Since the problem that caused the patch to be reverted was with
narrowing, why not simply use

=C2=A0 (=3D point (with-current-buffer (window-buffer window) (point-min)))=

instead of

=C2=A0 (=3D point 1)

?


This has the same = issues as described above.=C2=A0 There's more code in cursor-sensor--de= tect that assumes (eq (current-buffer) (window-buffer window)), e.g. the fo= rm=C2=A0(get-char-property point 'cursor-sensor-functions). Therefore= =C2=A0(=3D point (with-current-buffer (window-buffer window) (point-min))) = must be the same as (bobp).
Another mystery is the stack trace en= try "run-hook-with-args(cursor-sensor--detect #<window 224 on *Grou= p*>)". How can cursor-sensor--detect be the first argument to run-h= ook-with-args? Shouldn't it always be pre-redisplay-functions?
--047d7ba97a10a81433053c7c1a53--