emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Limits of multiline font-lock


From: Adam Porter
Subject: Re: Limits of multiline font-lock
Date: Wed, 18 Sep 2019 21:36:09 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Michael Heerdegen <address@hidden> writes:

> Adam Porter <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]