From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#21730: 25.0.50; Random errors in redisplay--pre-redisplay-functions Date: Wed, 14 Sep 2016 20:09:06 +0300 Message-ID: <834m5i8l3h.fsf@gnu.org> References: <87io5zh7m1.fsf@md5i.com> <83vb9zt19o.fsf@gnu.org> <87y4epeyf2.fsf@md5i.com> <87mvuzfapy.fsf@md5i.com> <83ziyzxiwl.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1473874382 27488 195.159.176.226 (14 Sep 2016 17:33:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 14 Sep 2016 17:33:02 +0000 (UTC) Cc: 21730@debbugs.gnu.org, mwd@md5i.com To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 14 19:32:58 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 1bkE39-00054q-PX for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Sep 2016 19:32:43 +0200 Original-Received: from localhost ([::1]:57701 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkE37-0005gJ-Jz for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Sep 2016 13:32:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkDjC-0005q1-Ud for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 13:12:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkDj8-00011c-K0 for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 13:12:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33792) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkDj8-00011T-Fx for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 13:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bkDj8-0003P8-9R for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 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: Wed, 14 Sep 2016 17:12: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.147387311013058 (code B ref 21730); Wed, 14 Sep 2016 17:12:02 +0000 Original-Received: (at 21730) by debbugs.gnu.org; 14 Sep 2016 17:11:50 +0000 Original-Received: from localhost ([127.0.0.1]:59737 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkDiw-0003OX-89 for submit@debbugs.gnu.org; Wed, 14 Sep 2016 13:11:50 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55265) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkDiu-0003O1-GE for 21730@debbugs.gnu.org; Wed, 14 Sep 2016 13:11:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkDio-0000tV-HW for 21730@debbugs.gnu.org; Wed, 14 Sep 2016 13:11:43 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkDij-0000rx-Fx; Wed, 14 Sep 2016 13:11:37 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3759 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bkDgP-0007DW-FY; Wed, 14 Sep 2016 13:09:14 -0400 In-reply-to: (message from Philipp Stephani on Wed, 14 Sep 2016 16:54:23 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:123297 Archived-At: > From: Philipp Stephani > Date: Wed, 14 Sep 2016 16:54:23 +0000 > > Thanks for testing. I pushed the change, and I'm arking this bug as > done. > > This change was reverted in 76ef52267cf887e3e1aa6d25b3b16dd0601dd459. Too bad people revert changes that fixed a bug without making sure they don't reintroduce the same bug again. Now Emacs 25.1 will be released with this bug. > 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) ? Anyway, my role in this bug was just to facilitate the debugging and push a commit, I didn't really look at the issue deeper than what you see in the discussion.