[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: regexp font-lock highlighting
From: |
martin rudalics |
Subject: |
Re: regexp font-lock highlighting |
Date: |
Sat, 04 Jun 2005 10:11:51 +0200 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
> Moreover I don't think that anything is "broken" in the following:
>
> ;; Underline innermost grouping, so that you can more easily see what
> ;; belongs together. 2005-05-12: Font-lock can go into an
> ;; unbreakable endless loop on this -- something's broken.
>
;;("[\\][\\][(]\\(?:\\?:\\)?\\(\\(?:[^\\\"]+\\|[\\]\\(?:[^\\]\\|[\\][^(]\\)\\)+?\\)[\\][\\][)]"
> ;;1 'underline prepend)
>
> I believe that `font-lock-fontify-keywords-region' starts backtracking
> and this can take hours in more complicated cases.
>
> That sounds like "broken" to me. Whether it takes hours, or forever,
> either way Font Lock mode will be very unpleasant to use.
>
> Anyway, regexps are
> not suited to handle this. If you are willing to pay for two additional
> buffer-local variables such as
>
> I believe you, and it is ok to add local variables for this purpose.
> (Their names should start with `font-lock-' so that people understand
> what they are for. Or perhaps with `lisp-fl-' since they are
> specifically for Lisp mode.)
>
Note that I only fixed the endless looping behavior here. My code is
not suitable when you use a support mode like jit-lock and change the
delimiters of regexp groups. You would have to refontify text manually
which is not very desirable. I'll try to handle this in a more
user-friendly way.