unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: jit-lock refontifies too much
Date: Thu, 29 Sep 2005 08:29:37 +0200	[thread overview]
Message-ID: <433B89D1.5060504@gmx.at> (raw)
In-Reply-To: <jwvek79b8c6.fsf-monnier+emacs@gnu.org>

 > This is ugly: problems specific to emacs-lisp-mode should not be fixed in
 > jit-lock but in lisp-mode.el.  I'm not sure how to fix it, tho.  Maybe you
 > could (in lisp-font-lock-syntactic-face-function) place
 > a jit-lock-defer-multiline property.
 >

It's ugly.  I'll defvar a jit-lock-context-refontify-function and set
that locally in lisp-mode.

 >
 >>+		(if (or (and (memq major-mode '(emacs-lisp-mode lisp-mode))
 >>+			     (or (= (nth 0 ppss) 1)
 >>+				 (= (nth 0 jit-lock-context-ppss) 1)))
 >
 >
 > Here I'd just compare (not (equal (nth 0 ppss) (nth 0 jit-lock-context-ppss))).

That would be wrong - I must refontify when both values equal 1 - else I
wouldn't handle changing

(defvar foo 1 0
   "bar")

to

(defvar foo 10
   "bar")

 >
 > It's not trivial to convince oneself that your code is correct.  I'd rather
 > you arrange somehow to leave as much of the code unchanged.  Among other
 > things, jit-lock-context-unfontify-pos should be set unconditionally in
 > jit-lock-after-change, as before.  Only if your optimization applies, then
 > you should reset jit-lock-context-unfontify-pos.  Basically make it obvious
 > that as long as your optimization does not succeed, the behavior is
 > unchanged.

You're right.  I'll try to follow that advice.

 > The code that does (when (marker-buffer jit-lock-context-start)
 > ...) above is the kind of "oops let's fix things back" kind of thing I'd
 > rather not see.
 >

That code is needed if someone has set `jit-lock-context-time' to a
large value, changes something in buffer A, switches to buffer B, and
changes something in buffer B _before_ jit-lock-context-fontify is able
to handle the modification in buffer A.  In that case, I can't apply my
optimization in buffer A but have to set jit-lock-context-unfontify-pos
to jit-lock-context-start.  If I implement your proposal and retain the
assignment in after-change-functions I shan't need that.

  reply	other threads:[~2005-09-29  6:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-12  6:25 jit-lock refontifies too much martin rudalics
2005-09-12 13:37 ` Stefan Monnier
2005-09-14  5:48   ` martin rudalics
2005-09-14 11:53     ` Stefan Monnier
2005-09-15  5:31       ` martin rudalics
2005-09-20  0:03       ` Richard M. Stallman
2005-09-20 13:53         ` Stefan Monnier
2005-09-21  9:24           ` martin rudalics
2005-09-21 13:34             ` Stefan Monnier
2005-09-22  6:52               ` martin rudalics
2005-09-22 17:37                 ` Stefan Monnier
2005-09-25 13:17                   ` martin rudalics
2005-09-26 23:56                     ` Richard M. Stallman
2005-09-27 13:09                       ` martin rudalics
2005-09-28 17:10                         ` Richard M. Stallman
2005-10-01  7:34                           ` martin rudalics
2005-10-01 23:25                             ` Richard M. Stallman
2005-10-02 14:53                               ` Stefan Monnier
2005-09-27 15:54                       ` Stefan Monnier
2005-09-28 12:26                         ` martin rudalics
2005-09-28 14:16                           ` Stefan Monnier
2005-09-29  6:29                             ` martin rudalics [this message]
2005-09-29 20:25                               ` Stefan Monnier
2005-09-25  2:40             ` Richard M. Stallman

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=433B89D1.5060504@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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 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).