From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#38049: C mode fontification broken with reposition-window Date: Sat, 9 Nov 2019 14:45:17 +0000 Message-ID: <20191109144517.GB5546@ACM> References: <8736f4k8mi.fsf@mail.linkov.net> <20191105210737.GA6303@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="81696"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: 38049-done@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 09 15:46:16 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iTS0F-000L8n-MF for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Nov 2019 15:46:15 +0100 Original-Received: from localhost ([::1]:37098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTS0E-000317-Eh for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Nov 2019 09:46:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43446) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTS05-0002z7-Qu for bug-gnu-emacs@gnu.org; Sat, 09 Nov 2019 09:46:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iTS04-0000if-Ou for bug-gnu-emacs@gnu.org; Sat, 09 Nov 2019 09:46:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39561) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iTS02-0000hX-Ds; Sat, 09 Nov 2019 09:46:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iTS02-0000XB-A7; Sat, 09 Nov 2019 09:46:02 -0500 Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sat, 09 Nov 2019 14:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 38049 X-GNU-PR-Package: emacs,cc-mode Mail-Followup-To: 38049@debbugs.gnu.org, acm@muc.de, juri@linkov.net Original-Received: via spool by 38049-done@debbugs.gnu.org id=D38049.15733107221992 (code D ref 38049); Sat, 09 Nov 2019 14:46:02 +0000 Original-Received: (at 38049-done) by debbugs.gnu.org; 9 Nov 2019 14:45:22 +0000 Original-Received: from localhost ([127.0.0.1]:48381 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iTRzO-0000W4-DE for submit@debbugs.gnu.org; Sat, 09 Nov 2019 09:45:22 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:12361 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1iTRzM-0000Vu-Dr for 38049-done@debbugs.gnu.org; Sat, 09 Nov 2019 09:45:21 -0500 Original-Received: (qmail 30531 invoked by uid 3782); 9 Nov 2019 14:45:18 -0000 Original-Received: from acm.muc.de (p4FE155B2.dip0.t-ipconnect.de [79.225.85.178]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 09 Nov 2019 15:45:17 +0100 Original-Received: (qmail 8638 invoked by uid 1000); 9 Nov 2019 14:45:17 -0000 Content-Disposition: inline In-Reply-To: <20191105210737.GA6303@ACM> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de 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: 209.51.188.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:171325 Archived-At: Hello, Juri. On Tue, Nov 05, 2019 at 21:07:37 +0000, Alan Mackenzie wrote: > On Sun, Nov 03, 2019 at 22:28:05 +0200, Juri Linkov wrote: > > Version: 27.0.50 > > This is a reproducible test case: > > 0. emacs -Q > > 1. C-x C-f emacs/lib-src/emacsclient.c > > 2. M-: (progn (search-forward "create-frame" nil t) (reposition-window)) > > Then half screen displays unfontified lines. > > Fontification doesn't fail in other modes, only in C mode. > > This has something to do with interaction between c-font-lock > > and buffer navigation in reposition-window. > Indeed it does. > Briefly, > (i) reposition-window narrows to (2758 3940) in > repos-count-screen-lines. > (ii) This latter function uses vertical-motion to count the lines. > (iii) vertical-motion triggers jit-lock fontification. > (iv) This calls (eventually) c-font-lock-fontify-region. > (v) c-font-lock-fontify-region attempts to examine buffer text before > the start of the jit-lock chunk to find syntactic context. > (vi) This is outside the visible region, so Emacs raises an exception. > (vii) The exception is caught and discarded by an unwind-protect in > c-font-lock-fontify-region. > (viii) The jit-lock chunk remains unfontified. [ .... ] I have fixed this bug by widening around c-font-lock-fontify-region. I am closing the bug with this post. -- Alan Mackenzie (Nuremberg, Germany).