From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: cc-mode fontification feels random Date: Sun, 06 Jun 2021 14:18:15 -0400 Message-ID: References: <86a85d26-75c0-e4a3-e8d3-244c5346dd3a@dancol.org> <83r1hehnz9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35847"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: acm@muc.de, dancol@dancol.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jun 06 20:19:13 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lpxMf-00093q-31 for ged-emacs-devel@m.gmane-mx.org; Sun, 06 Jun 2021 20:19:13 +0200 Original-Received: from localhost ([::1]:40050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpxMe-0006eH-5B for ged-emacs-devel@m.gmane-mx.org; Sun, 06 Jun 2021 14:19:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpxLt-0005gE-1H for emacs-devel@gnu.org; Sun, 06 Jun 2021 14:18:25 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:49137) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpxLo-0002zt-OD; Sun, 06 Jun 2021 14:18:24 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B7F30440924; Sun, 6 Jun 2021 14:18:17 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 3FF4D440912; Sun, 6 Jun 2021 14:18:16 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1623003496; bh=hZ0pdPhXc551kQKao1ZXPrSc2n/11zQNnbg4F9hLRC4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Cy5VOLxCTjjSktCR5TFwbo/FSuPDDRkR7J3cR7sF2A5mnx2IrH+k4rcGT032uMBkX 1Qy8DUoG7/1VB4gcBqr1OqbsDPBS7ulkDnXt3XKZFsymWPxGBNHlEQKPu7ki5f+aem tLOQpALCDpn+AHBYtYh2d1Zw/8BA9kie80O4s6j52j5UpwRCbbQs109+Xvq59poeRk nDPop00PP8ClDzhs0X9tDgbLVon3TGfhuoYBTOiyf/UFPXI8NIK8EK7fLwzMH8COmi YDNbSLCfgA2t7qrd2nFi8mtGd4KecEOGfH64zBVC/EosMxpfPI73qsQhXzZKqF/6cq /fRdYfYwMBUDw== Original-Received: from alfajor (69-196-163-239.dsl.teksavvy.com [69.196.163.239]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 08CF7120DA6; Sun, 6 Jun 2021 14:18:16 -0400 (EDT) In-Reply-To: <83r1hehnz9.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 06 Jun 2021 21:00:58 +0300") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:270493 Archived-At: > So if the first windowful of a file that's displayed is at EOB, > fontification must go all the way back to BOB and start scanning > there, until it comes to the end? Yup. The way to make it bearable is to make that scan be as simple and fast as possible. Note that `syntax-propertize` and `syntax-ppss` also work this way, so it's already the case that when we start by displaying EOB we first have to apply `syntax-propertize` over the whole buffer :-( In theory, there are various cases (which depend on the specific programming language under consideration) where we could avoid such a scan, but it would introduce a lot of complexity so we don't bother. >> Indeed, there's no way currently for font-lock to tell jit-lock that it >> has decided to fontify a particular chunk without being requested to do >> so (Eli suggests setting the `fontified` property, but this means that >> all the clients of jit-lock have done their work, so it's only correct >> to set it from font-lock if you run the other `jit-lock-functions` (or >> if there are currently no other `jit-lock-functions`)), > > By "other clients" you mean those which don't fontify, but instead > piggy-back jit-lock to do other jobs? `grep jit-lock-register` in Emacs' bundled files gives bug-reference-mode, glasses-mode, and goto-address-mode as packages which use jit-lock. Stefan