unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Adam Porter <adam@alphapapa.net>
Cc: emacs-devel@gnu.org
Subject: Re: Limits of multiline font-lock
Date: Thu, 19 Sep 2019 04:05:13 +0200	[thread overview]
Message-ID: <87ftktghwm.fsf@web.de> (raw)
In-Reply-To: <874l198g0q.fsf@alphapapa.net> (Adam Porter's message of "Wed, 18 Sep 2019 16:13:09 -0500")

Adam Porter <adam@alphapapa.net> 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?

> I had to deal with similar issues about multiline font-locking.  After
> reading the manual section about it a few times, I managed to come up
> with a solution that works fairly well, although I'm sure it's quite
> primitive: I add a function to font-lock-extend-region-functions which
> extends the font-lock region forward and backwards before the matching
> function is called.  I don't know if it's the optimal way to do it--the
> manual mentioned that there are a few ways--but it seems to work.
>
> However, I have discovered a performance issue in the case of sexps that
> span large portions of the buffer (e.g. in my init files, I have some
> large use-package forms that contain many functions and span hundreds of
> lines).  If I could solve that, it would be great, but it works fine for
> most code.

If you use `font-lock-extend-region-functions', all of font-lock uses
the extended region, right?  I guess basing your functionality on
jit-lock-register could be better.  If finding the beginning-of-defun
and identifying the levels is what causes the main cost, it wouldn't
help much, however.

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?

> 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 ;-)


Michael.



  reply	other threads:[~2019-09-19  2:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-14 17:07 Limits of multiline font-lock Michael Heerdegen
2019-09-15 12:28 ` Stefan Monnier
2019-09-15 23:13   ` Michael Heerdegen
2019-09-16 19:00     ` Stefan Monnier
2019-09-18  3:23       ` Michael Heerdegen
2019-09-18 21:13 ` Adam Porter
2019-09-19  2:05   ` Michael Heerdegen [this message]
2019-09-19  2:36     ` Adam Porter
2023-10-07  7:30     ` Adam Porter
2023-10-14  4:06       ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ftktghwm.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=adam@alphapapa.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).