all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: jit-lock simplification?
Date: Wed, 13 Sep 2006 09:03:31 -0400	[thread overview]
Message-ID: <jwvac539ax9.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <m37j083qeb.fsf@kfs-l.imdomain.dk> (Kim F. Storm's message of "Wed\, 13 Sep 2006 14\:25\:00 +0200")

> I was debugging a timer problem, and noticed some very odd lambda
> forms in the timer-list.  It turns out to be the lambda generated by
> the jit-lock code below.

> Wouldn't it work just as well with the following patch?

I see no reason why it shouldn't work as well.
I just find it less elegant ;-)


        Stefan


> *** jit-lock.el	25 Aug 2006 08:57:52 +0200	1.55
> --- jit-lock.el	13 Sep 2006 14:12:18 +0200	
> ***************
> *** 397,415 ****
>              ;; eagerly extend the refontified region with
>              ;; jit-lock-after-change-extend-region-functions.
>              (when (< start orig-start)
> !              (lexical-let ((start start)
> !                            (orig-start orig-start)
> !                            (buf (current-buffer)))
> !                (run-with-timer
> !                 0 nil (lambda ()
> !                         (with-current-buffer buf
> !                           (with-buffer-prepared-for-jit-lock
> !                               (put-text-property start orig-start
> !                                                  'fontified t)))))))
  
>   	   ;; Find the start of the next chunk, if any.
>   	   (setq start (text-property-any next end 'fontified nil))))))))
  
>   \f
>   ;;; Stealth fontification.
  
> --- 397,415 ----
>              ;; eagerly extend the refontified region with
>              ;; jit-lock-after-change-extend-region-functions.
>              (when (< start orig-start)
> ! 	     (run-with-timer 0 nil 'jit-lock-fontify-again
> ! 			     (current-buffer) start orig-start))
  
>   	   ;; Find the start of the next chunk, if any.
>   	   (setq start (text-property-any next end 'fontified nil))))))))
  
> + (defun jit-lock-fontify-again (buf start end)
> +   "Fontify in buffer BUF from START to END."
> +   (with-current-buffer buf
> +     (with-buffer-prepared-for-jit-lock
> +      (put-text-property start end 'fontified t))))
> + 
> + 
>   \f
>   ;;; Stealth fontification.
  

> -- 
> Kim F. Storm <storm@cua.dk> http://www.cua.dk



> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2006-09-13 13:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-13 12:25 jit-lock simplification? Kim F. Storm
2006-09-13 13:03 ` Stefan Monnier [this message]
2006-09-13 13:31   ` David Kastrup
2006-09-13 14:43     ` Stefan Monnier
2006-09-13 13:49   ` Kim F. Storm
2006-09-13 19:24     ` Richard Stallman
2006-09-14 11:08       ` Kim F. Storm

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvac539ax9.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.