unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: How can I debug a problem triggered from jit-lock's background fontification?
Date: Mon, 07 Feb 2011 10:40:48 -0500	[thread overview]
Message-ID: <jwv7hdbj23p.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20110206205403.GA5978@muc.de> (Alan Mackenzie's message of "Sun,  6 Feb 2011 20:54:03 +0000")

> I have instrumented the CC Mode function for Edebug, yet something seems
> to be inhibiting the invocation of Edebug from inside jit.  No doubt
> there's a good reason for this, but it has been getting on my nerves for
> years.

Yes, the problem is that jit-lock is called when redisplay is needed so
it's tricky to let Edebug work at this time (it's easy to make it work
with redisplay inhibited, but then you'll need to use it blindly ;-).

> Would somebody please suggest a way I can debug the actions of
> jit-locking from Edebug, or possibly some other way of making progress.

I've had to deal with this problem, as you can imagine, and I feel
your pain.  The way I generally handle this problem is as follows:
- first, try to turn off jit-lock and to reproduce the problem.  This is
  often all it takes, but admittedly, it doesn't always cut it.
- if that fails, then turn jit-lock back on, do M-x trace-function-background
  RET font-lock-fontify-region RET, and then try and reproduce the
  problem (try and be careful to make sure font-lock is only invoked in
  that one buffer during this time).
- if the trace itself doesn't give you enough of a hint (that's usually
  the case, but sometimes, just seeing where jit-lock placed the
  boundaries of its chunks is enough to see the problem), then turn off
  jit-lock again, and call font-lock-fontify-region by hand with the
  args recorded in the trace.  You can then use Edebug to your heart's
  content during this replay.
  I haven't had to do that often enough and with enough calls to
  font-lock-fontify-region to get me to automate this replay, but if you
  end up writing some code to automate it, I'd be happy to add it to
  jit-lock.
- if the above replay does not reproduce the problem, then you may want
  to try meditation.


        Stefan



  reply	other threads:[~2011-02-07 15:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-06 20:54 How can I debug a problem triggered from jit-lock's background fontification? Alan Mackenzie
2011-02-07 15:40 ` Stefan Monnier [this message]
2011-02-07 22:19   ` Alan Mackenzie
2011-02-07 22:22     ` Lennart Borgman
2011-03-08  8:02       ` Daniel Colascione
2011-03-08  7:58   ` Daniel Colascione
2011-03-08 21:07     ` Stefan Monnier

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=jwv7hdbj23p.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=acm@muc.de \
    --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 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).