unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ralf Angeli <angeli@caeruleus.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Excessive refontification when setting jit-lock-context-unfontify-pos
Date: Fri, 27 Apr 2007 19:53:02 +0200	[thread overview]
Message-ID: <87k5vxvh4x.fsf@neutrino.caeruleus.net> (raw)
In-Reply-To: <jwvps5s3ofb.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed\, 25 Apr 2007 03\:28\:15 -0400")

* 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	other threads:[~2007-04-27 17:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-23 19:44 Excessive refontification when setting jit-lock-context-unfontify-pos Ralf Angeli
2007-04-24  8:33 ` martin rudalics
2007-04-24 18:16   ` Ralf Angeli
2007-04-24 20:56     ` martin rudalics
2007-04-24 21:25       ` Ralf Angeli
2007-04-24 14:18 ` Stefan Monnier
2007-04-24 18:31   ` Ralf Angeli
2007-04-24 20:41     ` Stefan Monnier
2007-04-24 21:20       ` Ralf Angeli
2007-04-25  4:22         ` Stefan Monnier
2007-04-25  6:34           ` Ralf Angeli
2007-04-25  7:28             ` Stefan Monnier
2007-04-27 17:53               ` Ralf Angeli [this message]
2007-04-27 18:54                 ` Stefan Monnier
2007-04-27 21:11                   ` Ralf Angeli
2007-04-28 15:27                   ` Ralf Angeli
2007-04-30  0:23                     ` Stefan Monnier
2007-04-30  6:33                       ` Ralf Angeli
2007-04-25  8:18             ` martin rudalics
2007-04-27 18:02               ` Ralf Angeli
2007-04-25  8:27             ` martin rudalics

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=87k5vxvh4x.fsf@neutrino.caeruleus.net \
    --to=angeli@caeruleus.net \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).