unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: emacs-devel@gnu.org
Subject: Re: Limits of multiline font-lock
Date: Wed, 18 Sep 2019 21:36:09 -0500	[thread overview]
Message-ID: <87ef0d6mhy.fsf@alphapapa.net> (raw)
In-Reply-To: 87ftktghwm.fsf@web.de

Michael Heerdegen <michael_heerdegen@web.de> writes:

> 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?

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!  :)




  reply	other threads:[~2019-09-19  2:36 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
2019-09-19  2:36     ` Adam Porter [this message]
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=87ef0d6mhy.fsf@alphapapa.net \
    --to=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).