From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Adam Porter Newsgroups: gmane.emacs.devel Subject: Re: Limits of multiline font-lock Date: Wed, 18 Sep 2019 21:36:09 -0500 Message-ID: <87ef0d6mhy.fsf@alphapapa.net> References: <87impuu7qy.fsf@web.de> <874l198g0q.fsf@alphapapa.net> <87ftktghwm.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="31978"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 19 04:36:40 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 1iAmJD-00089h-5M for ged-emacs-devel@m.gmane.org; Thu, 19 Sep 2019 04:36:39 +0200 Original-Received: from localhost ([::1]:37174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAmJC-0007Mo-0x for ged-emacs-devel@m.gmane.org; Wed, 18 Sep 2019 22:36:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51416) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAmJ5-0007MZ-D1 for emacs-devel@gnu.org; Wed, 18 Sep 2019 22:36:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAmJ4-0007pA-6G for emacs-devel@gnu.org; Wed, 18 Sep 2019 22:36:31 -0400 Original-Received: from 195-159-176-226.customer.powertech.no ([195.159.176.226]:39602 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAmJ3-0007oR-W9 for emacs-devel@gnu.org; Wed, 18 Sep 2019 22:36:30 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1iAmIx-0007pI-Is for emacs-devel@gnu.org; Thu, 19 Sep 2019 04:36:23 +0200 X-Injected-Via-Gmane: http://gmane.org/ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 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:240158 Archived-At: Michael Heerdegen writes: > Adam Porter writes: > >> You might be interested in this package I published recently. It >> implements depth-based syntax highlighting for Lisp and some other >> languages. >> >> https://github.com/alphapapa/prism.el > > Nice. Could it go to Gnu Elpa? Well, I have done the CA, but none of my packages are in ELPA yet, just in my GitHub repos and MELPA. I'm not necessarily opposed to putting Prism in ELPA someday, but it probably needs to be more mature before considering that. > If you use `font-lock-extend-region-functions', all of font-lock uses > the extended region, right? Ah, that hadn't occurred to me! Thanks! > I guess basing your functionality on jit-lock-register could be > better. Thanks, I'll have to look into that. > If finding the beginning-of-defun and identifying the levels > is what causes the main cost, it wouldn't help much, however. I think the problem, when it happens, is that too much code is being re-fontified when the buffer changes, which I think is due to the region extension. It's only noticable on very large sexps. It occurred to me that, for Lisp especially, extending the region might not be necessary, because syntax-ppss determines the correct depth regardless. I have a WIP branch that does some refactoring along those lines, but it needs more work. > My use case is a bit simpler since I only have to deal with Lisp. What > modes does prism support btw? What are reasons why some languages are > not supported? Well, the documentation covers most of that. There's a mode for Lisp and C-style languages, and a prism-whitespace-mode for significant-whitespace languages like Python and Shell (in which depth is determined by both indentation and paren-type characters). See the screenshots for examples. :) I haven't determined that any particular languages are not supported. The modes can be activated in any buffer. Whether prism-mode or prism-whitespace-mode work effectively is, AFAIK, determined by the major mode's syntax tables. I'd be glad if more users could report whether it works with other languages that I don't use. >> Please let me know if you have any suggestions. Sometimes font-locking >> feels like an arcane art. :) > > Ok, I've not come that far yet ;-) You've already helped me! :)