From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Font Locking issue: Need help/advice Date: Fri, 3 Apr 2020 19:48:02 -0400 Message-ID: References: <25fe76a8-025a-be67-8a28-3ac711f07766@protonmail.ch> <877dyw2o3a.fsf@randomsample> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="92932"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Serghei Iakovlev , GNU Emacs Developers To: David Engster Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 04 01:48:41 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 1jKW3F-000O3S-4i for ged-emacs-devel@m.gmane-mx.org; Sat, 04 Apr 2020 01:48:41 +0200 Original-Received: from localhost ([::1]:33786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKW3E-0005xa-4z for ged-emacs-devel@m.gmane-mx.org; Fri, 03 Apr 2020 19:48:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38887) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKW2g-0005TM-N4 for emacs-devel@gnu.org; Fri, 03 Apr 2020 19:48:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKW2f-0005F4-Jq for emacs-devel@gnu.org; Fri, 03 Apr 2020 19:48:06 -0400 Original-Received: from mail-qv1-xf32.google.com ([2607:f8b0:4864:20::f32]:33997) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKW2f-0005ES-GC for emacs-devel@gnu.org; Fri, 03 Apr 2020 19:48:05 -0400 Original-Received: by mail-qv1-xf32.google.com with SMTP id s18so4549605qvn.1 for ; Fri, 03 Apr 2020 16:48:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=p7uKyo8W7lNlv4nRW5WXXJ/okb3Ouk/Q51KfFgDRp8k=; b=Jd6t2TLlc4RZd0Us7EhYkPR30FWFgo7o8fOMpfNwnlmfLg/v7PBkVHomkAt7QyNpSg PS+JadIUHNBIQj6pHb7rw5HEOMkV4yUPeztKAxRNSXNUQ6EYtjPtzPAPM/tL9qi0l38l bQgAWjnRdpSqKd01cqVPYWd4PLv+mzcq9MMIDZtcgP8qqAPnhi7uwi7HpzCsMbcjQTyL NpUk7wQ45Bc4/nttNFPww/H2qPsmkW4e+nHMQhJ7wnlNZPuNtDAlSprVw0CchxIz0yFQ gcBfKo470eVF6TbSbuPKLXbw3pYP+MooY68yHPCBjOska5JSam0FRW3JFse6lTbF2kwT PB+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=p7uKyo8W7lNlv4nRW5WXXJ/okb3Ouk/Q51KfFgDRp8k=; b=AbJ7NvvA6btZ1Ey8RUHRUCUcfFk5+93EQEXbzifYVPjkmCgvZejv2vQKrpfrAul9d+ bb81lP6Jo+ZUB+FN5DaunFxokvzojb1RPIlOtdr91n8Ddq+1MWFyr/umoCoFRaOlwShe uQuZ70YiJAgpg+cpe0Iin5ju8+1W97MUnwOe4EBoQo+IN+FxKLfykJd6ZT1QR/PgmPJx HamQ8AgtvcX3QnJvC1s66mJtTOZ5bRYsv+3Yxix7/pVr3EFVq7cgU06ojf+uR8NGa5/J G4QEyUYO6max27jEEj4XYW4a0sDVf/1HLXWwMWSNf3jb6DHyvc+8TMlRQzzeyzZMKUl/ seuw== X-Gm-Message-State: AGi0PuZPL5woqsyQ5Hwk5nl0Ut7KclPPk6OTWyjEMUu2Iq7E1CkRmldh E0ApKuntDCK9dLDGgL2egV8= X-Google-Smtp-Source: APiQypJbwO8c4Pz3baZFHY5OkpzqA1mDLxQJoYJ2K95hjhNqsQPZ2bjui9SvAfefXrK66XZ3Vm/2zA== X-Received: by 2002:ad4:5107:: with SMTP id g7mr11060468qvp.213.1585957684369; Fri, 03 Apr 2020 16:48:04 -0700 (PDT) Original-Received: from [192.168.1.5] (c-174-60-229-153.hsd1.pa.comcast.net. [174.60.229.153]) by smtp.gmail.com with ESMTPSA id q24sm8089530qtk.45.2020.04.03.16.48.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Apr 2020 16:48:03 -0700 (PDT) In-Reply-To: <877dyw2o3a.fsf@randomsample> X-Mailer: Apple Mail (2.3608.80.23.2.2) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::f32 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:246364 Archived-At: > On Apr 3, 2020, at 6:36 PM, David Engster = wrote: >=20 >> - What happens on the GIF? How I can fix this? How to avoid similar >> in the future? >=20 > What happens here is that the initial font-lock goes over the whole > currently visible section, but as soon as you edit one line, font-lock > will be called only for the part of the buffer that has changed, and = it > seems your font-lock rules work differently in this case because the > context has changed. >=20 >> - In fact, I would like to be able to independently receive the >> answer to the question "Why did this happen?" so I'm interesting >> on debugging practices. How to debug similar issues? >=20 > For better understanding how font-lock actually works, I highly > recommend using font-lock-studio >=20 > https://github.com/Lindydancer/font-lock-studio >=20 > Also, take a look at the other linked packages in the description. In > your case, 'highlight-refontification' could be useful to see which > parts of the buffer actually get refontified when you edit it. >=20 > -David >=20 It is also helpful to look at jit-lock.el since that=E2=80=99s the = default on-the-fly fortification facility. Basically it marks all text = after the changed region (including the region) as =E2=80=9Cunfontified=E2= =80=9D when you edit the buffer. And the redisplay (C) code will call = jit-lock functions (which calls font-lock functions) to fontify the = unfontified text when it needs to display them. IIUC jit-lock is given = chunks of unfontified text (several thousand characters) each time.=20 Yuan