From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Adam Porter Newsgroups: gmane.emacs.devel Subject: Re: font lock with functions Date: Tue, 31 Mar 2020 05:42:47 -0500 Message-ID: <87lfngst3s.fsf@alphapapa.net> References: <86tv2h2vww.fsf@gmail.com> <20200322123818.GB32470@ACM> <87eetk5swm.fsf@gnu.org> <20200326193128.GC14092@ACM> <86d08y4zsx.fsf@gmail.com> <83sghs7qdz.fsf@gnu.org> <7ee94ed4-7a11-90bd-df69-c0eeacaf191c@gmail.com> <835zeo7c92.fsf@gnu.org> <05de335b-383e-b32d-2e7e-e79192d364de@yandex.ru> <03981ead-3aca-c238-a9d0-88407ffae451@yandex.ru> <83wo745tw6.fsf@gnu.org> <837dz35j30.fsf@gnu.org> <9b013d7f-664a-711d-0b7b-d7bd961b8ef0@yandex.ru> <87a73w4yp6.fsf@randomsample> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="53914"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 31 12:43:53 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJEN5-000Dst-Em for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Mar 2020 12:43:51 +0200 Original-Received: from localhost ([::1]:35714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJEN4-0003wY-FX for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Mar 2020 06:43:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51654) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJEMF-0003Gw-3s for emacs-devel@gnu.org; Tue, 31 Mar 2020 06:43:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJEME-00082M-0B for emacs-devel@gnu.org; Tue, 31 Mar 2020 06:42:59 -0400 Original-Received: from ciao.gmane.io ([159.69.161.202]:44726) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJEMD-00081e-QI for emacs-devel@gnu.org; Tue, 31 Mar 2020 06:42:57 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1jJEMB-000CoX-Gz for emacs-devel@gnu.org; Tue, 31 Mar 2020 12:42:55 +0200 X-Injected-Via-Gmane: http://gmane.org/ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 159.69.161.202 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:246085 Archived-At: David Engster writes: > It is very easy during testing to completely hang your Emacs session > if one of the font-lock functions hangs. One usually needs to kill > Emacs in this case. Often using "pkill -SIGUSR2 emacs" can help. If that works to interrupt Emacs and display a backtrace, you can then switch to the buffer being font-locked and disable the mode doing the font-locking (i.e. removing the font-lock keywords). Then when you close the backtrace, Emacs should not go back into the font-locking loop in your code. At least, this usually worked for me when I was working on prism.el. Sometimes some random mashing of C-g helps as well. And once in a while, running "pkill -SIGUSR2 emacs" in a shell loop a few hundred times, while randomly mashing C-g in Emacs, works as a last resort. :) If even that doesn't help, then you may want to code in one Emacs instance and test the code in another. And, yes, Anders's font-lock packages are very helpful. I've catalogued some of those and other tools here: https://github.com/alphapapa/emacs-package-dev-handbook#highlighting--font-locking