From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: How can I debug a problem triggered from jit-lock's background fontification? Date: Mon, 07 Feb 2011 10:40:48 -0500 Message-ID: References: <20110206205403.GA5978@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1297111459 32366 80.91.229.12 (7 Feb 2011 20:44:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 7 Feb 2011 20:44:19 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 07 21:44:14 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PmXwP-0007cH-LL for ged-emacs-devel@m.gmane.org; Mon, 07 Feb 2011 21:44:09 +0100 Original-Received: from localhost ([127.0.0.1]:36992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmXbq-0005fU-JU for ged-emacs-devel@m.gmane.org; Mon, 07 Feb 2011 15:22:54 -0500 Original-Received: from [140.186.70.92] (port=47982 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmTIX-0001wB-Og for emacs-devel@gnu.org; Mon, 07 Feb 2011 10:46:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PmTCr-0008Nh-Ra for emacs-devel@gnu.org; Mon, 07 Feb 2011 10:40:50 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:33472 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmTCr-0008NK-OB for emacs-devel@gnu.org; Mon, 07 Feb 2011 10:40:49 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAOKgT03O+LKf/2dsb2JhbAClMXS6DYVaBIR6jx4 X-IronPort-AV: E=Sophos;i="4.60,438,1291611600"; d="scan'208";a="90803598" Original-Received: from 206-248-178-159.dsl.teksavvy.com (HELO pastel.home) ([206.248.178.159]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 07 Feb 2011 10:40:48 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 9192C59098; Mon, 7 Feb 2011 10:40:48 -0500 (EST) In-Reply-To: <20110206205403.GA5978@muc.de> (Alan Mackenzie's message of "Sun, 6 Feb 2011 20:54:03 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:135687 Archived-At: > 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