emacs-devel
[Top][All Lists]
Advanced

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

Re: Excessive refontification when setting jit-lock-context-unfontify-po


From: Ralf Angeli
Subject: Re: Excessive refontification when setting jit-lock-context-unfontify-pos
Date: Fri, 27 Apr 2007 19:53:02 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.96 (gnu/linux)

* Stefan Monnier (2007-04-25) writes:

>> That's what I do.  (See `font-latex-fontify-region'.)  But the
>> multiline construct does not get fully highlighted if I don't set
>> j-l-c-u-p or set the fontified property to nil.
>
> Try C-l to make sure that the highlighting is really absent from the buffer,
> rather than merely being "not yet displayed".

When typing `C-l' highlighting appears.  Is there a possibility to
enforce such redisplay in an efficient way?  I could probably call
`sit-for' somewhere in the code but I am not sure if this would be the
right way.

Anyway, below you can find the testcase I promised.  Just execute it
and type ''.  Then you should see that only the line where '' was
typed is highlighted.

If you uncomment the line setting j-l-c-u-p you should see that the
region gets highlighted after a short delay without having to type
`C-l'.

Here is the code:

(progn
  (defun my-match-quote (limit)
    (let (start)
      (when (setq start (search-forward "``" limit t))
        (if (search-forward "''" nil t) ; Do not limit forward search
                                        ; for this testcase.
            (progn (set-match-data (list start end)) t)
          (set-match-data (list 0 0))))))
  (defun my-f-l-fontify-region (beg end &optional loudly)
    ;; For testing purposes we assume that the region should be extended
    ;; to the start of the buffer.
;;     (setq jit-lock-context-unfontify-pos 1)
    (font-lock-default-fontify-region 1 end loudly))
  (switch-to-buffer (get-buffer-create "*foo*"))
  (setq my-f-l-keywords '((my-match-quote . font-lock-string-face)))
  (setq font-lock-defaults '(my-f-l-keywords))
  (setq font-lock-fontify-region-function 'my-f-l-fontify-region)
  (insert "``")
  (dotimes (i 1000) (insert "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"))
  (font-lock-mode 1)
  (backward-char))

-- 
Ralf




reply via email to

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