emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: perl mode color highlighting working badly


From: Warren L Dodge
Subject: Re: perl mode color highlighting working badly
Date: Wed, 26 Oct 2005 09:16:11 -0700 (PDT)


The patches did change things.

When I edit the file and go quickly ( CNTL-END ) to the bottom there is about
a 6 second delay before it gets there.

Then I went down from the top a few pages and aded a " character to start a
string. I scanned page by page to the bottom and everything was colored as a
quoted string. I went back and removed the " and scanned page by page down
and everything was correct again.

If I add the " and go quickly to the bottom ( CNTL-END ) then the text at the
bottom remains the correct coloring which isn't right.

If I add the " then wait for a few seconds and then remove the " and go to
the bottom quickly ( CNTL-END ) it appears the code at the bottom is the
right color. But scanning page by page upward there are sections of code that
remain colored improperly.

I will use the patched code and see if I notcie anything else.

>  Cc: address@hidden, address@hidden, address@hidden
>  From: Stefan Monnier <address@hidden>
>  Date: Tue, 25 Oct 2005 22:52:13 -0400
>  MIME-Version: 1.0
>  Content-Type: text/plain; charset=us-ascii
>  
>  > I knew the file alone wouldn't be enough. So I can try and explain what I 
> do
>  > to see the problems.
>  
>  Can you try the patch below and tell me if it improves anything?
>  And if so, at what performance cost (it only costs to perl-mode buffers)?
>  
>  
>          Stefan
>  
>  
>  --- orig/lisp/progmodes/perl-mode.el
>  +++ mod/lisp/progmodes/perl-mode.el
>  @@ -534,6 +534,7 @@
>                             . perl-font-lock-syntactic-keywords)
>                            (font-lock-syntactic-face-function
>                             . perl-font-lock-syntactic-face-function)
>  +                             (font-lock-fontify-syntactically-eagerly . t)
>                            (parse-sexp-lookup-properties . t)))
>     ;; Tell imenu how to handle Perl.
>     (set (make-local-variable 'imenu-generic-expression)
>  
>  --- orig/lisp/font-lock.el
>  +++ mod/lisp/font-lock.el
>  @@ -1033,6 +1033,12 @@
>   Useful for things like RMAIL and Info where the whole buffer is not
>   a very meaningful entity to highlight.")
>   
>  +(defvar font-lock-fontify-syntactically-eagerly nil
>  +  "If non-nil, `font-lock-fontify-syntactically-region' is applied to 
> non-displayed text.
>  +For modes which set syntax-table properties from
>  +`font-lock-syntactic-face-function', it may be necessary to also apply
>  +`font-lock-fontify-syntactically-region' on all the buffer before point.")
>  +
>   (defun font-lock-default-fontify-region (beg end loudly)
>     (save-buffer-state
>         ((parse-sexp-lookup-properties
>  @@ -1064,11 +1070,23 @@
>             (unless (bolp) (setq end (line-beginning-position 2)))
>         ;; Now do the fontification.
>         (font-lock-unfontify-region beg end)
>  -      (when font-lock-syntactic-keywords
>  -        (font-lock-fontify-syntactic-keywords-region beg end))
>  -      (unless font-lock-keywords-only
>  -        (font-lock-fontify-syntactically-region beg end loudly))
>  -      (font-lock-fontify-keywords-region beg end loudly))
>  +          (let ((sbeg beg))
>  +            ;; Ensure the beginning of the file is properly 
> syntactic-fontified.
>  +            (when (and font-lock-syntactically-fontified
>  +                       (< font-lock-syntactically-fontified sbeg))
>  +              (setq sbeg (max font-lock-syntactically-fontified 
> (point-min)))
>  +              (setq font-lock-syntactically-fontified end))
>  +            (when font-lock-syntactic-keywords
>  +              (font-lock-fontify-syntactic-keywords-region sbeg end))
>  +            (unless font-lock-keywords-only
>  +              (font-lock-fontify-syntactically-region
>  +               ;; For modes which set syntax-table properties from
>  +               ;; font-lock-syntactic-face-function, it may be necessary to
>  +               ;; also apply font-lock-fontify-syntactically-region on all
>  +               ;; the buffer before point.
>  +               (if font-lock-fontify-syntactically-eagerly sbeg beg)
>  +               end loudly)))
>  +          (font-lock-fontify-keywords-region beg end loudly))
>         ;; Clean up.
>         (set-syntax-table old-syntax-table))))
>   
>  @@ -1282,11 +1300,6 @@
>   (defun font-lock-fontify-syntactic-keywords-region (start end)
>     "Fontify according to `font-lock-syntactic-keywords' between START and 
> END.
>   START should be at the beginning of a line."
>  -  ;; Ensure the beginning of the file is properly syntactic-fontified.
>  -  (when (and font-lock-syntactically-fontified
>  -         (< font-lock-syntactically-fontified start))
>  -    (setq start (max font-lock-syntactically-fontified (point-min)))
>  -    (setq font-lock-syntactically-fontified end))
>     ;; If `font-lock-syntactic-keywords' is a symbol, get the real keywords.
>     (when (symbolp font-lock-syntactic-keywords)
>       (setq font-lock-syntactic-keywords (font-lock-eval-keywords
>  






reply via email to

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