From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049. Date: Sat, 16 Nov 2019 00:43:42 +0200 Message-ID: <54a14edc-3ea0-33b5-9650-382551d9947f@yandex.ru> References: <20191109144026.20810.76129@vcs0.savannah.gnu.org> <20191109144027.DDC3720927@vcs0.savannah.gnu.org> <38328d99-23c8-7ba7-a23d-e70ac0aab67a@yandex.ru> <20191111203445.GA5135@ACM> <7497e71d-bab6-fa04-bbc4-f52fadeda16d@yandex.ru> <20191113211936.GB4942@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="68785"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 Cc: Stefan Monnier , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 15 23:46:09 2019 Return-path: Envelope-to: ged-emacs-devel@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 1iVkLw-000Hke-Jb for ged-emacs-devel@m.gmane.org; Fri, 15 Nov 2019 23:46:08 +0100 Original-Received: from localhost ([::1]:45446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVkLv-0002x9-AX for ged-emacs-devel@m.gmane.org; Fri, 15 Nov 2019 17:46:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57585) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVkJi-0002ty-Ke for emacs-devel@gnu.org; Fri, 15 Nov 2019 17:43:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iVkJg-0005EN-KK for emacs-devel@gnu.org; Fri, 15 Nov 2019 17:43:50 -0500 Original-Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:55214) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iVkJe-0005DG-NY for emacs-devel@gnu.org; Fri, 15 Nov 2019 17:43:48 -0500 Original-Received: by mail-wm1-x335.google.com with SMTP id z26so11127207wmi.4 for ; Fri, 15 Nov 2019 14:43:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Msf4wfcir5m6jDtENXpg1/sZBjPL1CeadlorbS8rONY=; b=AOF/0eTEf3WA9p7MvpbVDNali5IBiHrqnmltRNeUZfaemowhL6vm+xzSgG5bSScSGj URsT1QTg8E/9q6DQ1/OpyvQwvjnH0thDOLaRceDUM7VNpvZtpNriiNWOV5mOXu4JyvoN fV30k0PXH0A0oR2toPsvJCqHAN4j4DnOjMva5Pfz+WAutfozFiXfOO3/3pTuGBN5BRcR wZViOoRZtbx8EXXrQD0E+Sz7hh3KmWoooI9c5jmZVVAR42HeG/8Ggy9j8fE+nSqfj3DA HcXhl8ogBUxbAT7UFiZ+tSVENkULVyZHomtBfFV8mtSAtLqiWJF8MXx0oWuz37zNYU2u G+Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Msf4wfcir5m6jDtENXpg1/sZBjPL1CeadlorbS8rONY=; b=EatV0Yk+ue1g75E6TdHtgMdJauUH2tJEo9PwgZz1GjQV8caoVXQGG++gRsoWo0hrJ7 bxO/OxJ3hAFS46r3b0tfIdWkcV245MCrIgf9nX5aOQr0j4uP1fQtcrlHMr+SvL/xeMi7 w7q7PXLY6cUiVN+lGi1GMi5GRTIr5YelGuV7n8Ej9xMGlkC2GGIdtxfCLgcB+lG7gnFm ZUDl/6/DjfXM9pFkNwlzC+2YxQVTXIDvVE4+rgcABZMzfDU0fGIPk+4qM+VejZoJwS/9 W9T0Jqbkja/28accKOlmjv5Dd4k7hTrd3+eX0y+K/JucJXXmu4Dkx9qWnXR0dz5krxKI djJA== X-Gm-Message-State: APjAAAW/0PUSkIoohdxEa6qado/b5oW9Ktgw6iBlrsxmo0nZS+fV0Zn1 N2yTeescu5XkYGI4jVSX0SU= X-Google-Smtp-Source: APXvYqx0qonR8NxxajVFIUy/hKdIUo6FZ6CEHKGcbMV4tE/0EppNA0juuYk4WXj1F6YnLGUbvZOVGg== X-Received: by 2002:a1c:9a4f:: with SMTP id c76mr17513441wme.103.1573857824790; Fri, 15 Nov 2019 14:43:44 -0800 (PST) Original-Received: from [192.168.0.5] ([212.50.117.215]) by smtp.googlemail.com with ESMTPSA id h16sm12479307wrs.48.2019.11.15.14.43.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Nov 2019 14:43:43 -0800 (PST) In-Reply-To: <20191113211936.GB4942@ACM> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::335 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:242249 Archived-At: On 13.11.2019 23:19, Alan Mackenzie wrote: > (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. By the way, I had a thought. Like, normally font-lock does widen the buffer before fontifying anything. So I was wondering, why doesn't this happen between steps iii and iv somewhere? Turns out, the (unless font-lock-dont-widen (widen)) calls are performed inside the default values of font-lock-fontify-region-function and font-lock-fontify-buffer-function. But CC Mode sets font-lock-fontify-region-function to a different value, and that specific function doesn't include this piece of code. Or rather, didn't. The new commit added an unconditional (widen) call. I think if you simply wrap it in (unless font-lock-dont-widen ...), it will improve compatibility with mmm-mode already (without adverse effects, I imagine). After that, you could audit if the other (widen) calls spread across CC Mode are still necessary. Maybe they're used in indentation code (that's also solvable). Maybe also by some other commands.